Ticket #44944: streamline-systray-menu.patch
File streamline-systray-menu.patch, 3.5 KB (added by RJVB (René Bertin), 10 years ago) |
---|
-
kdelibs-4.12.5/kdeui/notifications/kstatusnotifieritem.cpp
diff --git kdeui/notifications/kstatusnotifieritem.cpp kdeui/notifications/kstatusnotifieritem.cpp index 1b15d40..9cb8405 100644
KStatusNotifierItemPrivate::KStatusNotifierItemPrivate(KStatusNotifierItem *item 722 722 { 723 723 } 724 724 725 #ifdef Q_OS_MAC 726 # include <kconfiggroup.h> 727 #endif 728 725 729 void KStatusNotifierItemPrivate::init(const QString &extraId) 726 730 { 727 731 // Ensure that closing the last KMainWindow doesn't exit the application … … void KStatusNotifierItemPrivate::init(const QString &extraId) 745 749 746 750 //create a default menu, just like in KSystemtrayIcon 747 751 KMenu *m = new KMenu(associatedWidget); 752 #ifdef Q_OS_MAC 753 // emulate addTitle/setTitle by adding an inactive menu item. 754 titleAction = new QAction( KGlobal::mainComponent().aboutData()->programName(), NULL ); 755 titleAction->setEnabled(false); 756 m->addAction( titleAction ); 757 m->addSeparator(); 758 #else 748 759 titleAction = m->addTitle(qApp->windowIcon(), KGlobal::caption()); 749 760 m->setTitle(KGlobal::mainComponent().aboutData()->programName()); 761 #endif 750 762 q->setContextMenu(m); 751 763 752 764 KStandardAction::quit(q, SLOT(maybeQuit()), actionCollection); -
kdelibs-4.12.5/kdeui/widgets/kmenu.cpp
diff --git kdeui/widgets/kmenu.cpp kdeui/widgets/kmenu.cpp index 7dab149..94a7751 100644
KMenu::~KMenu() 167 167 delete d; 168 168 } 169 169 170 #ifdef Q_OS_MAC 171 void KMenu::addAction(QAction *action) 172 { 173 if( action ){ 174 if( !action->isIconVisibleInMenu() ){ 175 action->setIcon(QIcon()); 176 } 177 QMenu::addAction(action); 178 } 179 } 180 181 # ifdef Q_NO_USING_KEYWORD 182 QAction *KMenu::addAction(const QString &text) 183 { 184 return QMenu::addAction(text); 185 } 186 187 QAction *KMenu::addAction(const QIcon &icon, const QString &text) 188 { 189 return QMenu::addAction(icon,text); 190 } 191 192 QAction *KMenu::addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut) 193 { 194 return QMenu::addAction(text, receiver, member, shortcut); 195 } 196 197 QAction *KMenu::addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut) 198 { 199 return QMenu::addAction(icon, text, receiver, member, shortcut); 200 } 201 # endif // Q_NO_USING_KEYWORD 202 #endif // Q_OS_MAC 203 170 204 QAction* KMenu::addTitle(const QString &text, QAction* before) 171 205 { 172 206 return addTitle(QIcon(), text, before); -
kdelibs-4.12.5/kdeui/widgets/kmenu.h
diff --git kdeui/widgets/kmenu.h kdeui/widgets/kmenu.h index f96e263..79be594 100644
public: 60 60 */ 61 61 ~KMenu(); 62 62 63 #ifdef Q_OS_MAC 64 # ifndef Q_NO_USING_KEYWORD 65 using QMenu::addAction; 66 # endif 67 /** 68 * Appends the action action to the menu's list of actions. 69 * Overloaded from QMenu to force Qt to honour action->isIconVisibleInMenu(). 70 */ 71 void addAction(QAction *action); 72 # ifdef Q_NO_USING_KEYWORD 73 QAction *addAction(const QString &text); 74 QAction *addAction(const QIcon &icon, const QString &text); 75 QAction *addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); 76 QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0); 77 # endif //Q_NO_USING_KEYWORD 78 #endif //Q_OS_MAC 63 79 /** 64 80 * Inserts a title item with no icon. 65 81 */