From 10e41144596fc9ced40fc349d9ecd099b1c2ea19 Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 11 Dec 2009 20:21:27 +0000 Subject: Initial import of Trinity 3.5.11 to kdebase Extends krandrtray, adds iccconfig kcontrol module, adds run dialog autocomplete and lots of bugfixes Will need to check for commit warnings and repair as encountered Also needs full compile test git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1061475 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kicker/applets/media/mediumbutton.cpp | 2 +- kicker/applets/minipager/pagerapplet.cpp | 44 +++++++++++++++++++++++----- kicker/applets/minipager/pagerapplet.h | 1 + kicker/kicker/buttons/kbutton.cpp | 2 ++ kicker/libkicker/kickerSettings.kcfg | 5 ++++ kicker/libkicker/panelbutton.cpp | 14 ++++++--- kicker/menuext/recentdocs/recentdocsmenu.cpp | 34 ++++++++++++++------- kicker/taskbar/taskbar.cpp | 4 +-- 8 files changed, 82 insertions(+), 24 deletions(-) (limited to 'kicker') diff --git a/kicker/applets/media/mediumbutton.cpp b/kicker/applets/media/mediumbutton.cpp index 2c96601ea..e8007a989 100644 --- a/kicker/applets/media/mediumbutton.cpp +++ b/kicker/applets/media/mediumbutton.cpp @@ -123,7 +123,7 @@ void MediumButton::refreshType() { KMimeType::Ptr mime = mFileItem.determineMimeType(); QToolTip::add(this, mime->comment()); - setIcon(mime->icon(QString::null, false)); + setIcon(mFileItem.iconName()); } // Activate this code only if we find a way to have both an diff --git a/kicker/applets/minipager/pagerapplet.cpp b/kicker/applets/minipager/pagerapplet.cpp index 3ba87c0b1..6cc000562 100644 --- a/kicker/applets/minipager/pagerapplet.cpp +++ b/kicker/applets/minipager/pagerapplet.cpp @@ -136,6 +136,7 @@ KMiniPager::KMiniPager(const QString& configFile, Type type, int actions, connect( m_kwin, SIGNAL( currentDesktopViewportChanged(int, const QPoint&)), SLOT(slotSetDesktopViewport(int, const QPoint&))); connect( m_kwin, SIGNAL( numberOfDesktopsChanged(int)), SLOT( slotSetDesktopCount(int) ) ); + connect( m_kwin, SIGNAL( desktopGeometryChanged(int)), SLOT( slotRefreshViewportCount(int) ) ); connect( m_kwin, SIGNAL( activeWindowChanged(WId)), SLOT( slotActiveWindowChanged(WId) ) ); connect( m_kwin, SIGNAL( windowAdded(WId) ), this, SLOT( slotWindowAdded(WId) ) ); connect( m_kwin, SIGNAL( windowRemoved(WId) ), this, SLOT( slotWindowRemoved(WId) ) ); @@ -513,6 +514,28 @@ void KMiniPager::slotSetDesktopCount( int ) updateLayout(); } +void KMiniPager::slotRefreshViewportCount( int ) +{ + QValueList::ConstIterator it; + QValueList::ConstIterator itEnd = m_desktops.end(); + for( it = m_desktops.begin(); it != itEnd; ++it ) + { + delete (*it); + } + m_desktops.clear(); + + drawButtons(); + + m_curDesk = m_kwin->currentDesktop(); + if ( m_curDesk == 0 ) + { + m_curDesk = 1; + } + + resizeEvent(0); + updateLayout(); +} + void KMiniPager::slotActiveWindowChanged( WId win ) { if (desktopPreview()) @@ -715,8 +738,10 @@ void KMiniPager::aboutToShowContextMenu() PagerSettings::EnumBackgroundType::BgPlain + bgOffset); showMenu->insertItem(i18n("&Transparent"), PagerSettings::EnumBackgroundType::BgTransparent + bgOffset); - showMenu->insertItem(i18n("&Desktop Wallpaper"), + if (m_useViewports == false) { + showMenu->insertItem(i18n("&Desktop Wallpaper"), PagerSettings::EnumBackgroundType::BgLive + bgOffset); + } connect(showMenu, SIGNAL(activated(int)), SLOT(contextMenuActivated(int))); m_contextMenu->insertItem(i18n("&Pager Options"),showMenu); @@ -795,12 +820,17 @@ void KMiniPager::contextMenuActivated(int result) break; case PagerSettings::EnumBackgroundType::BgLive + bgOffset: { - m_settings->setBackgroundType(PagerSettings::EnumBackgroundType::BgLive); - QValueList::ConstIterator it; - QValueList::ConstIterator itEnd = m_desktops.end(); - for( it = m_desktops.begin(); it != itEnd; ++it ) - { - (*it)->backgroundChanged(); + if (m_useViewports == true) { + m_settings->setBackgroundType(PagerSettings::EnumBackgroundType::BgLive); + QValueList::ConstIterator it; + QValueList::ConstIterator itEnd = m_desktops.end(); + for( it = m_desktops.begin(); it != itEnd; ++it ) + { + (*it)->backgroundChanged(); + } + } + else { + m_settings->setBackgroundType(PagerSettings::EnumBackgroundType::BgTransparent); } break; } diff --git a/kicker/applets/minipager/pagerapplet.h b/kicker/applets/minipager/pagerapplet.h index f47b0411d..d96ba83f7 100644 --- a/kicker/applets/minipager/pagerapplet.h +++ b/kicker/applets/minipager/pagerapplet.h @@ -84,6 +84,7 @@ public slots: void slotSetDesktop(int desktop); void slotSetDesktopViewport(int desktop, const QPoint& viewport); void slotSetDesktopCount(int count); + void slotRefreshViewportCount(int currentDesktop); void slotButtonSelected(int desk ); void slotActiveWindowChanged( WId win ); void slotWindowAdded( WId ); diff --git a/kicker/kicker/buttons/kbutton.cpp b/kicker/kicker/buttons/kbutton.cpp index 071d15981..320a45842 100644 --- a/kicker/kicker/buttons/kbutton.cpp +++ b/kicker/kicker/buttons/kbutton.cpp @@ -45,7 +45,9 @@ KButton::KButton( QWidget* parent ) setPopup(MenuManager::the()->kmenu()); MenuManager::the()->registerKButton(this); + setIcon("kmenu"); + setIcon(KickerSettings::customKMenuIcon()); if (KickerSettings::showKMenuText()) { diff --git a/kicker/libkicker/kickerSettings.kcfg b/kicker/libkicker/kickerSettings.kcfg index 42f02bcad..7e6f76366 100644 --- a/kicker/libkicker/kickerSettings.kcfg +++ b/kicker/libkicker/kickerSettings.kcfg @@ -275,6 +275,11 @@ i18n("Applications") + + + QString("kmenu") + + diff --git a/kicker/libkicker/panelbutton.cpp b/kicker/libkicker/panelbutton.cpp index f53d4b38f..407a78ca6 100644 --- a/kicker/libkicker/panelbutton.cpp +++ b/kicker/libkicker/panelbutton.cpp @@ -29,6 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include #include #include @@ -39,6 +40,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include #include #include #include @@ -289,10 +291,11 @@ int PanelButton::widthForHeight(int height) const if (orientation() == Horizontal && !m_buttonText.isEmpty()) { QFont f(font()); - f.setPixelSize(KMIN(height, KMAX(int(float(height) * m_fontPercent), 16))); + //f.setPixelSize(KMIN(height, KMAX(int(float(height) * m_fontPercent), 16))); QFontMetrics fm(f); - rc += fm.width(m_buttonText) + KMIN(25, KMAX(5, fm.width('m') / 2)); + //rc += fm.width(m_buttonText) + KMIN(25, KMAX(5, fm.width('m') / 2)); + rc += fm.width(m_buttonText); } return rc; @@ -348,7 +351,7 @@ bool PanelButton::hasText() const void PanelButton::setButtonText(const QString& text) { - m_buttonText = text; + m_buttonText = " " + text; update(); } @@ -489,6 +492,9 @@ void PanelButton::mouseReleaseEvent(QMouseEvent *e) if (e->button() == LeftButton) { m_isLeftMouseButtonDown = false; + + QPixmap pix = labelIcon(); + KIconEffect::visualActivate(this, this->geometry(), &pix); } QButton::mouseReleaseEvent(e); } @@ -569,7 +575,7 @@ void PanelButton::drawButtonLabel(QPainter *p) { fontPercent *= .8; } - f.setPixelSize(KMIN(h, KMAX(int(float(h) * m_fontPercent), 16))); + //f.setPixelSize(KMIN(h, KMAX(int(float(h) * m_fontPercent), 16))); QFontMetrics fm(f); p->setFont(f); diff --git a/kicker/menuext/recentdocs/recentdocsmenu.cpp b/kicker/menuext/recentdocs/recentdocsmenu.cpp index 98357fe52..06c84d7a6 100644 --- a/kicker/menuext/recentdocs/recentdocsmenu.cpp +++ b/kicker/menuext/recentdocs/recentdocsmenu.cpp @@ -22,6 +22,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ******************************************************************/ #include +#include +#include #include #include @@ -50,8 +52,7 @@ RecentDocsMenu::~RecentDocsMenu() void RecentDocsMenu::initialize() { if (initialized()) clear(); - insertItem(SmallIconSet("history_clear"), i18n("Clear History"), - this, SLOT(slotClearHistory())); + insertItem(SmallIconSet("history_clear"), i18n("Clear History"), this, SLOT(slotClearHistory())); insertSeparator(); _fileList = KRecentDocument::recentDocuments(); @@ -60,17 +61,30 @@ void RecentDocsMenu::initialize() { insertItem(i18n("No Entries"), 0); setItemEnabled(0, false); return; - } + } int id = 0; - - for (QStringList::ConstIterator it = _fileList.begin(); - it != _fileList.end(); - ++it) - { + char alreadyPresentInMenu; + QStringList previousEntries; + for (QStringList::ConstIterator it = _fileList.begin(); it != _fileList.end(); ++it) { KDesktopFile f(*it, true /* read only */); - insertItem(SmallIconSet(f.readIcon()), f.readName().replace('&', QString::fromAscii("&&") ), id++); - } + + // Make sure this entry is not already present in the menu + alreadyPresentInMenu = 0; + for ( QStringList::Iterator previt = previousEntries.begin(); previt != previousEntries.end(); ++previt ) { + if (QString::localeAwareCompare(*previt, f.readName().replace('&', QString::fromAscii("&&") )) == 0) { + alreadyPresentInMenu = 1; + } + } + + if (alreadyPresentInMenu == 0) { + // Add item to menu + insertItem(SmallIconSet(f.readIcon()), f.readName().replace('&', QString::fromAscii("&&") ), id++); + + // Append to duplicate checking list + previousEntries.append(f.readName().replace('&', QString::fromAscii("&&") )); + } + } setInitialized(true); } diff --git a/kicker/taskbar/taskbar.cpp b/kicker/taskbar/taskbar.cpp index 8c5bb73c1..c2580f5f1 100644 --- a/kicker/taskbar/taskbar.cpp +++ b/kicker/taskbar/taskbar.cpp @@ -241,9 +241,9 @@ void TaskBar::configure() m_showOnlyIconified = TaskBarSettings::showOnlyIconified(); m_currentScreen = -1; // Show all screens or re-get our screen - m_showOnlyCurrentScreen = TaskBarSettings::showCurrentScreenOnly() && + m_showOnlyCurrentScreen = (TaskBarSettings::showCurrentScreenOnly() && QApplication::desktop()->isVirtualDesktop() && - QApplication::desktop()->numScreens() > 1; + QApplication::desktop()->numScreens() > 1) || (QApplication::desktop()->numScreens() < 2); // we need to watch geometry issues if we aren't showing windows when we // are paying attention to the current Xinerama screen -- cgit v1.2.1