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
pull/21/head
Timothy Pearson 11 years ago
parent 93aee1b625
commit 8231cc23f3

@ -105,7 +105,7 @@ KNotesApp::KNotesApp()
KWin::setSystemTrayWindowFor( winId(), tqt_xrootwin() ); KWin::setSystemTrayWindowFor( winId(), tqt_xrootwin() );
TQToolTip::add( this, i18n( "KNotes: Sticky notes for TDE" ) ); TQToolTip::add( this, i18n( "KNotes: Sticky notes for TDE" ) );
setBackgroundMode( X11ParentRelative ); setBackgroundMode( X11ParentRelative );
setPixmap( KSystemTray::loadSizedIcon( "knotes", TQWidget::width() ) ); setPixmap( KSystemTray::loadIcon( "knotes" ) );
// set the initial style // set the initial style
KNote::setStyle( KNotesGlobalConfig::style() ); KNote::setStyle( KNotesGlobalConfig::style() );
@ -210,7 +210,7 @@ KNotesApp::KNotesApp()
updateNoteActions(); updateNoteActions();
} }
void KNotesApp::resizeEvent ( TQResizeEvent * ) void KNotesApp::resizeTrayIcon ()
{ {
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
TQPixmap origpixmap; TQPixmap origpixmap;
@ -223,6 +223,18 @@ void KNotesApp::resizeEvent ( TQResizeEvent * )
setPixmap(scaledpixmap); 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() KNotesApp::~KNotesApp()
{ {
saveNotes(); saveNotes();

@ -104,6 +104,7 @@ public slots:
protected: protected:
void mousePressEvent( TQMouseEvent* ); void mousePressEvent( TQMouseEvent* );
void resizeEvent ( TQResizeEvent * ); void resizeEvent ( TQResizeEvent * );
void showEvent ( TQShowEvent * );
protected slots: protected slots:
void slotShowNote(); void slotShowNote();
@ -122,6 +123,7 @@ protected slots:
private: private:
void showNote( KNote *note ) const; void showNote( KNote *note ) const;
void saveConfigs(); void saveConfigs();
void resizeTrayIcon();
private slots: private slots:
void acceptConnection(); void acceptConnection();

@ -58,8 +58,8 @@ AlarmDockWindow::AlarmDockWindow( const char *name )
// Set up icons // Set up icons
TDEGlobal::iconLoader()->addAppDir( "korgac" ); TDEGlobal::iconLoader()->addAppDir( "korgac" );
mPixmapEnabled = loadSizedIcon( "korgac", width() ); mPixmapEnabled = loadIcon( "korgac" );
mPixmapDisabled = loadSizedIcon( "korgac_disabled", width() ); mPixmapDisabled = loadIcon( "korgac_disabled" );
setPixmap( alarmsEnabled ? mPixmapEnabled : mPixmapDisabled ); setPixmap( alarmsEnabled ? mPixmapEnabled : mPixmapDisabled );
@ -104,7 +104,7 @@ AlarmDockWindow::~AlarmDockWindow()
{ {
} }
void AlarmDockWindow::resizeEvent ( TQResizeEvent * ) void AlarmDockWindow::resizeTrayIcon ()
{ {
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
mPixmapEnabled = loadSizedIcon( "korgac", width() ); mPixmapEnabled = loadSizedIcon( "korgac", width() );
@ -115,6 +115,16 @@ void AlarmDockWindow::resizeEvent ( TQResizeEvent * )
setPixmap( alarmsEnabled ? mPixmapEnabled : mPixmapDisabled ); setPixmap( alarmsEnabled ? mPixmapEnabled : mPixmapDisabled );
} }
void AlarmDockWindow::resizeEvent ( TQResizeEvent * )
{
resizeTrayIcon();
}
void AlarmDockWindow::showEvent ( TQShowEvent * )
{
resizeTrayIcon();
}
void AlarmDockWindow::slotUpdate( int reminders ) void AlarmDockWindow::slotUpdate( int reminders )
{ {
TQToolTip::remove( this ); TQToolTip::remove( this );

@ -52,12 +52,16 @@ class AlarmDockWindow : public KSystemTray
void mousePressEvent( TQMouseEvent * ); void mousePressEvent( TQMouseEvent * );
// void closeEvent( TQCloseEvent * ); // void closeEvent( TQCloseEvent * );
void resizeEvent ( TQResizeEvent * ); void resizeEvent ( TQResizeEvent * );
void showEvent ( TQShowEvent * );
protected slots: protected slots:
void slotQuit(); void slotQuit();
void slotSuspendAll(); void slotSuspendAll();
void slotDismissAll(); void slotDismissAll();
private:
void resizeTrayIcon();
private: private:
TQPixmap mPixmapEnabled; TQPixmap mPixmapEnabled;
TQPixmap mPixmapDisabled; TQPixmap mPixmapDisabled;

@ -47,12 +47,12 @@ bool CalDavPrefs::setWalletFolder(const TQString& folder) {
if (!mWallet->hasFolder(folder)) { if (!mWallet->hasFolder(folder)) {
if (!mWallet->createFolder(folder)) { if (!mWallet->createFolder(folder)) {
ret = false; 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)) { if (!mWallet->setFolder(folder)) {
ret = false; ret = false;
kdWarning() << "can't set the wallet folder for CalDAV passwords"; kdWarning() << "can't set the wallet folder for CalDAV passwords\n";
} }
} else { } else {
// the wallet is inaccessible or not configured // the wallet is inaccessible or not configured
@ -69,18 +69,18 @@ Wallet* CalDavPrefs::getWallet() {
// the wallet is not marked as inaccessible // the wallet is not marked as inaccessible
if (NULL == mWallet) { if (NULL == mWallet) {
kdDebug() << "creating wallet for " + mPrefix << '\n'; kdDebug() << "creating wallet for " << mPrefix << '\n';
mWallet = Wallet::openWallet(Wallet::NetworkWallet(), 0); mWallet = Wallet::openWallet(Wallet::NetworkWallet(), 0);
if (NULL == mWallet) { if (NULL == mWallet) {
mNoWallet = true; // can't open the wallet, mark it inaccessible 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 { } else {
if (setWalletFolder(WALLET_FOLDER)) { if (setWalletFolder(WALLET_FOLDER)) {
// reserved // reserved
} else { } else {
// can't set the wallet folder, remove the wallet and mark it inaccessible // 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); removeWallet(true);
} }
} }
@ -115,7 +115,7 @@ bool CalDavPrefs::writePasswordToWallet(const TQString& password) {
if (NULL != w) { if (NULL != w) {
int rc = w->writePassword(mPrefix + WALLET_PWD_SUFFIX, password); int rc = w->writePassword(mPrefix + WALLET_PWD_SUFFIX, password);
if (0 != rc) { if (0 != rc) {
kdWarning() << "CalDAV: can't write password to the wallet"; kdWarning() << "CalDAV: can't write password to the wallet\n";
} else { } else {
ret = true; ret = true;
} }
@ -136,7 +136,7 @@ bool CalDavPrefs::readPasswordFromWallet(TQString& password) {
password = p; password = p;
ret = true; ret = true;
} else { } else {
kdWarning() << "CalDAV: can't read password from the wallet"; kdWarning() << "CalDAV: can't read password from the wallet\n";
password = NO_PASSWORD; password = NO_PASSWORD;
} }
} }
@ -154,7 +154,7 @@ bool CalDavPrefs::removePasswordFromWallet() {
if (0 == rc) { if (0 == rc) {
ret = true; ret = true;
} else { } else {
kdWarning() << "CalDAV: can't remove password from the wallet"; kdWarning() << "CalDAV: can't remove password from the wallet\n";
} }
} }

@ -46,12 +46,12 @@ bool CardDavPrefs::setWalletFolder(const TQString& folder) {
if (!mWallet->hasFolder(folder)) { if (!mWallet->hasFolder(folder)) {
if (!mWallet->createFolder(folder)) { if (!mWallet->createFolder(folder)) {
ret = false; 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)) { if (!mWallet->setFolder(folder)) {
ret = false; ret = false;
kdWarning() << "can't set the wallet folder for CardDAV passwords"; kdWarning() << "can't set the wallet folder for CardDAV passwords\n";
} }
} else { } else {
// the wallet is inaccessible or not configured // the wallet is inaccessible or not configured
@ -68,18 +68,18 @@ Wallet* CardDavPrefs::getWallet() {
// the wallet is not marked as inaccessible // the wallet is not marked as inaccessible
if (NULL == mWallet) { if (NULL == mWallet) {
kdDebug() << "creating wallet for " + mPrefix << '\n'; kdDebug() << "creating wallet for " << mPrefix << '\n';
mWallet = Wallet::openWallet(Wallet::NetworkWallet(), 0); mWallet = Wallet::openWallet(Wallet::NetworkWallet(), 0);
if (NULL == mWallet) { if (NULL == mWallet) {
mNoWallet = true; // can't open the wallet, mark it inaccessible 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 { } else {
if (setWalletFolder(WALLET_FOLDER)) { if (setWalletFolder(WALLET_FOLDER)) {
// reserved // reserved
} else { } else {
// can't set the wallet folder, remove the wallet and mark it inaccessible // 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); removeWallet(true);
} }
} }
@ -114,7 +114,7 @@ bool CardDavPrefs::writePasswordToWallet(const TQString& password) {
if (NULL != w) { if (NULL != w) {
int rc = w->writePassword(mPrefix + WALLET_PWD_SUFFIX, password); int rc = w->writePassword(mPrefix + WALLET_PWD_SUFFIX, password);
if (0 != rc) { if (0 != rc) {
kdWarning() << "CardDAV: can't write password to the wallet"; kdWarning() << "CardDAV: can't write password to the wallet\n";
} else { } else {
ret = true; ret = true;
} }
@ -135,7 +135,7 @@ bool CardDavPrefs::readPasswordFromWallet(TQString& password) {
password = p; password = p;
ret = true; ret = true;
} else { } else {
kdWarning() << "CardDAV: can't read password from the wallet"; kdWarning() << "CardDAV: can't read password from the wallet\n";
password = NO_PASSWORD; password = NO_PASSWORD;
} }
} }
@ -153,7 +153,7 @@ bool CardDavPrefs::removePasswordFromWallet() {
if (0 == rc) { if (0 == rc) {
ret = true; ret = true;
} else { } else {
kdWarning() << "CardDAV: can't remove password from the wallet"; kdWarning() << "CardDAV: can't remove password from the wallet\n";
} }
} }

Loading…
Cancel
Save