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

List:       kde-commits
Subject:    kdeutils/kwallet
From:       Antonio Larrosa Jimenez <larrosa () kde ! org>
Date:       2003-08-28 19:02:16
[Download RAW message or body]

CVS commit by antlarr: 

George wants his app to compile on KDE 3.x so let's use some #ifs
Of course I haven't tested on KDE 3.[01] but I think it's ok.


  M +17 -4     kwalletmanager.cpp   1.23
  M +2 -0      kwalletmanager.h   1.10


--- kdeutils/kwallet/kwalletmanager.cpp  #1.22:1.23
@@ -47,10 +47,10 @@ KWalletManager::KWalletManager(QWidget *
         _shuttingDown = false;
         _tray = new KSystemTray(this, "kwalletmanager tray");
-        _tray->setPixmap(KSystemTray::loadIcon("wallet_closed"));
+        _tray->setPixmap(loadSystemTrayIcon("wallet_closed"));
         connect(_tray,SIGNAL(quitSelected()),SLOT(shuttingDown()));
         QStringList wl = KWallet::Wallet::walletList();
         for (QStringList::Iterator it = wl.begin(); it != wl.end(); ++it) {
                 if (KWallet::Wallet::isOpen(*it)) {
-                        _tray->setPixmap(KSystemTray::loadIcon("wallet_open"));
+                        _tray->setPixmap(loadSystemTrayIcon("wallet_open"));
                         break;
                 }
@@ -114,5 +114,5 @@ bool KWalletManager::queryClose() {
 
 void KWalletManager::aWalletWasOpened() {
-        _tray->setPixmap(KSystemTray::loadIcon("wallet_open"));
+        _tray->setPixmap(loadSystemTrayIcon("wallet_open"));
         updateWalletDisplay();
 }
@@ -209,5 +209,5 @@ void KWalletManager::openWallet(QIconVie
 
 void KWalletManager::allWalletsClosed() {
-        _tray->setPixmap(KSystemTray::loadIcon("wallet_closed"));
+        _tray->setPixmap(loadSystemTrayIcon("wallet_closed"));
         possiblyQuit();
 }
@@ -277,4 +277,17 @@ void KWalletManager::setupWallet() {
         KApplication::startServiceByDesktopName("kwallet_config");
 }
+
+QPixmap KWalletManager::loadSystemTrayIcon(const QString &icon)
+{
+#if KDE_IS_VERSION(3, 1, 90)
+        return KSystemTray::loadIcon(icon);
+#else
+        KConfig *appCfg = kapp->config();
+        KConfigGroupSaver configSaver(appCfg, "System Tray");
+        int iconWidth = appCfg->readNumEntry("systrayIconWidth", 22);
+        return kapp->iconLoader()->loadIcon( icon, KIcon::Panel, iconWidth );
+#endif
+}
+
 
 #include "kwalletmanager.moc"

--- kdeutils/kwallet/kwalletmanager.h  #1.9:1.10
@@ -39,4 +39,6 @@ class KWalletManager : public KMainWindo
                 virtual ~KWalletManager();
 
+                QPixmap loadSystemTrayIcon(const QString &icon);
+
         public slots:
                 void createWallet();


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

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