diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-03 09:14:57 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-09-03 09:14:57 +0000 |
commit | 27856879bf962f178d88e79144e37a47e731b122 (patch) | |
tree | a3bd3f489b755cd2941e7c53b90d12d6bfd4fbe3 /kicker | |
parent | c5228d52f504d6d2c0fefdd625ec08ebb8e91f85 (diff) | |
download | tdebase-27856879bf962f178d88e79144e37a47e731b122.tar.gz tdebase-27856879bf962f178d88e79144e37a47e731b122.zip |
* Massive import of OpenSUSE patches, primarily for bugfixes
* Added some infrastructure created by OpenSUSE to allow for future addition of the Kickoff menu as an option
* Minor Slackware compilation fixes
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1171255 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kicker')
65 files changed, 205 insertions, 34 deletions
diff --git a/kicker/applets/systemtray/systemtrayapplet.cpp b/kicker/applets/systemtray/systemtrayapplet.cpp index 933855f74..51bf2b9d8 100644 --- a/kicker/applets/systemtray/systemtrayapplet.cpp +++ b/kicker/applets/systemtray/systemtrayapplet.cpp @@ -189,6 +189,7 @@ bool SystemTrayApplet::x11Event( XEvent *e ) if( isWinManaged( (WId)e->xclient.data.l[2] ) ) // we already manage it return true; embedWindow( e->xclient.data.l[2], false ); + updateVisibleWins(); layoutTray(); return true; } @@ -215,13 +216,12 @@ void SystemTrayApplet::preferences() connect(m_settingsDialog, TQT_SIGNAL(finished()), this, TQT_SLOT(settingsDialogFinished())); m_iconSelector = new KActionSelector(m_settingsDialog); - m_iconSelector->setAvailableLabel(i18n("Visible icons:")); - m_iconSelector->setSelectedLabel(i18n("Hidden icons:")); - m_iconSelector->setShowUpDownButtons(false); + m_iconSelector->setAvailableLabel(i18n("Hidden icons:")); + m_iconSelector->setSelectedLabel(i18n("Visible icons:")); m_settingsDialog->setMainWidget(m_iconSelector); - TQListBox *shownListBox = m_iconSelector->availableListBox(); - TQListBox *hiddenListBox = m_iconSelector->selectedListBox(); + TQListBox *hiddenListBox = m_iconSelector->availableListBox(); + TQListBox *shownListBox = m_iconSelector->selectedListBox(); TrayEmbedList::const_iterator it = m_shownWins.begin(); TrayEmbedList::const_iterator itEnd = m_shownWins.end(); @@ -263,26 +263,48 @@ void SystemTrayApplet::applySettings() } KConfig *conf = config(); - conf->setGroup("HiddenTrayIcons"); - TQString name; - - // use the following snippet of code someday to implement ordering - // of icons - /* - m_visibleIconList.clear(); - TQListBoxItem* item = m_iconSelector->availableListBox()->firstItem(); - for (; item; item = item->next()) + + // Save the sort order and hidden status using the window class (WM_CLASS) rather + // than window name (caption) - window name is i18n-ed, so it's for example + // not possible to create default settings. + // For backwards compatibility, name is kept as it is, class is preceded by '!'. + TQMap< TQString, TQString > windowNameToClass; + for( TrayEmbedList::ConstIterator it = m_shownWins.begin(); + it != m_shownWins.end(); + ++it ) { + KWin::WindowInfo info = KWin::windowInfo( (*it)->embeddedWinId(), NET::WMName, NET::WM2WindowClass); + windowNameToClass[ info.name() ] = '!' + info.windowClassClass(); + } + for( TrayEmbedList::ConstIterator it = m_hiddenWins.begin(); + it != m_hiddenWins.end(); + ++it ) { + KWin::WindowInfo info = KWin::windowInfo( (*it)->embeddedWinId(), NET::WMName, NET::WM2WindowClass); + windowNameToClass[ info.name() ] = '!' + info.windowClassClass(); + } + + conf->setGroup("SortedTrayIcons"); + m_sortOrderIconList.clear(); + for(TQListBoxItem* item = m_iconSelector->selectedListBox()->firstItem(); + item; + item = item->next()) { - m_visibleIconList.append(item->text()); + if( windowNameToClass.contains(item->text())) + m_sortOrderIconList.append(windowNameToClass[item->text()]); + else + m_sortOrderIconList.append(item->text()); } - conf->writeEntry("Visible", m_visibleIconList); - selection.clear();*/ + conf->writeEntry("SortOrder", m_sortOrderIconList); + conf->setGroup("HiddenTrayIcons"); m_hiddenIconList.clear(); - TQListBoxItem* item = m_iconSelector->selectedListBox()->firstItem(); - for (; item; item = item->next()) + for(TQListBoxItem* item = m_iconSelector->availableListBox()->firstItem(); + item; + item = item->next()) { - m_hiddenIconList.append(item->text()); + if( windowNameToClass.contains(item->text())) + m_hiddenIconList.append(windowNameToClass[item->text()]); + else + m_hiddenIconList.append(item->text()); } conf->writeEntry("Hidden", m_hiddenIconList); conf->sync(); @@ -437,6 +459,9 @@ void SystemTrayApplet::loadSettings() conf->setGroup("HiddenTrayIcons"); m_hiddenIconList = conf->readListEntry("Hidden"); + conf->setGroup("SortedTrayIcons"); + m_sortOrderIconList = conf->readListEntry("SortOrder"); + //Note This setting comes from kdeglobal. conf->setGroup("System Tray"); m_iconSize = conf->readNumEntry("systrayIconWidth", 22); @@ -526,7 +551,9 @@ bool SystemTrayApplet::isWinManaged(WId w) bool SystemTrayApplet::shouldHide(WId w) { - return m_hiddenIconList.find(KWin::windowInfo(w).name()) != m_hiddenIconList.end(); + return m_hiddenIconList.find(KWin::windowInfo(w).name()) != m_hiddenIconList.end() + || m_hiddenIconList.find('!'+KWin::windowInfo(w,0,NET::WM2WindowClass).windowClassClass()) + != m_hiddenIconList.end(); } void SystemTrayApplet::updateVisibleWins() @@ -549,6 +576,35 @@ void SystemTrayApplet::updateVisibleWins() (*emb)->hide(); } } + + TQMap< QXEmbed*, TQString > names; // cache window names and classes + TQMap< QXEmbed*, TQString > classes; + for( TrayEmbedList::const_iterator it = m_shownWins.begin(); + it != m_shownWins.end(); + ++it ) { + KWin::WindowInfo info = KWin::windowInfo((*it)->embeddedWinId(),NET::WMName,NET::WM2WindowClass); + names[ *it ] = info.name(); + classes[ *it ] = '!'+info.windowClassClass(); + } + TrayEmbedList newList; + for( TQStringList::const_iterator it1 = m_sortOrderIconList.begin(); + it1 != m_sortOrderIconList.end(); + ++it1 ) { + for( TrayEmbedList::iterator it2 = m_shownWins.begin(); + it2 != m_shownWins.end(); + ) { + if( (*it1).startsWith("!") ? classes[ *it2 ] == *it1 : names[ *it2 ] == *it1 ) { + newList.append( *it2 ); // don't bail out, there may be multiple ones + it2 = m_shownWins.erase( it2 ); + } else + ++it2; + } + } + for( TrayEmbedList::const_iterator it = m_shownWins.begin(); + it != m_shownWins.end(); + ++it ) + newList.append( *it ); // append unsorted items + m_shownWins = newList; } void SystemTrayApplet::toggleExpanded() diff --git a/kicker/applets/systemtray/systemtrayapplet.h b/kicker/applets/systemtray/systemtrayapplet.h index a92b8f74e..f66e0caa5 100644 --- a/kicker/applets/systemtray/systemtrayapplet.h +++ b/kicker/applets/systemtray/systemtrayapplet.h @@ -98,6 +98,7 @@ private: TrayEmbedList m_shownWins; TrayEmbedList m_hiddenWins; TQStringList m_hiddenIconList; + TQStringList m_sortOrderIconList; KWinModule *kwin_module; Atom net_system_tray_selection; Atom net_system_tray_opcode; diff --git a/kicker/data/kickoff/button-box-gradient-topdown.png b/kicker/data/kickoff/button-box-gradient-topdown.png Binary files differnew file mode 100644 index 000000000..378816342 --- /dev/null +++ b/kicker/data/kickoff/button-box-gradient-topdown.png diff --git a/kicker/data/kickoff/button-box-gradient.png b/kicker/data/kickoff/button-box-gradient.png Binary files differnew file mode 100644 index 000000000..a7c11adba --- /dev/null +++ b/kicker/data/kickoff/button-box-gradient.png diff --git a/kicker/data/kickoff/button-box-left-corner.png b/kicker/data/kickoff/button-box-left-corner.png Binary files differnew file mode 100644 index 000000000..c4080cb00 --- /dev/null +++ b/kicker/data/kickoff/button-box-left-corner.png diff --git a/kicker/data/kickoff/button-box-left.png b/kicker/data/kickoff/button-box-left.png Binary files differnew file mode 100644 index 000000000..3b532f8bd --- /dev/null +++ b/kicker/data/kickoff/button-box-left.png diff --git a/kicker/data/kickoff/button-box-right-corner.png b/kicker/data/kickoff/button-box-right-corner.png Binary files differnew file mode 100644 index 000000000..ef44b1fab --- /dev/null +++ b/kicker/data/kickoff/button-box-right-corner.png diff --git a/kicker/data/kickoff/button-box-top.png b/kicker/data/kickoff/button-box-top.png Binary files differnew file mode 100644 index 000000000..1cac298be --- /dev/null +++ b/kicker/data/kickoff/button-box-top.png diff --git a/kicker/data/kickoff/cr128-action-suspend2disk.png b/kicker/data/kickoff/cr128-action-suspend2disk.png Binary files differnew file mode 100644 index 000000000..b3ac2fe05 --- /dev/null +++ b/kicker/data/kickoff/cr128-action-suspend2disk.png diff --git a/kicker/data/kickoff/cr128-action-suspend2ram.png b/kicker/data/kickoff/cr128-action-suspend2ram.png Binary files differnew file mode 100644 index 000000000..9e641bd47 --- /dev/null +++ b/kicker/data/kickoff/cr128-action-suspend2ram.png diff --git a/kicker/data/kickoff/cr16-action-suspend2disk.png b/kicker/data/kickoff/cr16-action-suspend2disk.png Binary files differnew file mode 100644 index 000000000..a28ab8ad9 --- /dev/null +++ b/kicker/data/kickoff/cr16-action-suspend2disk.png diff --git a/kicker/data/kickoff/cr16-action-suspend2ram.png b/kicker/data/kickoff/cr16-action-suspend2ram.png Binary files differnew file mode 100644 index 000000000..45738ccc5 --- /dev/null +++ b/kicker/data/kickoff/cr16-action-suspend2ram.png diff --git a/kicker/data/kickoff/cr32-action-leave.png b/kicker/data/kickoff/cr32-action-leave.png Binary files differnew file mode 100644 index 000000000..89dc15953 --- /dev/null +++ b/kicker/data/kickoff/cr32-action-leave.png diff --git a/kicker/data/kickoff/cr32-action-suspend2disk.png b/kicker/data/kickoff/cr32-action-suspend2disk.png Binary files differnew file mode 100644 index 000000000..7bcb027b1 --- /dev/null +++ b/kicker/data/kickoff/cr32-action-suspend2disk.png diff --git a/kicker/data/kickoff/cr32-action-suspend2ram.png b/kicker/data/kickoff/cr32-action-suspend2ram.png Binary files differnew file mode 100644 index 000000000..7a96cd24f --- /dev/null +++ b/kicker/data/kickoff/cr32-action-suspend2ram.png diff --git a/kicker/data/kickoff/cr48-action-leave.png b/kicker/data/kickoff/cr48-action-leave.png Binary files differnew file mode 100644 index 000000000..7c01634b9 --- /dev/null +++ b/kicker/data/kickoff/cr48-action-leave.png diff --git a/kicker/data/kickoff/cr48-action-suspend2disk.png b/kicker/data/kickoff/cr48-action-suspend2disk.png Binary files differnew file mode 100644 index 000000000..9ff2148b8 --- /dev/null +++ b/kicker/data/kickoff/cr48-action-suspend2disk.png diff --git a/kicker/data/kickoff/cr48-action-suspend2ram.png b/kicker/data/kickoff/cr48-action-suspend2ram.png Binary files differnew file mode 100644 index 000000000..2aefa6ce4 --- /dev/null +++ b/kicker/data/kickoff/cr48-action-suspend2ram.png diff --git a/kicker/data/kickoff/cr48-app-recently_used.png b/kicker/data/kickoff/cr48-app-recently_used.png Binary files differnew file mode 100644 index 000000000..b97479759 --- /dev/null +++ b/kicker/data/kickoff/cr48-app-recently_used.png diff --git a/kicker/data/kickoff/cr64-action-suspend2disk.png b/kicker/data/kickoff/cr64-action-suspend2disk.png Binary files differnew file mode 100644 index 000000000..f6e57d786 --- /dev/null +++ b/kicker/data/kickoff/cr64-action-suspend2disk.png diff --git a/kicker/data/kickoff/cr64-action-suspend2ram.png b/kicker/data/kickoff/cr64-action-suspend2ram.png Binary files differnew file mode 100644 index 000000000..cdb47d04f --- /dev/null +++ b/kicker/data/kickoff/cr64-action-suspend2ram.png diff --git a/kicker/data/kickoff/crsc-action-leave.svgz b/kicker/data/kickoff/crsc-action-leave.svgz Binary files differnew file mode 100644 index 000000000..b6a93b05c --- /dev/null +++ b/kicker/data/kickoff/crsc-action-leave.svgz diff --git a/kicker/data/kickoff/crsc-action-suspend2disk.svgz b/kicker/data/kickoff/crsc-action-suspend2disk.svgz Binary files differnew file mode 100644 index 000000000..d73b491d9 --- /dev/null +++ b/kicker/data/kickoff/crsc-action-suspend2disk.svgz diff --git a/kicker/data/kickoff/crsc-action-suspend2ram.svgz b/kicker/data/kickoff/crsc-action-suspend2ram.svgz Binary files differnew file mode 100644 index 000000000..c38d2ed33 --- /dev/null +++ b/kicker/data/kickoff/crsc-action-suspend2ram.svgz diff --git a/kicker/data/kickoff/kmenu_active.png b/kicker/data/kickoff/kmenu_active.png Binary files differnew file mode 100644 index 000000000..fa5ae4de1 --- /dev/null +++ b/kicker/data/kickoff/kmenu_active.png diff --git a/kicker/data/kickoff/kmenu_basic.mng b/kicker/data/kickoff/kmenu_basic.mng Binary files differnew file mode 100644 index 000000000..4cea61fff --- /dev/null +++ b/kicker/data/kickoff/kmenu_basic.mng diff --git a/kicker/data/kickoff/kmenu_flipped.mng b/kicker/data/kickoff/kmenu_flipped.mng Binary files differnew file mode 100644 index 000000000..2b78b4007 --- /dev/null +++ b/kicker/data/kickoff/kmenu_flipped.mng diff --git a/kicker/data/kickoff/kmenu_vertical.mng b/kicker/data/kickoff/kmenu_vertical.mng Binary files differnew file mode 100644 index 000000000..9cd3aac2b --- /dev/null +++ b/kicker/data/kickoff/kmenu_vertical.mng diff --git a/kicker/data/kickoff/left_triangle.png b/kicker/data/kickoff/left_triangle.png Binary files differnew file mode 100644 index 000000000..b8ac404fd --- /dev/null +++ b/kicker/data/kickoff/left_triangle.png diff --git a/kicker/data/kickoff/main_border_bc.png b/kicker/data/kickoff/main_border_bc.png Binary files differnew file mode 100644 index 000000000..05e497763 --- /dev/null +++ b/kicker/data/kickoff/main_border_bc.png diff --git a/kicker/data/kickoff/main_border_lc.png b/kicker/data/kickoff/main_border_lc.png Binary files differnew file mode 100644 index 000000000..c440e859e --- /dev/null +++ b/kicker/data/kickoff/main_border_lc.png diff --git a/kicker/data/kickoff/main_border_rc.png b/kicker/data/kickoff/main_border_rc.png Binary files differnew file mode 100644 index 000000000..6cef8af01 --- /dev/null +++ b/kicker/data/kickoff/main_border_rc.png diff --git a/kicker/data/kickoff/main_border_tc.png b/kicker/data/kickoff/main_border_tc.png Binary files differnew file mode 100644 index 000000000..bc03e85dd --- /dev/null +++ b/kicker/data/kickoff/main_border_tc.png diff --git a/kicker/data/kickoff/main_corner_bl.png b/kicker/data/kickoff/main_corner_bl.png Binary files differnew file mode 100644 index 000000000..32ea680f1 --- /dev/null +++ b/kicker/data/kickoff/main_corner_bl.png diff --git a/kicker/data/kickoff/main_corner_br.png b/kicker/data/kickoff/main_corner_br.png Binary files differnew file mode 100644 index 000000000..b2d898ab6 --- /dev/null +++ b/kicker/data/kickoff/main_corner_br.png diff --git a/kicker/data/kickoff/main_corner_tl.png b/kicker/data/kickoff/main_corner_tl.png Binary files differnew file mode 100644 index 000000000..11fe645ce --- /dev/null +++ b/kicker/data/kickoff/main_corner_tl.png diff --git a/kicker/data/kickoff/main_corner_tr.png b/kicker/data/kickoff/main_corner_tr.png Binary files differnew file mode 100644 index 000000000..a439d9763 --- /dev/null +++ b/kicker/data/kickoff/main_corner_tr.png diff --git a/kicker/data/kickoff/menu_separator.png b/kicker/data/kickoff/menu_separator.png Binary files differnew file mode 100644 index 000000000..2ba13727d --- /dev/null +++ b/kicker/data/kickoff/menu_separator.png diff --git a/kicker/data/kickoff/resize_handle.png b/kicker/data/kickoff/resize_handle.png Binary files differnew file mode 100644 index 000000000..c0811dc50 --- /dev/null +++ b/kicker/data/kickoff/resize_handle.png diff --git a/kicker/data/kickoff/right_triangle.png b/kicker/data/kickoff/right_triangle.png Binary files differnew file mode 100644 index 000000000..9766030c0 --- /dev/null +++ b/kicker/data/kickoff/right_triangle.png diff --git a/kicker/data/kickoff/search-gradient-topdown.png b/kicker/data/kickoff/search-gradient-topdown.png Binary files differnew file mode 100644 index 000000000..b13a19290 --- /dev/null +++ b/kicker/data/kickoff/search-gradient-topdown.png diff --git a/kicker/data/kickoff/search-gradient.png b/kicker/data/kickoff/search-gradient.png Binary files differnew file mode 100644 index 000000000..3478ea18b --- /dev/null +++ b/kicker/data/kickoff/search-gradient.png diff --git a/kicker/data/kickoff/search-running.mng b/kicker/data/kickoff/search-running.mng Binary files differnew file mode 100644 index 000000000..9f477c9c3 --- /dev/null +++ b/kicker/data/kickoff/search-running.mng diff --git a/kicker/data/kickoff/search-tab-center.png b/kicker/data/kickoff/search-tab-center.png Binary files differnew file mode 100644 index 000000000..26ec2f2e9 --- /dev/null +++ b/kicker/data/kickoff/search-tab-center.png diff --git a/kicker/data/kickoff/search-tab-left.png b/kicker/data/kickoff/search-tab-left.png Binary files differnew file mode 100644 index 000000000..507b41767 --- /dev/null +++ b/kicker/data/kickoff/search-tab-left.png diff --git a/kicker/data/kickoff/search-tab-right.png b/kicker/data/kickoff/search-tab-right.png Binary files differnew file mode 100644 index 000000000..94a410443 --- /dev/null +++ b/kicker/data/kickoff/search-tab-right.png diff --git a/kicker/data/kickoff/search-tab-top-center.png b/kicker/data/kickoff/search-tab-top-center.png Binary files differnew file mode 100644 index 000000000..51482ad23 --- /dev/null +++ b/kicker/data/kickoff/search-tab-top-center.png diff --git a/kicker/data/kickoff/search-tab-top-left.png b/kicker/data/kickoff/search-tab-top-left.png Binary files differnew file mode 100644 index 000000000..97264782a --- /dev/null +++ b/kicker/data/kickoff/search-tab-top-left.png diff --git a/kicker/data/kickoff/search-tab-top-right.png b/kicker/data/kickoff/search-tab-top-right.png Binary files differnew file mode 100644 index 000000000..fc80f40c2 --- /dev/null +++ b/kicker/data/kickoff/search-tab-top-right.png diff --git a/kicker/data/kickoff/tab-bottom-left-topdown.png b/kicker/data/kickoff/tab-bottom-left-topdown.png Binary files differnew file mode 100644 index 000000000..a96a7bf12 --- /dev/null +++ b/kicker/data/kickoff/tab-bottom-left-topdown.png diff --git a/kicker/data/kickoff/tab-bottom-left.png b/kicker/data/kickoff/tab-bottom-left.png Binary files differnew file mode 100644 index 000000000..fd8a34aca --- /dev/null +++ b/kicker/data/kickoff/tab-bottom-left.png diff --git a/kicker/data/kickoff/tab-bottom-right-topdown.png b/kicker/data/kickoff/tab-bottom-right-topdown.png Binary files differnew file mode 100644 index 000000000..d1d80a6b3 --- /dev/null +++ b/kicker/data/kickoff/tab-bottom-right-topdown.png diff --git a/kicker/data/kickoff/tab-bottom-right.png b/kicker/data/kickoff/tab-bottom-right.png Binary files differnew file mode 100644 index 000000000..86d226b51 --- /dev/null +++ b/kicker/data/kickoff/tab-bottom-right.png diff --git a/kicker/data/kickoff/tab-center-topdown.png b/kicker/data/kickoff/tab-center-topdown.png Binary files differnew file mode 100644 index 000000000..c35438d91 --- /dev/null +++ b/kicker/data/kickoff/tab-center-topdown.png diff --git a/kicker/data/kickoff/tab-center.png b/kicker/data/kickoff/tab-center.png Binary files differnew file mode 100644 index 000000000..0ef1f6d34 --- /dev/null +++ b/kicker/data/kickoff/tab-center.png diff --git a/kicker/data/kickoff/tab-left_center.png b/kicker/data/kickoff/tab-left_center.png Binary files differnew file mode 100644 index 000000000..4c8c39794 --- /dev/null +++ b/kicker/data/kickoff/tab-left_center.png diff --git a/kicker/data/kickoff/tab-right_center.png b/kicker/data/kickoff/tab-right_center.png Binary files differnew file mode 100644 index 000000000..3df6564f4 --- /dev/null +++ b/kicker/data/kickoff/tab-right_center.png diff --git a/kicker/data/kickoff/tab-top-left-topdown.png b/kicker/data/kickoff/tab-top-left-topdown.png Binary files differnew file mode 100644 index 000000000..3df580e1d --- /dev/null +++ b/kicker/data/kickoff/tab-top-left-topdown.png diff --git a/kicker/data/kickoff/tab-top-left.png b/kicker/data/kickoff/tab-top-left.png Binary files differnew file mode 100644 index 000000000..910967a18 --- /dev/null +++ b/kicker/data/kickoff/tab-top-left.png diff --git a/kicker/data/kickoff/tab-top-right-topdown.png b/kicker/data/kickoff/tab-top-right-topdown.png Binary files differnew file mode 100644 index 000000000..dd672cad9 --- /dev/null +++ b/kicker/data/kickoff/tab-top-right-topdown.png diff --git a/kicker/data/kickoff/tab-top-right.png b/kicker/data/kickoff/tab-top-right.png Binary files differnew file mode 100644 index 000000000..e96019d6d --- /dev/null +++ b/kicker/data/kickoff/tab-top-right.png diff --git a/kicker/kicker/ui/browser_mnu.cpp b/kicker/kicker/ui/browser_mnu.cpp index 6802e6388..88ce30713 100644 --- a/kicker/kicker/ui/browser_mnu.cpp +++ b/kicker/kicker/ui/browser_mnu.cpp @@ -31,6 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <kfileitem.h> #include <kglobal.h> #include <kglobalsettings.h> +#include <kconfig.h> #include <kiconloader.h> #include <kio/global.h> #include <klocale.h> @@ -148,12 +149,14 @@ void PanelBrowserMenu::initialize() // only the first part menu got them if(_startid == 0 && !_filesOnly) { insertTitle(path()); + KConfig *c = KGlobal::config(); + c->setGroup("menus"); insertItem(CICON("kfm"), i18n("Open in File Manager"), this, TQT_SLOT(slotOpenFileManager())); - if (kapp->authorize("shell_access")) - insertItem(CICON("terminal"), i18n("Open in Terminal"), this, TQT_SLOT(slotOpenTerminal())); + if (kapp->authorize("shell_access") && c->readBoolEntry("kickerOpenInTerminalIsVisible",false)) + insertItem(CICON("terminal"), i18n("Open in Terminal"), this, TQT_SLOT(slotOpenTerminal())); + insertSeparator(); } - bool first_entry = true; bool dirfile_separator = false; unsigned int item_count = 0; diff --git a/kicker/kicker/ui/service_mnu.cpp b/kicker/kicker/ui/service_mnu.cpp index fa18a7038..3042eddfe 100644 --- a/kicker/kicker/ui/service_mnu.cpp +++ b/kicker/kicker/ui/service_mnu.cpp @@ -114,6 +114,11 @@ void PanelServiceMenu::fillMenu(KServiceGroup::Ptr& _root, TQStringList suppressGenericNames = _root->suppressGenericNames(); KServiceGroup::List::ConstIterator it = _list.begin(); + KSortableValueList<KSharedPtr<KSycocaEntry>,TQCString> slist; + KSortableValueList<KSharedPtr<KSycocaEntry>,TQCString> glist; + TQMap<TQString,TQString> specialTitle; + TQMap<TQString,TQString> categoryIcon; + bool separatorNeeded = false; for (; it != _list.end(); ++it) { @@ -121,19 +126,108 @@ void PanelServiceMenu::fillMenu(KServiceGroup::Ptr& _root, if (e->isType(KST_KServiceGroup)) { + KServiceGroup::Ptr g(static_cast<KServiceGroup *>(e)); + if ( KickerSettings::reduceMenuDepth() && g->SuSEshortMenu() ){ + KServiceGroup::List l = g->entries(true, excludeNoDisplay_ ); + if ( l.count() == 1 ) { + // the special case, we want to short the menu. + // TOFIX? : this works only for one level + KServiceGroup::List::ConstIterator _it=l.begin(); + KSycocaEntry *_e = *_it; + if (_e->isType(KST_KService)) { + KService::Ptr s(static_cast<KService *>(_e)); + TQString key; + if ( g->SuSEgeneralDescription() ) { + // we use the application name + key = s->name(); + if( !s->genericName().isEmpty()) { + if (KickerSettings::menuEntryFormat() == KickerSettings::NameAndDescription) + key = s->name() + " (" + s->genericName() + ")"; + else if (KickerSettings::menuEntryFormat() == KickerSettings::DescriptionAndName) + key = s->genericName() + " (" + s->name() + ")"; + else if (KickerSettings::menuEntryFormat() == KickerSettings::DescriptionOnly) + key = s->genericName(); + } + } + else { + // we use the normal menu description + key = s->name(); + if( !s->genericName().isEmpty()) { + if (KickerSettings::menuEntryFormat() == KickerSettings::NameAndDescription) + key = s->name() + " (" + g->caption() + ")"; + else if (KickerSettings::menuEntryFormat() == KickerSettings::DescriptionAndName) + key = g->caption() + " (" + s->name() + ")"; + else if (KickerSettings::menuEntryFormat() == KickerSettings::DescriptionOnly) + key = g->caption(); + } + } + specialTitle.insert( _e->name(), key ); + categoryIcon.insert( _e->name(), g->icon() ); + slist.insert( key.local8Bit(), _e ); + // and escape from here + continue; + } + } + } + glist.insert( g->caption().local8Bit(), e ); + }else if( e->isType(KST_KService)) { + KService::Ptr s(static_cast<KService *>(e)); + TQString name = s->name(); + if( !s->genericName().isEmpty()) { + if (KickerSettings::menuEntryFormat() == KickerSettings::NameAndDescription) + name = s->name() + " (" + s->genericName() + ")"; + else if (KickerSettings::menuEntryFormat() == KickerSettings::DescriptionAndName) + name = s->genericName() + " (" + s->name() + ")"; + else if (KickerSettings::menuEntryFormat() == KickerSettings::DescriptionOnly) + name = s->genericName(); + } + slist.insert( name.local8Bit(), e ); + } else + slist.insert( e->name().local8Bit(), e ); + } + + _list = _root->SuSEsortEntries( slist, glist, excludeNoDisplay_, true ); + it = _list.begin(); + + for (; it != _list.end(); ++it) { + KSycocaEntry * e = *it; + + if (e->isType(KST_KServiceGroup)) { KServiceGroup::Ptr g(static_cast<KServiceGroup *>(e)); + if ( KickerSettings::reduceMenuDepth() && g->SuSEshortMenu() ){ + KServiceGroup::List l = g->entries(true, excludeNoDisplay_ ); + if ( l.count() == 1 ) { + /* // the special case, we want to short the menu. + // TOFIX? : this works only for one level + KServiceGroup::List::ConstIterator _it=l.begin(); + KSycocaEntry *_e = *_it; + if (_e->isType(KST_KService)) { + KService::Ptr s(static_cast<KService *>(_e)); + if ( g->SuSEgeneralDescription() ) + // we use the application name + insertMenuItem(s, id++, -1, 0, TQString::null, TQString::null, g->icon() ); + else + // we use the normal menu description + insertMenuItem(s, id++, -1, 0, TQString::null, g->caption(), g->icon() ); + // and escape from here */ + continue; + // } + } + } + // standard sub menu + TQString groupCaption = g->caption(); - + // Avoid adding empty groups. KServiceGroup::Ptr subMenuRoot = KServiceGroup::group(g->relPath()); - + int nbChildCount = subMenuRoot->childCount(); if (nbChildCount == 0 && !g->showEmptyMenu()) - { + { continue; - } - + } + TQString inlineHeaderName = g->showInlineHeader() ? groupCaption : ""; // Item names may contain ampersands. To avoid them being converted // to accelerators, replace them with two ampersands. @@ -156,7 +250,8 @@ void PanelServiceMenu::fillMenu(KServiceGroup::Ptr& _root, } KService::Ptr s(static_cast<KService *>(e1)); - insertMenuItem(s, id++, -1, &suppressGenericNames); +// insertMenuItem(s, id++, -1, &suppressGenericNames); + insertMenuItem(s, id++, -1, &suppressGenericNames, TQString::null, specialTitle[s->name()], categoryIcon[s->name()] ); continue; } } @@ -222,7 +317,8 @@ void PanelServiceMenu::fillMenu(KServiceGroup::Ptr& _root, KService::Ptr s(static_cast<KService *>(e)); searchMenuItems.insert(id); - insertMenuItem(s, id++, -1, &suppressGenericNames); +// insertMenuItem(s, id++, -1, &suppressGenericNames); + insertMenuItem(s, id++, -1, &suppressGenericNames, TQString::null, specialTitle[s->name()], categoryIcon[s->name()] ); } else if (e->isType(KST_KServiceSeparator)) { @@ -304,7 +400,8 @@ void PanelServiceMenu::configChanged() void PanelServiceMenu::insertMenuItem(KService::Ptr & s, int nId, int nIndex/*= -1*/, const TQStringList *suppressGenericNames /* = 0 */, - const TQString & aliasname) + const TQString & aliasname, const TQString & label /*=TQString::NULL*/, + const TQString & categoryIcon /*=TQString::null*/) { TQString serviceName = (aliasname.isEmpty() ? s->name() : aliasname).simplifyWhiteSpace(); TQString comment = s->genericName().simplifyWhiteSpace(); @@ -355,7 +452,15 @@ void PanelServiceMenu::insertMenuItem(KService::Ptr & s, int nId, // to accelerators, replace them with two ampersands. serviceName.replace("&", "&&"); - int newId = insertItem(KickerLib::menuIconSet(s->icon()), serviceName, nId, nIndex); + TQString icon = s->icon(); + if (icon=="unknown") + icon = categoryIcon; + + int newId; + if ( label.isEmpty() ) + newId = insertItem(KickerLib::menuIconSet(s->icon()), serviceName, nId, nIndex); + else + newId = insertItem(KickerLib::menuIconSet(s->icon()), label, nId, nIndex); entryMap_.insert(newId, static_cast<KSycocaEntry*>(s)); } diff --git a/kicker/kicker/ui/service_mnu.h b/kicker/kicker/ui/service_mnu.h index 193e4faf8..44e35a6c2 100644 --- a/kicker/kicker/ui/service_mnu.h +++ b/kicker/kicker/ui/service_mnu.h @@ -89,7 +89,8 @@ protected slots: protected: void insertMenuItem(KService::Ptr & s, int nId, int nIndex = -1, const TQStringList *suppressGenericNames=0, - const TQString &aliasname = TQString::null); + const TQString &aliasname = TQString::null, + const TQString &label = TQString::null, const TQString &categoryIcon = TQString::null); virtual PanelServiceMenu * newSubMenu(const TQString & label, const TQString & relPath, TQWidget * parent, const char * name, diff --git a/kicker/libkicker/kickerSettings.kcfg b/kicker/libkicker/kickerSettings.kcfg index ff86c8431..6f7f2427e 100644 --- a/kicker/libkicker/kickerSettings.kcfg +++ b/kicker/libkicker/kickerSettings.kcfg @@ -126,6 +126,11 @@ <default>true</default> </entry> +<entry name="ReduceMenuDepth" type="Bool" > + <label>Simplify menus with only a single item inside</label> + <default>false</default> + </entry> + <entry name="MenuEntryHeight" type="Int" > <label>Height of menu entries in pixels</label> <default>0</default> |