@ -25,10 +25,10 @@
# include <kuser.h>
# include <kstandarddirs.h>
# include <kmimetype.h>
# include < qfocusdata.h>
# include < qstyle.h>
# include < qfile.h>
# include < qcursor.h>
# include < t qfocusdata.h>
# include < t qstyle.h>
# include < t qfile.h>
# include < t qcursor.h>
# include <kpopupmenu.h>
# include <kdebug.h>
@ -36,8 +36,8 @@
# include "menuhandler.h"
# include "buttons.h"
MenuHandler : : MenuHandler ( QWidget * parent , Prefs * prefs , char * name , WFlags fl )
: QFrame( parent , name , fl ) , searchMode ( false )
MenuHandler : : MenuHandler ( T QWidget * parent , Prefs * prefs , char * name , WFlags fl )
: T QFrame( parent , name , fl ) , searchMode ( false )
{
prefSkel = prefs ;
@ -46,14 +46,14 @@ MenuHandler::MenuHandler( QWidget *parent, Prefs *prefs, char *name, WFlags fl)
KServiceGroup : : Ptr service = KServiceGroup : : root ( ) ;
//Kicker config
QString kickerConfPath = locate ( " config " , " kickerrc " ) ;
T QString kickerConfPath = locate ( " config " , " kickerrc " ) ;
kickerConf = new KConfig ( kickerConfPath ) ;
kickerConfWatch = new KDirWatch ( this ) ;
kickerConfWatch - > addFile ( kickerConfPath ) ;
connect ( kickerConfWatch , SIGNAL ( dirty ( const QString& ) ) , this ,
connect ( kickerConfWatch , SIGNAL ( dirty ( const T QString& ) ) , this ,
SLOT ( slotModKickerConf ( ) ) ) ;
connect ( kickerConfWatch , SIGNAL ( dirty ( const QString& ) ) , this ,
connect ( kickerConfWatch , SIGNAL ( dirty ( const T QString& ) ) , this ,
SIGNAL ( kickerConfChanged ( ) ) ) ;
if ( _newAppsNotification = prefSkel - > newAppsNotification ( ) )
@ -76,7 +76,7 @@ MenuHandler::MenuHandler( QWidget *parent, Prefs *prefs, char *name, WFlags fl)
//Main widget initialization
menu = new Menu ( this , " tastyMenu " ) ;
MenuHandlerLayout = new QVBoxLayout( this , 0 , 0 , " MenuHandlerLayout " ) ;
MenuHandlerLayout = new T QVBoxLayout( this , 0 , 0 , " MenuHandlerLayout " ) ;
MenuHandlerLayout - > addWidget ( menu ) ;
readConfig ( ) ;
@ -84,8 +84,8 @@ MenuHandler::MenuHandler( QWidget *parent, Prefs *prefs, char *name, WFlags fl)
//Searchline...
iconLoader = KGlobal : : iconLoader ( ) ;
QPixmap icon ;
if ( QApplication: : reverseLayout ( ) )
T QPixmap icon ;
if ( T QApplication: : reverseLayout ( ) )
icon = iconLoader - > loadIcon ( " locationbar_erase " , KIcon : : Small ) ;
else
icon = iconLoader - > loadIcon ( " clear_left " , KIcon : : Small ) ;
@ -93,7 +93,7 @@ MenuHandler::MenuHandler( QWidget *parent, Prefs *prefs, char *name, WFlags fl)
connect ( menu - > clearButton , SIGNAL ( clicked ( ) ) , menu - > searchLine , SLOT ( clear ( ) ) ) ;
menu - > detachButton - > setIconSet ( QPixmap( uic_findImage ( " detach.png " ) ) ) ;
menu - > detachButton - > setIconSet ( T QPixmap( uic_findImage ( " detach.png " ) ) ) ;
connect ( menu - > detachButton , SIGNAL ( clicked ( ) ) , this , SLOT ( switchWindowMode ( ) ) ) ;
menu - > searchLine - > setContextMenuEnabled ( false ) ;
@ -125,17 +125,17 @@ MenuHandler::MenuHandler( QWidget *parent, Prefs *prefs, char *name, WFlags fl)
//user icon and login
KUser * user = new KUser ( ) ;
QString loginName ( user - > loginName ( ) ) ;
QImage
T QString loginName ( user - > loginName ( ) ) ;
T QImage
userImage ( locate
( " data " , " /home/ " + loginName + " /.face.icon " ) ) ;
if ( ! userImage . isNull ( ) )
{
userImage = userImage . smoothScale ( KIcon : : SizeSmallMedium , KIcon : : SizeSmallMedium ) ;
menu - > switchButton - > setIconSet ( QPixmap( userImage ) ) ;
menu - > switchButton - > setIconSet ( T QPixmap( userImage ) ) ;
}
menu - > switchButton - > setText ( loginName ) ;
sessionsMenu = new QPopupMenu( ) ;
sessionsMenu = new T QPopupMenu( ) ;
menu - > switchButton - > setPopup ( sessionsMenu ) ;
@ -145,25 +145,25 @@ MenuHandler::MenuHandler( QWidget *parent, Prefs *prefs, char *name, WFlags fl)
//left/middle mouse button
connect ( menu - > dynamicList ,
SIGNAL ( activated ( QListViewItem * , const QPoint & , int ) ) , this ,
SLOT ( dynListClicked ( QListViewItem * , const QPoint & , int ) ) ) ;
SIGNAL ( activated ( T QListViewItem * , const T QPoint & , int ) ) , this ,
SLOT ( dynListClicked ( T QListViewItem * , const T QPoint & , int ) ) ) ;
connect ( menu - > rootList ,
SIGNAL ( activated ( QListViewItem * , const QPoint & , int ) ) , this ,
SLOT ( rootListClicked ( QListViewItem * , const QPoint & , int ) ) ) ;
SIGNAL ( activated ( T QListViewItem * , const T QPoint & , int ) ) , this ,
SLOT ( rootListClicked ( T QListViewItem * , const T QPoint & , int ) ) ) ;
connect ( menu - > childList ,
SIGNAL ( activated ( QListViewItem * , const QPoint & , int ) ) , this ,
SLOT ( childListClicked ( QListViewItem * , const QPoint & , int ) ) ) ;
SIGNAL ( activated ( T QListViewItem * , const T QPoint & , int ) ) , this ,
SLOT ( childListClicked ( T QListViewItem * , const T QPoint & , int ) ) ) ;
//right mouse button
connect ( menu - > dynamicList ,
SIGNAL ( contextMenuRequested ( QListViewItem * , const QPoint & , int ) ) , this ,
SLOT ( slotContextMenu ( QListViewItem * , const QPoint & , int ) ) ) ;
SIGNAL ( contextMenuRequested ( T QListViewItem * , const T QPoint & , int ) ) , this ,
SLOT ( slotContextMenu ( T QListViewItem * , const T QPoint & , int ) ) ) ;
connect ( menu - > rootList ,
SIGNAL ( contextMenuRequested ( QListViewItem * , const QPoint & , int ) ) , this ,
SLOT ( slotContextMenu ( QListViewItem * , const QPoint & , int ) ) ) ;
SIGNAL ( contextMenuRequested ( T QListViewItem * , const T QPoint & , int ) ) , this ,
SLOT ( slotContextMenu ( T QListViewItem * , const T QPoint & , int ) ) ) ;
connect ( menu - > childList ,
SIGNAL ( contextMenuRequested ( QListViewItem * , const QPoint & , int ) ) , this ,
SLOT ( slotContextMenu ( QListViewItem * , const QPoint & , int ) ) ) ;
SIGNAL ( contextMenuRequested ( T QListViewItem * , const T QPoint & , int ) ) , this ,
SLOT ( slotContextMenu ( T QListViewItem * , const T QPoint & , int ) ) ) ;
//don't open categories on mouseover on childlist
//menu->childList->setEasyOpen( true );
@ -191,15 +191,15 @@ void MenuHandler::loadNewInstalledApps()
//Notification for newly installed apps
xdgMenuLister = new KDirLister ( ) ;
KStandardDirs * standardDir = new KStandardDirs ( ) ;
QStringList appDirs = standardDir - > findDirs ( " xdgdata-apps " , " . " ) ;
T QStringList appDirs = standardDir - > findDirs ( " xdgdata-apps " , " . " ) ;
firstListing = 0 ;
for ( QStringList: : Iterator it = appDirs . begin ( ) ; it ! = appDirs . end ( ) ; + + it )
for ( T QStringList: : Iterator it = appDirs . begin ( ) ; it ! = appDirs . end ( ) ; + + it )
{
xdgMenuLister - > openURL ( * it , true ) ;
/*HACK: links to kde programs are often installed in a kde subdirectory
of one of these , so i duplicate all the entries with entry + " kde/ " */
QString appDirWithKde = ( * it ) + " kde/ " ;
if ( QFile: : exists ( appDirWithKde ) )
T QString appDirWithKde = ( * it ) + " kde/ " ;
if ( T QFile: : exists ( appDirWithKde ) )
{
xdgMenuLister - > openURL ( appDirWithKde , true ) ;
firstListing + + ;
@ -215,7 +215,7 @@ void MenuHandler::loadNewInstalledApps()
xdgMenuWatch = new KDirWatch ( this ) ;
xdgMenuWatch - > addFile ( locateLocal ( " xdgconf-menu " , " applications-kmenuedit.menu " ) ) ;
//connect with slotApplicationRemoved() because we need to wait a while...
connect ( xdgMenuWatch , SIGNAL ( dirty ( const QString& ) ) , this ,
connect ( xdgMenuWatch , SIGNAL ( dirty ( const T QString& ) ) , this ,
SLOT ( slotApplicationRemoved ( ) ) ) ;
newInstalledList = prefSkel - > newInstalledApps ( ) ;
@ -236,12 +236,12 @@ void MenuHandler::loadNewInstalledApps()
void MenuHandler : : setupColumns ( )
{
menu - > dynamicList - > header ( ) - > hide ( ) ;
menu - > dynamicList - > setResizeMode ( QListView: : AllColumns ) ;
menu - > dynamicList - > setResizeMode ( T QListView: : AllColumns ) ;
menu - > dynamicList - > addColumn ( " name " ) ;
menu - > dynamicList - > setShowToolTips ( true ) ;
menu - > dynamicList - > setSortColumn ( - 1 ) ;
menu - > dynamicList - > header ( ) - > setResizeEnabled ( false ) ;
menu - > dynamicList - > setHScrollBarMode ( QScrollView: : AlwaysOff ) ;
menu - > dynamicList - > setHScrollBarMode ( T QScrollView: : AlwaysOff ) ;
menu - > dynamicList - > setActionIconSize ( _actionIconSize ) ;
menu - > dynamicList - > setRootIsDecorated ( _showExpander ) ;
//manage drag'n drop
@ -251,21 +251,21 @@ void MenuHandler::setupColumns()
this , SLOT ( dynListElemMoved ( ) ) ) ;
menu - > rootList - > header ( ) - > hide ( ) ;
menu - > rootList - > setResizeMode ( QListView: : AllColumns ) ;
menu - > rootList - > setResizeMode ( T QListView: : AllColumns ) ;
menu - > rootList - > addColumn ( " name " ) ;
menu - > rootList - > setSortColumn ( - 1 ) ;
menu - > rootList - > header ( ) - > setResizeEnabled ( false ) ;
menu - > rootList - > setHScrollBarMode ( QScrollView: : AlwaysOff ) ;
menu - > rootList - > setHScrollBarMode ( T QScrollView: : AlwaysOff ) ;
menu - > rootList - > setHighLightGroups ( false ) ;
menu - > rootList - > setActionIconSize ( _actionIconSize ) ;
menu - > rootList - > setDragEnabled ( true ) ;
menu - > childList - > header ( ) - > hide ( ) ;
menu - > childList - > setResizeMode ( QListView: : AllColumns ) ;
menu - > childList - > setResizeMode ( T QListView: : AllColumns ) ;
menu - > childList - > addColumn ( " name " ) ;
menu - > childList - > setSortColumn ( _alphabetical ? 0 : - 1 ) ;
menu - > childList - > header ( ) - > setResizeEnabled ( false ) ;
menu - > childList - > setHScrollBarMode ( QScrollView: : AlwaysOff ) ;
menu - > childList - > setHScrollBarMode ( T QScrollView: : AlwaysOff ) ;
menu - > childList - > setActionIconSize ( _actionIconSize ) ;
menu - > childList - > setRootIsDecorated ( _showExpander ) ;
menu - > childList - > setDragEnabled ( true ) ;
@ -276,7 +276,7 @@ void MenuHandler::dynListElemMoved( )
{
//very stupid: iterate the entire list and rewrite the favouriteList
favouriteList . clear ( ) ;
QListViewItemIterator it ( menu - > dynamicList ) ;
T QListViewItemIterator it ( menu - > dynamicList ) ;
while ( it . current ( ) )
{
@ -294,31 +294,31 @@ void MenuHandler::dynListElemMoved( )
}
bool MenuHandler : : eventFilter ( QObject * o , QEvent * e )
bool MenuHandler : : eventFilter ( T QObject * o , T QEvent * e )
{
if ( e - > type ( ) = = QEvent: : KeyPress )
if ( e - > type ( ) = = T QEvent: : KeyPress )
{
QKeyEvent * keyEvent = ( QKeyEvent * ) e ;
QFocusData * fData = focusData ( ) ;
T QKeyEvent * keyEvent = ( T QKeyEvent * ) e ;
T QFocusData * fData = focusData ( ) ;
fData - > home ( ) ;
switch ( keyEvent - > key ( ) )
{
case Qt: : Key_Up :
if ( dynamic_cast < QComboBox * > ( o ) )
case T Qt: : Key_Up :
if ( dynamic_cast < T QComboBox * > ( o ) )
return false ;
fData - > prev ( ) - > setFocus ( ) ;
break ;
case Qt: : Key_Down :
case T Qt: : Key_Down :
{
if ( dynamic_cast < QComboBox * > ( o ) )
if ( dynamic_cast < T QComboBox * > ( o ) )
return false ;
//this is a workaround in order to set the focus on the
//right widget when the combobox is disabled
QWidget * nextWidget = fData - > next ( ) ;
T QWidget * nextWidget = fData - > next ( ) ;
if ( nextWidget - > isEnabled ( ) )
nextWidget - > setFocus ( ) ;
else
@ -326,29 +326,29 @@ bool MenuHandler::eventFilter( QObject *o, QEvent * e )
}
break ;
case Qt: : Key_Right :
case T Qt: : Key_Right :
if ( dynamic_cast < KListViewSearchLine * > ( o ) )
return false ;
fData - > next ( ) - > setFocus ( ) ;
break ;
case Qt: : Key_Left :
case T Qt: : Key_Left :
if ( dynamic_cast < KListViewSearchLine * > ( o ) )
return false ;
fData - > prev ( ) - > setFocus ( ) ;
break ;
case Qt: : Key_Enter :
case Qt: : Key_Return :
case T Qt: : Key_Enter :
case T Qt: : Key_Return :
{
//only filter enter on search line
if ( o ! = menu - > searchLine )
return false ;
QListViewItem * listItem = NULL ;
T QListViewItem * listItem = NULL ;
//execute the only list item when there is exactly one
QListViewItemIterator it ( menu - > dynamicList ,
QListViewItemIterator: : Visible ) ;
T QListViewItemIterator it ( menu - > dynamicList ,
T QListViewItemIterator: : Visible ) ;
//listItem = it.current();
int count = 0 ;
//ensure the first level have only one result
@ -367,7 +367,7 @@ bool MenuHandler::eventFilter( QObject *o, QEvent * e )
if ( listItem )
{
dynListClicked ( listItem , QPoint( 0 , 0 ) , 0 ) ;
dynListClicked ( listItem , T QPoint( 0 , 0 ) , 0 ) ;
menu - > searchLine - > clear ( ) ;
}
@ -381,11 +381,11 @@ bool MenuHandler::eventFilter( QObject *o, QEvent * e )
return true ;
}
//for some reasons clicking with the right mouse button on the searchline everything crashes...
/* else if( e->type() == QEvent::MouseButtonPress && o == menu->searchLine )
/* else if( e->type() == T QEvent::MouseButtonPress && o == menu->searchLine )
{ return true ;
QMouseEvent * mouseEvent = ( QMouseEvent * ) e ;
T QMouseEvent * mouseEvent = ( T QMouseEvent * ) e ;
if ( mouseEvent - > button ( ) ! = QMouseEvent: : RightButton )
if ( mouseEvent - > button ( ) ! = T QMouseEvent: : RightButton )
return true ;
if ( menu - > searchLine - > text ( ) . length ( ) < 4 )
@ -443,7 +443,7 @@ void MenuHandler::readConfig()
//menu size
_menuWidth = 100.0 / prefSkel - > menuWidth ( ) ;
_menuHeight = 100.0 / prefSkel - > menuHeight ( ) ;
QRect r = QDesktopWidget( ) . screenGeometry ( this ) ;
T QRect r = T QDesktopWidget( ) . screenGeometry ( this ) ;
int w = ( int ) ( r . width ( ) / _menuWidth ) ;
int h = ( int ) ( r . height ( ) / _menuHeight ) ;
resize ( w , h ) ;
@ -454,48 +454,48 @@ void MenuHandler::readConfig()
_isNormalWindow = prefSkel - > isNormalWindow ( ) ;
if ( _isNormalWindow )
{
menu - > detachButton - > setIconSet ( QPixmap( uic_findImage ( " attach.png " ) ) ) ;
QToolTip: : add ( menu - > detachButton , tr2i18n ( " Make this window a popup menu " ) ) ;
menu - > detachButton - > setIconSet ( T QPixmap( uic_findImage ( " attach.png " ) ) ) ;
T QToolTip: : add ( menu - > detachButton , tr2i18n ( " Make this window a popup menu " ) ) ;
}
else
{
menu - > detachButton - > setIconSet ( QPixmap( uic_findImage ( " detach.png " ) ) ) ;
QToolTip: : add ( menu - > detachButton , tr2i18n ( " Make this menu a normal window " ) ) ;
menu - > detachButton - > setIconSet ( T QPixmap( uic_findImage ( " detach.png " ) ) ) ;
T QToolTip: : add ( menu - > detachButton , tr2i18n ( " Make this menu a normal window " ) ) ;
}
// disconnect(menu->searchLine, 0, 0, 0);
if ( ! _kerryIntegration & & ! _strigiIntegration )
{
//menu->searchLine->setListView((KListView *)(menu->dynamicList));
disconnect ( menu - > searchLine , SIGNAL ( returnPressed ( const QString & ) ) ,
this , SLOT ( kerrySearch ( const QString & ) ) ) ;
disconnect ( menu - > searchLine , SIGNAL ( returnPressed ( const QString & ) ) ,
this , SLOT ( strigiSearch ( const QString & ) ) ) ;
connect ( menu - > searchLine , SIGNAL ( textChanged ( const QString & ) ) ,
this , SLOT ( initializeSearch ( const QString & ) ) ) ;
disconnect ( menu - > searchLine , SIGNAL ( returnPressed ( const T QString & ) ) ,
this , SLOT ( kerrySearch ( const T QString & ) ) ) ;
disconnect ( menu - > searchLine , SIGNAL ( returnPressed ( const T QString & ) ) ,
this , SLOT ( strigiSearch ( const T QString & ) ) ) ;
connect ( menu - > searchLine , SIGNAL ( textChanged ( const T QString & ) ) ,
this , SLOT ( initializeSearch ( const T QString & ) ) ) ;
}
else if ( _kerryIntegration )
{
menu - > searchLine - > setListView ( NULL ) ;
menu - > searchLine - > setEnabled ( true ) ;
disconnect ( menu - > searchLine , SIGNAL ( textChanged ( const QString & ) ) ,
this , SLOT ( initializeSearch ( const QString & ) ) ) ;
disconnect ( menu - > searchLine , SIGNAL ( returnPressed ( const QString & ) ) ,
this , SLOT ( strigiSearch ( const QString & ) ) ) ;
connect ( menu - > searchLine , SIGNAL ( returnPressed ( const QString & ) ) ,
this , SLOT ( kerrySearch ( const QString & ) ) ) ;
disconnect ( menu - > searchLine , SIGNAL ( textChanged ( const T QString & ) ) ,
this , SLOT ( initializeSearch ( const T QString & ) ) ) ;
disconnect ( menu - > searchLine , SIGNAL ( returnPressed ( const T QString & ) ) ,
this , SLOT ( strigiSearch ( const T QString & ) ) ) ;
connect ( menu - > searchLine , SIGNAL ( returnPressed ( const T QString & ) ) ,
this , SLOT ( kerrySearch ( const T QString & ) ) ) ;
menu - > searchLine - > setContextMenuEnabled ( false ) ;
}
else //strigi
{
menu - > searchLine - > setListView ( NULL ) ;
menu - > searchLine - > setEnabled ( true ) ;
disconnect ( menu - > searchLine , SIGNAL ( textChanged ( const QString & ) ) ,
this , SLOT ( initializeSearch ( const QString & ) ) ) ;
disconnect ( menu - > searchLine , SIGNAL ( returnPressed ( const QString & ) ) ,
this , SLOT ( kerrySearch ( const QString & ) ) ) ;
connect ( menu - > searchLine , SIGNAL ( returnPressed ( const QString & ) ) ,
this , SLOT ( strigiSearch ( const QString & ) ) ) ;
disconnect ( menu - > searchLine , SIGNAL ( textChanged ( const T QString & ) ) ,
this , SLOT ( initializeSearch ( const T QString & ) ) ) ;
disconnect ( menu - > searchLine , SIGNAL ( returnPressed ( const T QString & ) ) ,
this , SLOT ( kerrySearch ( const T QString & ) ) ) ;
connect ( menu - > searchLine , SIGNAL ( returnPressed ( const T QString & ) ) ,
this , SLOT ( strigiSearch ( const T QString & ) ) ) ;
menu - > searchLine - > setContextMenuEnabled ( false ) ;
}
}
@ -518,20 +518,20 @@ void MenuHandler::updateConfig()
}
void MenuHandler : : mousePressEvent ( QMouseEvent * e )
void MenuHandler : : mousePressEvent ( T QMouseEvent * e )
{
if ( static_cast < QWidget * > ( parent ( ) ) - > hasMouse ( ) )
if ( static_cast < T QWidget * > ( parent ( ) ) - > hasMouse ( ) )
{
close ( ) ;
}
else if ( ! _isNormalWindow & & ! ( rect ( ) . contains ( e - > pos ( ) ) ) )
{
hide ( ) ;
QTimer: : singleShot ( 200 , this , SLOT ( close ( ) ) ) ;
T QTimer: : singleShot ( 200 , this , SLOT ( close ( ) ) ) ;
}
}
void MenuHandler : : closeEvent ( QCloseEvent * e )
void MenuHandler : : closeEvent ( T QCloseEvent * e )
{
e = e ;
@ -546,11 +546,11 @@ void MenuHandler::closeEvent ( QCloseEvent *e)
//HACK: I wait a little bit to permit closing the menu
// when user clicks on the menu button again
QTimer: : singleShot ( 50 , this , SLOT ( hide ( ) ) ) ;
T QTimer: : singleShot ( 50 , this , SLOT ( hide ( ) ) ) ;
emit ( hidden ( ) ) ;
}
void MenuHandler : : popup ( QPoint pos )
void MenuHandler : : popup ( T QPoint pos )
{
if ( isVisible ( ) )
{
@ -564,7 +564,7 @@ void MenuHandler::popup(QPoint pos)
int h ;
if ( ! _isNormalWindow )
{
QRect r = QDesktopWidget( ) . screenGeometry ( this ) ;
T QRect r = T QDesktopWidget( ) . screenGeometry ( this ) ;
w = ( int ) ( r . width ( ) / _menuWidth ) ;
h = ( int ) ( r . height ( ) / _menuHeight ) ;
}
@ -642,7 +642,7 @@ void MenuHandler::initNewInstalledApps(KServiceGroup::Ptr group)
KService * s = static_cast < KService * > ( p ) ;
QString path ( s - > desktopEntryPath ( ) ) ;
T QString path ( s - > desktopEntryPath ( ) ) ;
if ( oldInstalledList . findIndex ( path ) = = - 1 & &
newInstalledList . findIndex ( path ) = = - 1 )
{
@ -695,7 +695,7 @@ bool MenuHandler::searchNewItems(KServiceGroup::Ptr group)
/*KServiceGroup::List MenuHandler::getServiceGroupList( KServiceGroup *serviceGroup )
{
QString key ( serviceGroup - > directoryEntryPath ( ) ) ;
T QString key ( serviceGroup - > directoryEntryPath ( ) ) ;
if ( sListMap . contains ( key ) )
return sListMap [ key ] ;
@ -709,7 +709,7 @@ bool MenuHandler::searchNewItems(KServiceGroup::Ptr group)
void MenuHandler : : populateList ( KServiceGroup * serviceGroup , TastyListView * listView ,
TastyListViewItem * listItemFather ,
bool recursive , const QString & query )
bool recursive , const T QString & query )
{
if ( ! serviceGroup | | ! serviceGroup - > isValid ( ) )
return ;
@ -749,15 +749,15 @@ void MenuHandler::populateList( KServiceGroup *serviceGroup, TastyListView *list
if ( numChilds = = 0 )
continue ;
QPixmap iconPix = iconLoader - > loadIcon ( g - > icon ( ) , KIcon : : Toolbar , iconSize ) ;
T QPixmap iconPix = iconLoader - > loadIcon ( g - > icon ( ) , KIcon : : Toolbar , iconSize ) ;
if ( iconPix . height ( ) ! = iconSize )
{
QImage img = iconPix . convertToImage ( ) ;
T QImage img = iconPix . convertToImage ( ) ;
if ( ! img . isNull ( ) )
{
img = img . smoothScale ( iconSize , iconSize ) ;
iconPix = QPixmap ( img ) ;
iconPix = T QPixmap ( img ) ;
}
}
@ -792,8 +792,8 @@ void MenuHandler::populateList( KServiceGroup *serviceGroup, TastyListView *list
if ( _currentCategory = = listItem - > text ( 0 ) & & listView = = menu - > rootList )
{
listView - > setCurrentItem ( listItem ) ;
listView - > setOpenItem ( static_cast < QListViewItem * > ( listItem ) ) ;
rootListClicked ( listItem , QPoint( 0 , 0 ) , 0 ) ;
listView - > setOpenItem ( static_cast < T QListViewItem * > ( listItem ) ) ;
rootListClicked ( listItem , T QPoint( 0 , 0 ) , 0 ) ;
}
if ( searchNewItems ( g ) )
listItem - > setHighLight ( true ) ;
@ -841,8 +841,8 @@ void MenuHandler::populateList( KServiceGroup *serviceGroup, TastyListView *list
//Name and comment
QString itemName = s - > name ( ) ;
QString subText = QString( ) ;
T QString itemName = s - > name ( ) ;
T QString subText = T QString( ) ;
if ( ! isSeparator )
{
if ( s - > comment ( ) ! = NULL & & ! s - > comment ( ) . isEmpty ( ) )
@ -899,14 +899,14 @@ void MenuHandler::populateList( KServiceGroup *serviceGroup, TastyListView *list
prevListItem = listItem ;
QPixmap iconPix = s - > pixmap ( KIcon : : Toolbar , iconSize ) ;
T QPixmap iconPix = s - > pixmap ( KIcon : : Toolbar , iconSize ) ;
if ( iconPix . height ( ) ! = iconSize )
{
QImage img = iconPix . convertToImage ( ) ;
T QImage img = iconPix . convertToImage ( ) ;
if ( ! img . isNull ( ) )
{
img = img . smoothScale ( iconSize , iconSize ) ;
iconPix = QPixmap ( img ) ;
iconPix = T QPixmap ( img ) ;
}
}
listItem - > setPixmap ( 0 , iconPix ) ;
@ -936,15 +936,15 @@ void MenuHandler::initializeRecentlyUsed( )
kickerConf - > reparseConfiguration ( ) ;
kickerConf - > setGroup ( " menus " ) ;
QStringList recentUsedList = QStringList: : split ( ' , ' , kickerConf - > readEntry ( " RecentAppsStat " ) ) ;
T QStringList recentUsedList = T QStringList: : split ( ' , ' , kickerConf - > readEntry ( " RecentAppsStat " ) ) ;
for ( QStringList: : ConstIterator it = recentUsedList . begin ( ) ;
for ( T QStringList: : ConstIterator it = recentUsedList . begin ( ) ;
it ! = recentUsedList . end ( ) ; + + it )
{
QString item = ( * it ) ;
T QString item = ( * it ) ;
QString desktopPath = item . section ( ' ' , 2 , 2 ) ;
if ( desktopPath . isEmpty ( ) | | ! QFile: : exists ( desktopPath ) )
T QString desktopPath = item . section ( ' ' , 2 , 2 ) ;
if ( desktopPath . isEmpty ( ) | | ! T QFile: : exists ( desktopPath ) )
continue ;
recentlyUsedMap [ - item . section ( ' ' , 1 , 1 ) . toULong ( ) ] = desktopPath ;
@ -973,14 +973,14 @@ void MenuHandler::fillRecentDocuments( )
menu - > dynamicList - > clear ( ) ;
setupDynList ( RecentDocuments ) ;
QStringList recentDocsList = KRecentDocument : : recentDocuments ( ) ;
T QStringList recentDocsList = KRecentDocument : : recentDocuments ( ) ;
TastyListViewItem * listItem = NULL ;
if ( recentDocsList . isEmpty ( ) )
return ;
for ( QStringList: : Iterator it = recentDocsList . begin ( ) ;
for ( T QStringList: : Iterator it = recentDocsList . begin ( ) ;
it ! = recentDocsList . end ( ) ; + + it )
{
KDesktopFile * f = new KDesktopFile ( * it , true /* read only */ ) ;
@ -994,14 +994,14 @@ void MenuHandler::fillRecentDocuments( )
listItem - > setDeskopEntryPath ( * it ) ;
listItem - > setType ( TastyListViewItem : : DesktopFile ) ;
QPixmap iconPix = iconLoader - > loadIcon ( f - > readIcon ( ) , KIcon : : Panel , _iconSize1 ) ;
T QPixmap iconPix = iconLoader - > loadIcon ( f - > readIcon ( ) , KIcon : : Panel , _iconSize1 ) ;
if ( iconPix . height ( ) > _iconSize1 )
{
QImage img = iconPix . convertToImage ( ) ;
T QImage img = iconPix . convertToImage ( ) ;
if ( ! img . isNull ( ) )
{
img = img . smoothScale ( _iconSize1 , _iconSize1 ) ;
iconPix = QPixmap ( img ) ;
iconPix = T QPixmap ( img ) ;
}
}
listItem - > setPixmap ( 0 , iconPix ) ;
@ -1021,7 +1021,7 @@ void MenuHandler::fillMoreUsed( )
TastyListViewItem * listItem = NULL ;
for ( QStringList: : Iterator it = moreUsedList . begin ( ) ;
for ( T QStringList: : Iterator it = moreUsedList . begin ( ) ;
it ! = moreUsedList . end ( ) ; + + it )
{
//FIXME: yeah, I know, this is U G L Y :-)
@ -1041,16 +1041,16 @@ void MenuHandler::fillMoreUsed( )
listItem - > setDisplaySubText ( _displaySubText ) ;
QPixmap iconPix = s - > pixmap ( KIcon : : Toolbar , _iconSize1 ) ;
T QPixmap iconPix = s - > pixmap ( KIcon : : Toolbar , _iconSize1 ) ;
if ( ! iconPix . isNull ( ) )
{
if ( iconPix . height ( ) ! = _iconSize1 )
{
QImage img = iconPix . convertToImage ( ) ;
T QImage img = iconPix . convertToImage ( ) ;
if ( ! img . isNull ( ) )
{
img = img . smoothScale ( _iconSize1 , _iconSize1 ) ;
iconPix = QPixmap ( img ) ;
iconPix = T QPixmap ( img ) ;
}
}
listItem - > setPixmap ( 0 , iconPix ) ;
@ -1090,16 +1090,16 @@ void MenuHandler::fillRecentlyUsed( )
listItem - > setDisplaySubText ( _displaySubText ) ;
QPixmap iconPix = s - > pixmap ( KIcon : : Toolbar , _iconSize1 ) ;
T QPixmap iconPix = s - > pixmap ( KIcon : : Toolbar , _iconSize1 ) ;
if ( ! iconPix . isNull ( ) )
{
if ( iconPix . height ( ) ! = _iconSize1 )
{
QImage img = iconPix . convertToImage ( ) ;
T QImage img = iconPix . convertToImage ( ) ;
if ( ! img . isNull ( ) )
{
img = img . smoothScale ( _iconSize1 , _iconSize1 ) ;
iconPix = QPixmap ( img ) ;
iconPix = T QPixmap ( img ) ;
}
}
listItem - > setPixmap ( 0 , iconPix ) ;
@ -1119,7 +1119,7 @@ void MenuHandler::fillFavourites( )
TastyListViewItem * listItem = NULL ;
for ( QStringList: : Iterator it = favouriteList . begin ( ) ;
for ( T QStringList: : Iterator it = favouriteList . begin ( ) ;
it ! = favouriteList . end ( ) ; + + it )
{
@ -1135,14 +1135,14 @@ void MenuHandler::fillFavourites( )
listItem - > setDisplaySubText ( _displaySubText ) ;
QPixmap iconPix = s - > pixmap ( KIcon : : Toolbar , _iconSize1 ) ;
T QPixmap iconPix = s - > pixmap ( KIcon : : Toolbar , _iconSize1 ) ;
if ( iconPix . height ( ) > _iconSize1 )
{
QImage img = iconPix . convertToImage ( ) ;
T QImage img = iconPix . convertToImage ( ) ;
if ( ! img . isNull ( ) )
{
img = img . smoothScale ( _iconSize1 , _iconSize1 ) ;
iconPix = QPixmap ( img ) ;
iconPix = T QPixmap ( img ) ;
}
}
listItem - > setPixmap ( 0 , iconPix ) ;
@ -1181,7 +1181,7 @@ void MenuHandler::slotApplicationsAdded(const KFileItemList & newItems)
for ( KFileItemListIterator it ( newItems ) ; it . current ( ) ; + + it )
{
KFileItem * item = ( * it ) ;
QString path ( item - > url ( ) . path ( ) ) ;
T QString path ( item - > url ( ) . path ( ) ) ;
kdDebug ( ) < < " new item: " < < item - > name ( ) < < endl ;
//ignore items already here
@ -1202,13 +1202,13 @@ void MenuHandler::slotApplicationsAdded(const KFileItemList & newItems)
//It's necessary to wait some seconds, otherwise apps won't be listed
//I do it two times for being sure, because I still haven't the clear idea
//where the right files to watch are...
QTimer: : singleShot ( 15000 , this , SLOT ( slotUpdateApplications ( ) ) ) ;
T QTimer: : singleShot ( 15000 , this , SLOT ( slotUpdateApplications ( ) ) ) ;
}
void MenuHandler : : slotApplicationRemoved ( )
{
QTimer: : singleShot ( 15000 , this , SLOT ( slotUpdateApplications ( ) ) ) ;
T QTimer: : singleShot ( 15000 , this , SLOT ( slotUpdateApplications ( ) ) ) ;
slotUpdateApplications ( ) ;
}
@ -1222,7 +1222,7 @@ void MenuHandler::slotUpdateApplications()
populateList ( service , menu - > rootList , NULL , false ) ;
}
void MenuHandler : : listClicked ( TastyListViewItem * listItem , const QPoint & coord )
void MenuHandler : : listClicked ( TastyListViewItem * listItem , const T QPoint & coord )
{
if ( ! listItem )
return ;
@ -1234,7 +1234,7 @@ void MenuHandler::listClicked( TastyListViewItem * listItem, const QPoint & coor
int x = coord . x ( ) ;
QString servicePath = listItem - > getDeskopEntryPath ( ) ;
T QString servicePath = listItem - > getDeskopEntryPath ( ) ;
switch ( listItem - > getType ( ) )
{
@ -1291,7 +1291,7 @@ void MenuHandler::listClicked( TastyListViewItem * listItem, const QPoint & coor
{
DCOPRef kickerKMenuIface ( " kicker " , " KMenu " ) ;
kickerKMenuIface . call ( " slotServiceStartedByStorageId( QString,QString)" , " tastymenu " , servicePath ) ;
kickerKMenuIface . call ( " slotServiceStartedByStorageId( T QString,T QString)" , " tastymenu " , servicePath ) ;
if ( ( currentMenuMode = = MoreUsed
| | currentMenuMode = = RecentlyUsed )
& & ! searchMode )
@ -1349,7 +1349,7 @@ void MenuHandler::listClicked( TastyListViewItem * listItem, const QPoint & coor
}
void MenuHandler : : dynListClicked ( QListViewItem * listItem , const QPoint & coord , int c )
void MenuHandler : : dynListClicked ( T QListViewItem * listItem , const T QPoint & coord , int c )
{
c = c ;
if ( ! listItem )
@ -1362,7 +1362,7 @@ void MenuHandler::dynListClicked( QListViewItem * listItem, const QPoint & coord
listClicked ( static_cast < TastyListViewItem * > ( listItem ) , coord ) ;
}
void MenuHandler : : childListClicked ( QListViewItem * listItem , const QPoint & coord , int c )
void MenuHandler : : childListClicked ( T QListViewItem * listItem , const T QPoint & coord , int c )
{
c = c ;
if ( ! listItem )
@ -1382,7 +1382,7 @@ void MenuHandler::childListClicked( QListViewItem * listItem, const QPoint & coo
listClicked ( static_cast < TastyListViewItem * > ( listItem ) , coord ) ;
}
void MenuHandler : : rootListClicked ( QListViewItem * listItem , const QPoint & coord , int c )
void MenuHandler : : rootListClicked ( T QListViewItem * listItem , const T QPoint & coord , int c )
{
c = c ;
if ( ! listItem )
@ -1408,7 +1408,7 @@ void MenuHandler::rootListClicked( QListViewItem * listItem, const QPoint & coor
menu - > childList - > setSorting ( 0 ) ;
}
void MenuHandler : : slotContextMenu ( QListViewItem * listItem , const QPoint & coord , int c )
void MenuHandler : : slotContextMenu ( T QListViewItem * listItem , const T QPoint & coord , int c )
{
if ( ! listItem )
@ -1454,7 +1454,7 @@ void MenuHandler::slotContextMenu(QListViewItem *listItem, const QPoint &coord,
break ;
case 2 :
listClicked ( tastyListItem , QPoint( tastyListItem - > listView ( ) - > width ( ) , 0 ) ) ;
listClicked ( tastyListItem , T QPoint( tastyListItem - > listView ( ) - > width ( ) , 0 ) ) ;
break ;
case 3 :
@ -1590,7 +1590,7 @@ void MenuHandler::doNewSession( bool lock )
}
void MenuHandler : : initializeSearch ( const QString & query )
void MenuHandler : : initializeSearch ( const T QString & query )
{
if ( ! searchMode & & query . length ( ) > 2 )
{
@ -1600,9 +1600,9 @@ void MenuHandler::initializeSearch( const QString & query )
menu - > menuModes - > setEnabled ( false ) ;
KServiceGroup : : Ptr service = KServiceGroup : : root ( ) ;
menu - > dynamicList - > clear ( ) ;
setCursor ( QCursor( Qt: : BusyCursor ) ) ;
setCursor ( T QCursor( T Qt: : BusyCursor ) ) ;
populateList ( service , menu - > dynamicList , NULL , true , query ) ;
setCursor ( QCursor( Qt: : ArrowCursor ) ) ;
setCursor ( T QCursor( T Qt: : ArrowCursor ) ) ;
}
else if ( query . length ( ) < 3 )
{
@ -1620,14 +1620,14 @@ void MenuHandler::initializeSearch( const QString & query )
}
}
void MenuHandler : : kerrySearch ( const QString & query )
void MenuHandler : : kerrySearch ( const T QString & query )
{
close ( ) ;
DCOPRef kdesktopKScreensaverIface ( " kerry " , " search " ) ;
kdesktopKScreensaverIface . call ( " search( QString)" , query ) ;
kdesktopKScreensaverIface . call ( " search( T QString)" , query ) ;
}
void MenuHandler : : strigiSearch ( const QString & query )
void MenuHandler : : strigiSearch ( const T QString & query )
{
close ( ) ;
KRun : : runCommand ( " konqueror strigi:/?q= " + query ) ;
@ -1685,23 +1685,23 @@ void MenuHandler::menuModeChanged( int index )
void MenuHandler : : switchWindowMode ( )
{
if ( ! _isNormalWindow /*testWFlags( Qt::WType_Popup)*/ )
if ( ! _isNormalWindow /*testWFlags( T Qt::WType_Popup)*/ )
{
_isNormalWindow = true ;
hide ( ) ;
reparent ( static_cast < QWidget * > ( parent ( ) ) , Qt: : WType_Dialog , pos ( ) , true ) ;
reparent ( static_cast < T QWidget * > ( parent ( ) ) , T Qt: : WType_Dialog , pos ( ) , true ) ;
menu - > detachButton - > setIconSet ( QPixmap( uic_findImage ( " attach.png " ) ) ) ;
menu - > detachButton - > setIconSet ( T QPixmap( uic_findImage ( " attach.png " ) ) ) ;
prefSkel - > setIsNormalWindow ( true ) ;
}
else
{
hide ( ) ;
reparent ( static_cast < QWidget * > ( parent ( ) ) ,
Qt: : WType_Popup | Qt: : WNoAutoErase ,
reparent ( static_cast < T QWidget * > ( parent ( ) ) ,
T Qt: : WType_Popup | T Qt: : WNoAutoErase ,
pos ( ) , true ) ;
menu - > detachButton - > setIconSet ( QPixmap( uic_findImage ( " detach.png " ) ) ) ;
menu - > detachButton - > setIconSet ( T QPixmap( uic_findImage ( " detach.png " ) ) ) ;
prefSkel - > setIsNormalWindow ( false ) ;
_isNormalWindow = false ;
}