From fb6753570dc90e936b4e89092554ab012e946a56 Mon Sep 17 00:00:00 2001 From: zautrix Date: Thu, 03 Feb 2005 10:48:05 +0000 Subject: mail fixes --- (limited to 'kmicromail') diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 976e309..ed8a2ee 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -149,7 +149,9 @@ ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, boo return; } connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); - + connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) ); + if ( smtpAccountBox->count()) + fillValues(0); } @@ -165,8 +167,15 @@ void ComposeMail::fillSettings() } senderNameEdit->setText(KOPrefs::instance()->mName); } - - +void ComposeMail::saveSig() +{ + if ( smtpAccountBox->count()) { + int cur = smtpAccountBox->currentItem (); + SMTPaccount *smtp = smtpAccounts.at( cur ); + if ( smtp ) + smtp->setSignature( sigMultiLine->text()); + } +} void ComposeMail::saveAsDraft() { @@ -338,7 +347,7 @@ void ComposeMail::pickAddressReply() pickAddress( ); } -void ComposeMail::fillValues( int ) +void ComposeMail::fillValues( int current ) { #if 0 SMTPaccount *smtp = smtpAccounts.at( current ); @@ -354,8 +363,10 @@ void ComposeMail::fillValues( int ) if ( smtp->getUseReply() ) { replyLine->setText( smtp->getReply() ); } - sigMultiLine->setText( smtp->getSignature() ); #endif + SMTPaccount *smtp = smtpAccounts.at( current ); + if ( smtp ) + sigMultiLine->setText( smtp->getSignature() ); } void ComposeMail::slotAdjustColumns() diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h index a7fa41c..966ac3e 100644 --- a/kmicromail/composemail.h +++ b/kmicromail/composemail.h @@ -68,6 +68,7 @@ private slots: void removeAttachment(); void clearStatus(); void setStatus( QString ); + void saveSig(); protected: QLineEdit* mPickLineEdit; diff --git a/kmicromail/composemailui.ui b/kmicromail/composemailui.ui index 610907c..23f47d3 100644 --- a/kmicromail/composemailui.ui +++ b/kmicromail/composemailui.ui @@ -12,8 +12,8 @@ 0 0 - 579 - 476 + 275 + 382 @@ -331,24 +331,13 @@ margin - 3 + 2 spacing - 3 + 2 - - QPushButton - - name - replyButton - - - text - Reply-To - - - + QPushButton name @@ -359,75 +348,76 @@ BCC - + QLineEdit name ccLine - + QLineEdit name bccLine - + QLineEdit name replyLine - + QMultiLineEdit name sigMultiLine - - QLabel + + QPushButton name - sigLabel + ccButton text - Signature + CC - - + + QPushButton + name - Spacer3 + SaveSigButton - orientation - Vertical + text + Save signature + + + QPushButton - sizeType - Expanding + name + replyButton - - sizeHint - - 20 - 20 - + + text + Reply-To - - - QPushButton + + + QLabel name - ccButton + sigLabel text - CC + Signature diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 48c3963..8253c91 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -479,7 +480,13 @@ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); fillValues(); - + QIconSet icon; + //icon = SmallIcon("fileexport"); + icon = SmallIcon("fileopen"); + SignaturButton->setText(""); + SignaturButton->setIconSet (icon ) ; + SignaturButton->setMaximumSize ( SignaturButton->sizeHint().height()+4,SignaturButton->sizeHint().height()) ; + connect( SignaturButton, SIGNAL( clicked() ), this, SLOT( chooseSig() ) ); connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); ComboBox1->insertItem( "Only if available", 0 ); ComboBox1->insertItem( "Always, Negotiated", 1 ); @@ -488,7 +495,13 @@ SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, CommandEdit->hide(); ComboBox1->setCurrentItem( data->ConnectionType() ); } - +void SMTPconfig::chooseSig() +{ + QString lnk = KFileDialog::getOpenFileName( "", "Choose Signatur File", this ); + if ( !lnk.isEmpty() ) { + SignaturEdit->setText( lnk ); + } +} void SMTPconfig::slotConnectionToggle( int index ) { // 2 is ssl connection @@ -516,6 +529,7 @@ void SMTPconfig::fillValues() loginBox->setChecked( data->getLogin() ); userLine->setText( data->getUser() ); passLine->setText( data->getPassword() ); + SignaturEdit->setText( data->getSigFile() ); } void SMTPconfig::accept() @@ -527,6 +541,7 @@ void SMTPconfig::accept() data->setLogin( loginBox->isChecked() ); data->setUser( userLine->text() ); data->setPassword( passLine->text() ); + data->setSigFile( SignaturEdit->text() ); QDialog::accept(); } diff --git a/kmicromail/editaccounts.h b/kmicromail/editaccounts.h index 6cf842e..465780c 100644 --- a/kmicromail/editaccounts.h +++ b/kmicromail/editaccounts.h @@ -121,6 +121,7 @@ public slots: protected slots: void slotConnectionToggle( int index ); void accept(); + void chooseSig(); private: SMTPaccount *data; diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index 19093b1..8f909f9 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp @@ -1,6 +1,10 @@ #include #include +#include +#include +#include + //#include #include @@ -366,6 +370,45 @@ SMTPaccount::SMTPaccount( QString filename ) port = SMTP_PORT; } +QString SMTPaccount::getSignature() +{ + QFileInfo fi ( signature ); + if ( ! fi.exists() ) + return QString(); + + QFile file( signature ); + if (!file.open( IO_ReadOnly ) ) { + return QString(); + + } + QTextStream ts( &file ); + ts.setCodec( QTextCodec::codecForName("utf8") ); + QString text = ts.read(); + file.close(); + + return text; + +} +void SMTPaccount::setSignature( QString b ) +{ + + QFileInfo fi ( signature ); + if ( ! fi.exists() ) { + QString filedir( locateLocal("data", "kopiemail" ) ); + signature = filedir+ "/" + getAccountName() +".sig"; + qDebug("new sig %s ", signature.latin1()); + save(); + } + QFile fileIn( signature ); + if (!fileIn.open( IO_WriteOnly ) ) { + qDebug("OM: Cannot write signature file %s ", signature.latin1() ); + return ; + } + QTextStream tsIn( &fileIn ); + tsIn.setCodec( QTextCodec::codecForName("utf8") ); + tsIn << b ; + fileIn.close(); +} QString SMTPaccount::getUniqueFileName() { int num = 0; @@ -392,7 +435,7 @@ void SMTPaccount::read() connectionType = conf->readNumEntry( "ConnectionType" ); login = conf->readBoolEntry( "Login" ); user = conf->readEntry( "User" ); - //password = conf->readEntryCrypt( "Password" ); + signature = conf->readEntry( "SigFile" ); setPasswordList( conf->readListEntry( "FolderHistory")); delete conf; } @@ -410,6 +453,7 @@ void SMTPaccount::save() conf->writeEntry( "ConnectionType", connectionType ); conf->writeEntry( "Login", login ); conf->writeEntry( "User", user ); + conf->writeEntry( "SigFile", signature ); //conf->writeEntryCrypt( "Password", password ); conf->writeEntry( "FolderHistory",getPasswordList() ); conf->sync(); diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h index c996fe0..a6e95fe 100644 --- a/kmicromail/libmailwrapper/settings.h +++ b/kmicromail/libmailwrapper/settings.h @@ -127,6 +127,12 @@ public: void setLogin( bool b ) { login = b; } bool getLogin() { return login; } + void setSigFile( QString b ) { signature = b; } + QString getSigFile() { return signature; } + + QString getSignature(); + void setSignature( QString b ); + private: QString file, name, mail, org, cc, bcc, reply, signature; bool useCC, useBCC, useReply, login; diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index 006390c..1789da0 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp @@ -41,7 +41,7 @@ int main( int argc, char **argv ) { else KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); #else - fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/"; + fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/icons22/"; KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 0794e00..4c58909 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -235,6 +235,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) li->addTo(helpMenu); connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); slotSetCodec( KOPrefs::instance()->mCurrentCodec ); + menuBar->setMaximumWidth( menuBar->sizeHint().width()); + //menuBar->setMaximumSize( menuBar->sizeHint()); #ifdef DESKTOP_VERSION resize ( 640, 480 ); #endif diff --git a/kmicromail/smtpconfigui.ui b/kmicromail/smtpconfigui.ui index ae0a49a..aae6f12 100644 --- a/kmicromail/smtpconfigui.ui +++ b/kmicromail/smtpconfigui.ui @@ -12,8 +12,8 @@ 0 0 - 331 - 426 + 266 + 365 @@ -29,11 +29,11 @@ margin - 3 + 5 spacing - 3 + 2 QLabel @@ -58,24 +58,6 @@ - Line - - name - line1 - - - sizePolicy - - 1 - 0 - - - - orientation - Horizontal - - - QLayoutWidget name @@ -200,24 +182,6 @@ - Line - - name - line2 - - - sizePolicy - - 1 - 0 - - - - orientation - Horizontal - - - QCheckBox name @@ -327,6 +291,59 @@ + + QLayoutWidget + + name + Layout7 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel1_2 + + + text + Signatur File + + + + QLineEdit + + name + SignaturEdit + + + + QPushButton + + name + SignaturButton + + + sizePolicy + + 1 + 1 + + + + text + F + + + + name -- cgit v0.9.0.2