[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.2/kdepim/akregator/src
From:       Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date:       2009-04-17 16:48:32
Message-ID: 1239986912.539086.5146.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 955443 by osterfeld:

backport

r952087 | osterfeld | 2009-04-10 23:21:22 +0200 (Fri, 10 Apr 2009) | 7 lines

fix minimize/restore behavior when clicking the tray icon
CCBUG:189181
CCBUG:153577
CCBUG:168845
CCBUG:173838
CCBUG:178084
CCBUG:185372



 M  +5 -37     akregator_part.cpp  
 M  +0 -4      akregator_part.h  
 M  +0 -6      mainwindow.cpp  
 M  +0 -1      mainwindow.h  
 M  +0 -9      trayicon.cpp  
 M  +0 -4      trayicon.h  


--- branches/KDE/4.2/kdepim/akregator/src/akregator_part.cpp #955442:955443
@@ -154,23 +154,18 @@
     // notify the part that this is our internal widget
     setWidget(m_mainWidget);
 
-    TrayIcon* trayIcon = new TrayIcon( getMainWindow() );
+    TrayIcon* trayIcon = new TrayIcon( m_mainWidget->window() );
     TrayIcon::setInstance(trayIcon);
     m_actionManager->initTrayIcon(trayIcon);
 
     connect(trayIcon, SIGNAL(toggleShowPart()), this, SIGNAL(toggleShowPart()));
 
     if ( isTrayIconEnabled() )
-    {
         trayIcon->show();
-#ifdef __GNUC__
-#warning this needs a way to get the position of the systray
-#endif
-        NotificationManager::self()->setWidget(0, componentData());
-    }
-    else
-        NotificationManager::self()->setWidget(getMainWindow(), componentData());
 
+    QWidget* const notificationParent = isTrayIconEnabled() ? m_mainWidget->window() \
: 0; +    NotificationManager::self()->setWidget(notificationParent, \
componentData()); +
     connect( trayIcon, SIGNAL(quitSelected()),
             kapp, SLOT(quit())) ;
 
@@ -224,11 +219,7 @@
 
 void Part::slotSettingsChanged()
 {
-#ifdef __GNUC__
-#warning Tray icons are no longer widgets
-#endif
-//    NotificationManager::self()->setWidget(isTrayIconEnabled() ? \
                TrayIcon::getInstance() : getMainWindow(), instance());
-    NotificationManager::self()->setWidget( getMainWindow(), componentData());
+    NotificationManager::self()->setWidget(isTrayIconEnabled() ? \
m_mainWidget->window() : 0, componentData());  
     Syndication::FileRetriever::setUseCache(Settings::useHTMLCache());
 
@@ -458,29 +449,6 @@
     return Settings::showTrayIcon();
 }
 
-QWidget* Part::getMainWindow()
-{
-    // this is a dirty fix to get the main window used for the tray icon
-    QWidgetList l = QApplication::topLevelWidgets();
-    QWidget* wid = 0L;
-
-    // check if there is an akregator main window
-    foreach (wid, QApplication::topLevelWidgets())
-    {
-        if (wid->objectName() == "akregator_mainwindow")
-            return wid;
-    }
-
-    // if not, check if there is an kontact main window
-    foreach (wid, QApplication::topLevelWidgets())
-    {
-        if (wid->objectName().startsWith("kontact-mainwindow"))
-            return wid;
-    }
-
-    return 0;
-}
-
 void Part::importFile(const KUrl& url)
 {
     QString filename;
--- branches/KDE/4.2/kdepim/akregator/src/akregator_part.h #955442:955443
@@ -133,7 +133,6 @@
         void showKNotifyOptions();
 
     signals:
-        void toggleShowPart();
         void signalSettingsChanged();
 
 
@@ -150,9 +149,6 @@
 
         void importFile(const KUrl& url);
 
-        /** FIXME: hack to get the tray icon working */
-        QWidget* getMainWindow();
-
         KParts::Part *hitTest(QWidget *widget, const QPoint &globalPos);
 
     private slots:
--- branches/KDE/4.2/kdepim/akregator/src/mainwindow.cpp #955442:955443
@@ -110,7 +110,6 @@
 
     connect(m_part, SIGNAL(setWindowCaption(QString)), this, \
                SLOT(setCaption(QString)) );
     connect(TrayIcon::getInstance(), SIGNAL(quitSelected()), this, \
                SLOT(slotQuit()));
-    connect(m_part, SIGNAL(toggleShowPart()), this, SLOT(slotToggleVisibility()) );
 
     createGUI(m_part);
     browserExtension(m_part)->setBrowserInterface(m_browserIface);
@@ -236,11 +235,6 @@
     m_statusLabel->setText(text);
 }
 
-void MainWindow::slotToggleVisibility()
-{
-  setVisible(!isVisible());
-}
-
 void MainWindow::autoSaveProperties()
 {
     KConfig config("autosaved", KConfig::SimpleConfig,
--- branches/KDE/4.2/kdepim/akregator/src/mainwindow.h #955442:955443
@@ -88,7 +88,6 @@
 public slots:
     void slotClearStatusText();
     void slotSetStatusBarText(const QString &c);
-    void slotToggleVisibility();
 
 protected:
     /**
--- branches/KDE/4.2/kdepim/akregator/src/trayicon.cpp #955442:955443
@@ -64,21 +64,12 @@
     m_defaultIcon = KIcon("akregator").pixmap(22);
     setIcon(m_defaultIcon);
     this->setToolTip( i18n("Akregator - Feed Reader"));
-    connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ),
-             SLOT( slotActivated( QSystemTrayIcon::ActivationReason ) ) );
 }
 
 
 TrayIcon::~TrayIcon()
 {}
 
-
-void TrayIcon::slotActivated(QSystemTrayIcon::ActivationReason reason) {
-  if (reason == QSystemTrayIcon::Trigger )
-    emit toggleShowPart();
-}
-
-
 #if 0
 QPixmap TrayIcon::takeScreenshot() const
 {
--- branches/KDE/4.2/kdepim/akregator/src/trayicon.h #955442:955443
@@ -50,11 +50,7 @@
         void settingsChanged();
         void slotSetUnread(int unread);
         void viewButtonClicked();
-        void slotActivated(QSystemTrayIcon::ActivationReason reason);
 
-    signals:
-        void toggleShowPart();
-
     private:
         static TrayIcon* m_instance;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic