Branch: master

8231cc23 2014-07-07 19:51:30 Timothy Pearson
Fix korgac abort on startup due to oversized tray icon creation when icon widget has not yet been shown
Properly print caldav/carddav wallet warnings to prevent backtrace spew
M knotes/knotesapp.cpp
M knotes/knotesapp.h
M korganizer/korgac/alarmdockwindow.cpp
M korganizer/korgac/alarmdockwindow.h
M tderesources/caldav/preferences.cpp
M tderesources/carddav/preferences.cpp
diff --git a/knotes/knotesapp.cpp b/knotes/knotesapp.cpp
index 26aee48..14fd625 100644
--- a/knotes/knotesapp.cpp
+++ b/knotes/knotesapp.cpp
@@ -105,7 +105,7 @@
     KWin::setSystemTrayWindowFor( winId(), tqt_xrootwin() );
     TQToolTip::add( this, i18n( "KNotes: Sticky notes for TDE" ) );
     setBackgroundMode( X11ParentRelative );
-    setPixmap( KSystemTray::loadSizedIcon( "knotes", TQWidget::width() ) );
+    setPixmap( KSystemTray::loadIcon( "knotes" ) );
 
     // set the initial style
     KNote::setStyle( KNotesGlobalConfig::style() );
@@ -210,7 +210,7 @@
     updateNoteActions();
 }
 
-void KNotesApp::resizeEvent ( TQResizeEvent * )
+void KNotesApp::resizeTrayIcon ()
 {
 	// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
 	TQPixmap origpixmap;
@@ -223,6 +223,18 @@
 	setPixmap(scaledpixmap);
 }
 
+void KNotesApp::resizeEvent ( TQResizeEvent * )
+{
+	// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+	resizeTrayIcon();
+}
+
+void KNotesApp::showEvent ( TQShowEvent * )
+{
+	// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+	resizeTrayIcon();
+}
+
 KNotesApp::~KNotesApp()
 {
     saveNotes();
diff --git a/knotes/knotesapp.h b/knotes/knotesapp.h
index 2c2656f..0888e20 100644
--- a/knotes/knotesapp.h
+++ b/knotes/knotesapp.h
@@ -104,6 +104,7 @@
 protected:
     void mousePressEvent( TQMouseEvent* );
     void resizeEvent ( TQResizeEvent * );
+    void showEvent ( TQShowEvent * );
 
 protected slots:
     void slotShowNote();
@@ -122,6 +123,7 @@
 private:
     void showNote( KNote *note ) const;
     void saveConfigs();
+    void resizeTrayIcon();
 
 private slots:
     void acceptConnection();
diff --git a/korganizer/korgac/alarmdockwindow.cpp b/korganizer/korgac/alarmdockwindow.cpp
index f8f15ad..1f5d5b3 100644
--- a/korganizer/korgac/alarmdockwindow.cpp
+++ b/korganizer/korgac/alarmdockwindow.cpp
@@ -58,8 +58,8 @@
 
   // Set up icons
   TDEGlobal::iconLoader()->addAppDir( "korgac" );
-  mPixmapEnabled  = loadSizedIcon( "korgac", width() );
-  mPixmapDisabled = loadSizedIcon( "korgac_disabled", width() );
+  mPixmapEnabled  = loadIcon( "korgac" );
+  mPixmapDisabled = loadIcon( "korgac_disabled" );
 
   setPixmap( alarmsEnabled ? mPixmapEnabled : mPixmapDisabled );
 
@@ -104,7 +104,7 @@
 {
 }
 
-void AlarmDockWindow::resizeEvent ( TQResizeEvent * )
+void AlarmDockWindow::resizeTrayIcon ()
 {
 	// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
 	mPixmapEnabled  = loadSizedIcon( "korgac", width() );
@@ -115,6 +115,16 @@
 	setPixmap( alarmsEnabled ? mPixmapEnabled : mPixmapDisabled );
 }
 
+void AlarmDockWindow::resizeEvent ( TQResizeEvent * )
+{
+	resizeTrayIcon();
+}
+
+void AlarmDockWindow::showEvent ( TQShowEvent * )
+{
+	resizeTrayIcon();
+}
+
 void AlarmDockWindow::slotUpdate( int reminders )
 {
   TQToolTip::remove( this );
diff --git a/korganizer/korgac/alarmdockwindow.h b/korganizer/korgac/alarmdockwindow.h
index 6f317fd..6f6cd7b 100644
--- a/korganizer/korgac/alarmdockwindow.h
+++ b/korganizer/korgac/alarmdockwindow.h
@@ -52,6 +52,7 @@
     void mousePressEvent( TQMouseEvent * );
 //    void closeEvent( TQCloseEvent * );
     void resizeEvent ( TQResizeEvent * );
+    void showEvent ( TQShowEvent * );
 
   protected slots:
     void slotQuit();
@@ -59,6 +60,9 @@
     void slotDismissAll();
 
   private:
+    void resizeTrayIcon();
+
+  private:
     TQPixmap mPixmapEnabled;
     TQPixmap mPixmapDisabled;
     TQString mName;
diff --git a/tderesources/caldav/preferences.cpp b/tderesources/caldav/preferences.cpp
index a4be7cc..a9ba687 100644
--- a/tderesources/caldav/preferences.cpp
+++ b/tderesources/caldav/preferences.cpp
@@ -47,12 +47,12 @@
         if (!mWallet->hasFolder(folder)) {
             if (!mWallet->createFolder(folder)) {
                 ret = false;
-                kdWarning() << "can't create the wallet folder for CalDAV passwords";
+                kdWarning() << "can't create the wallet folder for CalDAV passwords\n";
             }
         }
         if (!mWallet->setFolder(folder)) {
             ret = false;
-            kdWarning() << "can't set the wallet folder for CalDAV passwords";
+            kdWarning() << "can't set the wallet folder for CalDAV passwords\n";
         }
     } else {
         // the wallet is inaccessible or not configured
@@ -69,18 +69,18 @@
         // the wallet is not marked as inaccessible
 
         if (NULL == mWallet) {
-            kdDebug() << "creating wallet for " + mPrefix << '\n';
+            kdDebug() << "creating wallet for " << mPrefix << '\n';
 
             mWallet = Wallet::openWallet(Wallet::NetworkWallet(), 0);
             if (NULL == mWallet) {
                 mNoWallet = true; // can't open the wallet, mark it inaccessible
-                kdWarning() << "can't create a wallet for CalDAV passwords";
+                kdWarning() << "can't create a wallet for CalDAV passwords\n";
             } else {
                 if (setWalletFolder(WALLET_FOLDER)) {
                     // reserved
                 } else {
                     // can't set the wallet folder, remove the wallet and mark it inaccessible
-                    kdWarning() << "can't set the walet folder for CalDAV passwords";
+                    kdWarning() << "can't set the walet folder for CalDAV passwords\n";
                     removeWallet(true);
                 }
             }
@@ -115,7 +115,7 @@
     if (NULL != w) {
         int rc = w->writePassword(mPrefix + WALLET_PWD_SUFFIX, password);
         if (0 != rc) {
-            kdWarning() << "CalDAV: can't write password to the wallet";
+            kdWarning() << "CalDAV: can't write password to the wallet\n";
         } else {
             ret = true;
         }
@@ -136,7 +136,7 @@
             password = p;
             ret = true;
         } else {
-            kdWarning() << "CalDAV: can't read password from the wallet";
+            kdWarning() << "CalDAV: can't read password from the wallet\n";
             password = NO_PASSWORD;
         }
     }
@@ -154,7 +154,7 @@
         if (0 == rc) {
             ret = true;
         } else {
-            kdWarning() << "CalDAV: can't remove password from the wallet";
+            kdWarning() << "CalDAV: can't remove password from the wallet\n";
         }
     }
 
diff --git a/tderesources/carddav/preferences.cpp b/tderesources/carddav/preferences.cpp
index a379317..3be1f21 100644
--- a/tderesources/carddav/preferences.cpp
+++ b/tderesources/carddav/preferences.cpp
@@ -46,12 +46,12 @@
         if (!mWallet->hasFolder(folder)) {
             if (!mWallet->createFolder(folder)) {
                 ret = false;
-                kdWarning() << "can't create the wallet folder for CardDAV passwords";
+                kdWarning() << "can't create the wallet folder for CardDAV passwords\n";
             }
         }
         if (!mWallet->setFolder(folder)) {
             ret = false;
-            kdWarning() << "can't set the wallet folder for CardDAV passwords";
+            kdWarning() << "can't set the wallet folder for CardDAV passwords\n";
         }
     } else {
         // the wallet is inaccessible or not configured
@@ -68,18 +68,18 @@
         // the wallet is not marked as inaccessible
 
         if (NULL == mWallet) {
-            kdDebug() << "creating wallet for " + mPrefix << '\n';
+            kdDebug() << "creating wallet for " << mPrefix << '\n';
 
             mWallet = Wallet::openWallet(Wallet::NetworkWallet(), 0);
             if (NULL == mWallet) {
                 mNoWallet = true; // can't open the wallet, mark it inaccessible
-                kdWarning() << "can't create a wallet for CardDAV passwords";
+                kdWarning() << "can't create a wallet for CardDAV passwords\n";
             } else {
                 if (setWalletFolder(WALLET_FOLDER)) {
                     // reserved
                 } else {
                     // can't set the wallet folder, remove the wallet and mark it inaccessible
-                    kdWarning() << "can't set the walet folder for CardDAV passwords";
+                    kdWarning() << "can't set the walet folder for CardDAV passwords\n";
                     removeWallet(true);
                 }
             }
@@ -114,7 +114,7 @@
     if (NULL != w) {
         int rc = w->writePassword(mPrefix + WALLET_PWD_SUFFIX, password);
         if (0 != rc) {
-            kdWarning() << "CardDAV: can't write password to the wallet";
+            kdWarning() << "CardDAV: can't write password to the wallet\n";
         } else {
             ret = true;
         }
@@ -135,7 +135,7 @@
             password = p;
             ret = true;
         } else {
-            kdWarning() << "CardDAV: can't read password from the wallet";
+            kdWarning() << "CardDAV: can't read password from the wallet\n";
             password = NO_PASSWORD;
         }
 ** Diff limit reached (max: 250 lines) **