-rw-r--r-- | bin/kdepim/WhatsNew.txt | 1 | ||||
-rw-r--r-- | kmicromail/composemail.cpp | 5 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 3 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.h | 4 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 16 | ||||
-rw-r--r-- | kmicromail/mainwindow.h | 4 |
6 files changed, 20 insertions, 13 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 6e8a8a7..761fcf7 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -1,56 +1,57 @@ Info about the changes in new versions of KDE-Pim/Pi ********** VERSION 2.2.3 ************ KO/Pi: Fixed a problem with (non empty) exception dates in the exception date edit dialog of recurring events for newly created events. Fixed usability problem in KA/Pi: Now searching works for "all phone numbers and all addresses" if "all fields" is selected as search option. +Changed some behaviour in OM/Pi mail management to make it more usable. ********** VERSION 2.2.2 ************ KO/Pi: Fixed a problem with the sort order of last modified date in list view. KA/Pi: Fixed a resource config read problem on windows. ********** VERSION 2.2.1 ************ KO/Pi: Fixed a problem displaying very long allday events in agenda view in single day mode. Fixed a problem with the default settings for new todos. Added an error message dialog if saving of calendar files is not possible. Made it impossible to close KO/Pi if saving fails. Fixed a problem adding calendars on windows such that these calendars can be used on the memory stick. Added config options for conflict detection. KA/Pi: Added a config option to turn on asking before a contact is deleted. Fixed a problem with the default view and view selection at startup. Formatted name is now set on import, if formatted name is empty. Fixed a problem of displaying images in the contact details view: Now the wid/hei ratio is not changed. I a picture is larger than 128 pixels in wid or hei it is downscaled to max 128 pixels wid/hei. ********** VERSION 2.2.0 ************ New stable release! Fixed some minor usability problems. Added writing of next alarm to a file for usage on pdaXrom. ************************************* You can find the complete changelog from version 1.7.7 to 2.2.0 in the source package or on http://www.pi-sync.net/html/changelog.html diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 7b609fc..4bc4441 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -1,545 +1,546 @@ // CHANGED 2004-08-06 Lutz Rogowski #ifdef DESKTOP_VERSION #include <qapplication.h> #include <kabc/addresseedialog.h> #include <kabc/stdaddressbook.h> #include <kabc/addressee.h> #else #include <qpe/qpeapplication.h> #endif //DESKTOP_VERSION #include <libkdepim/externalapphandler.h> #include "koprefs.h" #include <klocale.h> #include <kglobal.h> #ifdef MINIKDE_KDIALOG_H #undef MINIKDE_KDIALOG_H #endif #include "composemail.h" #include <libmailwrapper/smtpwrapper.h> #include <libmailwrapper/storemail.h> #include <libmailwrapper/abstractmail.h> #include <libmailwrapper/mailtypes.h> /* OPIE */ //#include <opie2/ofiledialog.h> //#include <opie2/odebug.h> #include <kfiledialog.h> //#include <qpe/resource.h> #include <qpe/global.h> //#include <qpe/contact.h> #include <qcombobox.h> #include <qcheckbox.h> #include <qiconset.h> #include <qtimer.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlabel.h> #include <qtabwidget.h> #include <qlistview.h> //using namespace Opie::Core; //using namespace Opie::Ui; ComposeMail::ComposeMail( Settings *sett, QWidget *parent, const char *name, bool modal ) : ComposeMailUI( parent, name, modal ) { + topLevelWidget()->setCaption( i18n("Compose mail - Click OK to send ->") ); mPickLineEdit = 0; mEncoding = KOPrefs::instance()->mCurrentCodeName; //managed from opiemail now //connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), // this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); settings = sett; m_replyid = ""; if ( KOPrefs::instance()->mUseKapi) { KConfig config( locateLocal("config", "kabcrc") ); config.setGroup( "General" ); QString whoami_uid = config.readEntry( "WhoAmI" ); if ( whoami_uid.isEmpty() ) { QMessageBox::information( 0, i18n( "Hint" ), i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), i18n( "Ok" ) ); fillSettings(); } else ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); #ifdef DESKTOP_VERSION KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); QStringList mails = con.emails(); QString defmail = con.preferredEmail(); if ( mails.count() == 0) QMessageBox::information( 0, i18n( "Hint" ), i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), i18n( "Ok" ) ); if (defmail.length()!=0) { fromBox->insertItem(defmail); } QStringList::ConstIterator sit = mails.begin(); for (;sit!=mails.end();++sit) { if ( (*sit)==defmail) continue; fromBox->insertItem((*sit)); } senderNameEdit->setText(con.formattedName()); #endif } else { fillSettings(); } checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); attList->addColumn( i18n( "Name" ) ); attList->addColumn( i18n( "Size" ) ); QList<Account> accounts = settings->getAccounts(); if ( QApplication::desktop()->width() < 320 ) smtpAccountBox->setMaximumWidth( 80 ); Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { if ( it->getType()==MAILLIB::A_SMTP ) { SMTPaccount *smtp = static_cast<SMTPaccount *>(it); smtpAccountBox->insertItem( smtp->getAccountName() ); smtpAccounts.append( smtp ); } } connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); mMail = 0; warnAttach = true; QIconSet icon; //icon = SmallIcon("fileexport"); icon = SmallIcon("filesave"); SaveButton->setIconSet (icon ) ; if ( QApplication::desktop()->width() < 320 ) { SaveButton->setText ("") ; SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; } else SaveButton->setText (i18n("Save")); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); #endif message->setFont ( KOPrefs::instance()->mComposeFont ); message->setWordWrap (QMultiLineEdit::WidgetWidth); if ( smtpAccounts.count() > 0 ) { fillValues( smtpAccountBox->currentItem() ); } else { QMessageBox::information( 0, i18n( "Problem" ), i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), i18n( "Ok" ) ); return; } connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); connect( SaveSigButton, SIGNAL( clicked() ), SLOT( saveSig()) ); if ( smtpAccountBox->count()) fillValues(0); #ifdef DESKTOP_VERSION if ( QApplication::desktop()->width() <= 800 ) { resize( QApplication::desktop()->size() ); } else resize( 800, 600 ); if ( QApplication::desktop()->width() >= 640 ) senderNameEdit->setFixedWidth( 200 ); #endif } void ComposeMail::fillSettings() { if ( QApplication::desktop()->width() < 320 ) fromBox->setMaximumWidth( 100 ); QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); QStringList::ConstIterator sit = mailList.begin(); int pref = 0; for (;sit!=mailList.end();++sit) { fromBox->insertItem((*sit)); } 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() { Opie::Core::OSmartPointer<Mail> mail= new Mail(); mail->setMail(fromBox->currentText()); mail->setTo( toLine->text() ); mail->setName(senderNameEdit->text()); mail->setCC( ccLine->text() ); mail->setBCC( bccLine->text() ); mail->setReply( replyLine->text() ); mail->setSubject( subjectLine->text() ); if (!m_replyid.isEmpty()) { QStringList ids; ids.append(m_replyid); mail->setInreply(ids); } QString txt = message->text(); if ( !sigMultiLine->text().isEmpty() ) { txt.append( "\n--\n" ); txt.append( sigMultiLine->text() ); } mail->setMessage( txt ); mail->setCharset (mEncoding); /* only use the default drafts folder name! */ Storemail wrapper(AbstractMail::draftFolder()); wrapper.storeMail(mail); AttachViewItem *it = (AttachViewItem *) attList->firstChild(); /* attachments we will ignore! */ if ( it != 0 ) { if ( warnAttach ) QMessageBox::warning(0,i18n("Store message"), i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); warnAttach = false; } setStatus( i18n("Mail saved as draft!") ); } void ComposeMail::clearStatus() { - topLevelWidget()->setCaption( i18n("Compose mail") ); + topLevelWidget()->setCaption( i18n("Compose mail - Click OK to send ->") ); } void ComposeMail::setStatus( QString status ) { topLevelWidget()->setCaption( status ); QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; } void ComposeMail::pickAddress( ) { QLineEdit *line = mPickLineEdit; if ( line == 0 ) return; #ifdef DESKTOP_VERSION //qDebug(" ComposeMail::pickAddress "); QString names ;//= AddressPicker::getNames(); KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); uint i=0; for (i=0; i < list.count(); i++) { if ( !list[i].preferredEmail().isEmpty()) { if ( ! names.isEmpty() ) names+= ","; names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; } } if ( line->text().isEmpty() ) { line->setText( names ); } else if ( !names.isEmpty() ) { line->setText( line->text() + ", " + names ); } #else bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); // the result should now arrive through method insertAttendees #endif } //the map includes name/email pairs, that comes from Ka/Pi void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) { //qDebug("ComposeMail::insertAttendees "); raise(); QString UID = uid; if ( uid.left( 18 ) == (this->name() +QString("pick2")) ) { mPickLineEdit = toLine; UID = this->name(); subjectLine->setText( uid.mid( 18 ) ); } //qDebug("ccc %s %s ", uid.latin1(), this->name()); if ( mPickLineEdit == 0 ) { //whoami received QString defmail = uidList[0]; if ( emailList.count() == 0 ) QMessageBox::information( 0, i18n( "Hint" ), i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), i18n( "Ok" ) ); if (defmail.length()!=0) { fromBox->insertItem(defmail); } QStringList::ConstIterator sit = emailList.begin(); int pref = 0; for (;sit!=emailList.end();++sit) { if ( (*sit)==defmail) continue; fromBox->insertItem((*sit)); } senderNameEdit->setText(nameList[0]); return; } QString names ; QLineEdit *line = mPickLineEdit; if (UID == this->name()) { for ( int i = 0; i < nameList.count(); i++) { QString _name = nameList[i]; QString _email = emailList[i]; QString _uid = uidList[i]; if ( ! _email.isEmpty() ) { if ( ! names.isEmpty() ) names+= ","; names+= "\""+_name +"\"<" +_email +">"; } } } if ( line->text().isEmpty() ) { line->setText( names ); } else if ( !names.isEmpty() ) { line->setText( line->text() + ", " + names ); } } void ComposeMail::setTo( const QString & to ) { toLine->setText( to ); } void ComposeMail::setSubject( const QString & subject ) { subjectLine->setText( subject ); } void ComposeMail::setInReplyTo( const QString & messageId ) { m_replyid = messageId; } void ComposeMail::setMessage( const QString & text ) { message->setText( text ); } void ComposeMail::pickAddressTo() { mPickLineEdit = toLine; pickAddress( ); } void ComposeMail::pickAddressCC() { mPickLineEdit = ccLine; pickAddress( ); } void ComposeMail::pickAddressBCC() { mPickLineEdit = bccLine; pickAddress( ); } void ComposeMail::pickAddressReply() { mPickLineEdit = replyLine; pickAddress( ); } void ComposeMail::fillValues( int current ) { #if 0 SMTPaccount *smtp = smtpAccounts.at( current ); ccLine->clear(); if ( smtp->getUseCC() ) { ccLine->setText( smtp->getCC() ); } bccLine->clear(); if ( smtp->getUseBCC() ) { bccLine->setText( smtp->getBCC() ); } replyLine->clear(); if ( smtp->getUseReply() ) { replyLine->setText( smtp->getReply() ); } #endif SMTPaccount *smtp = smtpAccounts.at( current ); if ( smtp ) sigMultiLine->setText( smtp->getSignature() ); } void ComposeMail::slotAdjustColumns() { int currPage = tabWidget->currentPageIndex(); tabWidget->showPage( attachTab ); attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); attList->setColumnWidth( 1, 80 ); tabWidget->setCurrentPage( currPage ); } void ComposeMail::addAttachment() { QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); if ( !lnk.isEmpty() ) { Attachment *att = new Attachment( lnk ); (void) new AttachViewItem( attList, att ); } } void ComposeMail::removeAttachment() { if ( !attList->currentItem() ) { QMessageBox::information( this, i18n( "Error" ), i18n( "<p>Please select a File.</p>" ), i18n( "Ok" ) ); } else { attList->takeItem( attList->currentItem() ); } } void ComposeMail::accept() { if ( smtpAccountBox->count() == 0 ) { reject(); return; } if (! checkBoxLater->isChecked() ) { - int yesno = QMessageBox::warning(0,i18n("Stop editing message"), + int yesno = QMessageBox::warning(0, subjectLine->text().left ( 25 ), i18n("Send this message?"), i18n("Yes"), i18n("Cancel")); if (yesno == 1) { return; } } #if 0 odebug << "Sending Mail with " << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; #endif Opie::Core::OSmartPointer<Mail> mail=new Mail; SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); mail->setMail(fromBox->currentText()); if ( !toLine->text().isEmpty() ) { mail->setTo( toLine->text() ); } else { QMessageBox::warning(0,i18n("Sending mail"), i18n("No Receiver spezified" ) ); return; } mail->setName(senderNameEdit->text()); mail->setCC( ccLine->text() ); mail->setBCC( bccLine->text() ); mail->setReply( replyLine->text() ); mail->setSubject( subjectLine->text() ); if (!m_replyid.isEmpty()) { QStringList ids; ids.append(m_replyid); mail->setInreply(ids); } QString txt = message->text(); if ( !sigMultiLine->text().isEmpty() ) { txt.append( "\n--\n" ); txt.append( sigMultiLine->text() ); } mail->setMessage( txt ); mail->setCharset (mEncoding); AttachViewItem *it = (AttachViewItem *) attList->firstChild(); while ( it != 0 ) { mail->addAttachment( it->getAttachment() ); it = (AttachViewItem *) it->nextSibling(); } SMTPwrapper wrapper( smtp ); if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) setStatus( tr ("Mail sent")); else { setStatus( tr ("Error: Something went wrong. Nothing sent")); return; } QDialog::accept(); } void ComposeMail::reject() { //qDebug("ComposeMail::reject() "); int yesno = QMessageBox::warning(0,i18n("Store message?"), i18n("Store message into drafts?\n"), i18n("Yes"), i18n("No")); //qDebug("button %d ", yesno); if (yesno == 0) { if ( toLine->text().isEmpty() ) { QMessageBox::warning(0,i18n("Sending mail"), i18n("No Receiver spezified" ) ); return; } saveAsDraft(); } if (yesno == 2) { qDebug("return "); return; } QDialog::reject(); } void ComposeMail::setCharset(const QString& charset) { if ( !charset.isEmpty() ) mEncoding = charset; qDebug("ComposeMail::setCharset %s ", mEncoding.latin1()); } ComposeMail::~ComposeMail() { } void ComposeMail::reEditMail(const RecMailP¤t) { RecMailP data = current; RecBodyP body = data->Wrapper()->fetchBody(current); message->setText(body->Bodytext()); subjectLine->setText( data->getSubject()); toLine->setText(data->To().join(",")); ccLine->setText(data->CC().join(",")); bccLine->setText(data->Bcc().join(",")); replyLine->setText(data->Replyto()); setCharset(body->getCharset()); } AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) : QListViewItem( parent ) { attachment = att; if ( !attachment->getPixmap().isNull() ) setPixmap( 0,attachment->getPixmap() ); setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); setText( 1, QString::number( att->getSize() ) ); } diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 5119744..15fa148 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp @@ -1,98 +1,99 @@ // CHANGED 2004-08-06 Lutz Rogowski #include "mailistviewitem.h" #include <libmailwrapper/abstractmail.h> #include <qtextstream.h> #include <kiconloader.h> #include "koprefs.h" //#include <qpe/resource.h> MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) - :QListViewItem(parent,item),mail_data() + :KListViewItem(parent,item),mail_data() { } void MailListViewItem::showEntry() { if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { setPixmap( 0, SmallIcon ( "kmmsgreplied") ); mKeyMap.insert(0, "r" ); } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { /* I think it looks nicer if there are not such a log of icons but only on mails replied or new - Alwin*/ //setPixmap( 0,SmallIcon ("kmmsgunseen") ); mKeyMap.insert(0, "s" ); } else { setPixmap( 0,SmallIcon ( "kmmsgnew") ); mKeyMap.insert(0, "u" ); } QString fsize = mail_data->MsgsizeString(); // 1.23 // 11.23 // 111.23 // 999.23 maxlen QString fsort; switch(fsize.length() ) { case 6: fsort = "00" + fsize ; break; case 7: fsort = "0" + fsize ; break; default: fsort = fsize ; break; } + setText(3, fsize ); //qDebug("fsize *%s* ",fsize.latin1() ); //qDebug("fsort *%s* ",fsort.latin1() ); if ( fsize.right(2) == "kB" ) { mKeyMap.insert(3, "k" + fsort); } else { mKeyMap.insert(3, "M" +fsort ); } setText(1,mail_data->getSubject()); setText(2,mail_data->getFrom()); mKeyMap.insert(4,mail_data->getIsoDate()); setText(4,mail_data->getDate()); if ( KOPrefs::instance()->mShowToField ) setText(5,mail_data->To()[0]); } void MailListViewItem::storeData(const RecMailP&data) { mail_data = data; } void MailListViewItem::setSortKey(int column,const QString &key) { mKeyMap.insert(column,key); } QString MailListViewItem::key(int column, bool) const { // to make is fast, we use here special cases if ( column == 3 || column == 4 || column == 0) { return *mKeyMap.find(column); } if ( column == 1 ) { if ( text(1).left(4).lower() == "re: " ) return text(1).mid(4); } return text(column); /* QMap<int,QString>::ConstIterator it = mKeyMap.find(column); if (it == mKeyMap.end()) return text(column); else return *it; */ } const RecMailP& MailListViewItem::data()const { return mail_data; } MAILLIB::ATYPE MailListViewItem::wrapperType() { if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; return mail_data->Wrapper()->getType(); } diff --git a/kmicromail/mailistviewitem.h b/kmicromail/mailistviewitem.h index 0fd44d3..b409c9d 100644 --- a/kmicromail/mailistviewitem.h +++ b/kmicromail/mailistviewitem.h @@ -1,27 +1,27 @@ // CHANGED 2004-08-06 Lutz Rogowski #ifndef __MAILLISTVIEWITEM_H #define __MAILLISTVIEWITEM_H -#include <qlistview.h> +#include <klistview.h> #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/maildefines.h> -class MailListViewItem:public QListViewItem +class MailListViewItem:public KListViewItem { public: MailListViewItem(QListView * parent, MailListViewItem * after ); virtual ~MailListViewItem(){} void storeData(const RecMailP&data); const RecMailP&data()const; void showEntry(); MAILLIB::ATYPE wrapperType(); QString key(int column, bool) const; void setSortKey(int column,const QString &key); protected: RecMailP mail_data; private: QMap<int,QString> mKeyMap; }; #endif diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index e3c5ec3..82a915e 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp @@ -1,429 +1,433 @@ // CHANGED 2004-08-06 Lutz Rogowski #include <qlabel.h> #include <qvbox.h> #include <qheader.h> #include <qtimer.h> #include <qlayout.h> //#include <kdialog.h> #include <kiconloader.h> #include <kapplication.h> #ifdef DESKTOP_VERSION #include <qapplication.h> #include <qstatusbar.h> #include <kabc/stdaddressbook.h> extern QStatusBar* globalSstatusBarMainWindow; #else #include <qpe/qpeapplication.h> #include <klocale.h> #endif #include "defines.h" #include "koprefs.h" #include "mainwindow.h" #include "mailistviewitem.h" #include <KDGanttMinimizeSplitter.h> +#include <libkdepim/kpimglobalprefs.h> #include "koprefs.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) : QMainWindow( parent, name ) //, flags ) { #ifdef DESKTOP_VERSION globalSstatusBarMainWindow = statusBar(); #endif setCaption( i18n( "KOpieMail/Pi" ) ); setToolBarsMovable( false ); //KABC::StdAddressBook::self(); toolBar = new QToolBar( this ); menuBar = new QPEMenuBar( toolBar ); mailMenu = new QPopupMenu( menuBar ); menuBar->insertItem( i18n( "Mail" ), mailMenu ); settingsMenu = new QPopupMenu( menuBar ); menuBar->insertItem( i18n( "Settings" ), settingsMenu ); addToolBar( toolBar ); toolBar->setHorizontalStretchable( true ); QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), 0, 0, this ); connect(getMail, SIGNAL( activated() ), SLOT( slotGetAllMail() ) ); getMail->addTo( mailMenu ); getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), 0, 0, this ); getMail->addTo( toolBar ); getMail->addTo( mailMenu ); connect(getMail, SIGNAL( activated() ), SLOT( slotGetMail() ) ); composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), 0, 0, this ); composeMail->addTo( toolBar ); composeMail->addTo( mailMenu ); sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , 0, 0, this ); sendQueued->addTo( toolBar ); sendQueued->addTo( mailMenu ); /* syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, 0, 0, this ); syncFolders->addTo( toolBar ); syncFolders->addTo( mailMenu ); */ showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , 0, 0, this, 0, true ); showFolders->addTo( toolBar ); showFolders->addTo( mailMenu ); showFolders->setOn( true ); connect(showFolders, SIGNAL( toggled(bool) ), SLOT( slotShowFolders(bool) ) ); /* searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 0, 0, this ); searchMails->kopddTo( toolBar ); searchMails->addTo( mailMenu ); */ deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); deleteMails->addTo( toolBar ); deleteMails->addTo( mailMenu ); connect( deleteMails, SIGNAL( activated() ), SLOT( slotDeleteAllMail() ) ); editSettings = new QAction( i18n( "Configure OM/Pi..." ), SmallIcon("SettingsIcon") , 0, 0, this ); editSettings->addTo( settingsMenu ); connect( editSettings, SIGNAL( activated() ), SLOT( slotEditSettings() ) ); QAction * editSettings2 = new QAction( i18n( "Global Settings..." ), SmallIcon("SettingsIcon") , 0, 0, this ); editSettings2->addTo( settingsMenu ); connect( editSettings2, SIGNAL( activated() ), SLOT( slotEditGlobalSettings() ) ); editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 0, 0, this ); editAccounts->addTo( settingsMenu ); codecMenu = new QPopupMenu( menuBar ); codecMenu->insertItem( "Western (iso-8859-1)",0,0); codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); codecMenu->insertItem( "Western (iso-8859-15)",2,2); codecMenu->insertItem( "Chinese (big-5)",3,3); codecMenu->insertItem( "Unicode (utf-8)",4,4); codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); //disabled //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); //setCentralWidget( view ); QVBox* wrapperBox = new QVBox( this ); setCentralWidget( wrapperBox ); // QWidget *view = new QWidget( wrapperBox ); KDGanttMinimizeSplitter* splithor = new KDGanttMinimizeSplitter( Qt::Vertical, wrapperBox); splithor->setMinimizeDirection( KDGanttMinimizeSplitter::Down); KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, splithor); split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); subLE = 0; fromLE = 0; toLE = 0; if ( KOPrefs::instance()->mShowInfoSub || KOPrefs::instance()->mShowInfoFrom || KOPrefs::instance()->mShowInfoTo ) { QWidget* infoBox = new QWidget( splithor ); QGridLayout *griLay = new QGridLayout( infoBox, 2,2); if ( KOPrefs::instance()->mShowInfoSub ) { griLay->addWidget( new QLabel ( i18n("Su:"), infoBox ),0,0 ); griLay->addWidget( subLE = new QLineEdit( infoBox ),0,1) ; } if ( KOPrefs::instance()->mShowInfoFrom ) { griLay->addWidget( new QLabel ( i18n("Fr:"), infoBox ),1,0 ); griLay->addWidget( fromLE = new QLineEdit( infoBox ),1,1) ; } if ( KOPrefs::instance()->mShowInfoTo ) { griLay->addWidget( new QLabel ( i18n("To:"), infoBox ),2,0 ); griLay->addWidget( toLE = new QLineEdit( infoBox ),2,1) ; } infoBox->setMaximumHeight( infoBox->sizeHint().height() ); if ( !KOPrefs::instance()->mShowInfoStart ) { QTimer::singleShot( 1,splithor, SLOT ( toggle() ) ); } } folderView = new AccountView( split ); folderView->header()->hide(); folderView->setRootIsDecorated( false ); folderView->addColumn( i18n( "Mailbox" ) ); //layout->addWidget( folderView ); - mailView = new QListView( split ); + mailView = new KListView( split ); mailView->addColumn( i18n( " " ) ); mailView->addColumn( i18n( "Subject" ),QListView::Manual ); mailView->addColumn( i18n( "Sender" ),QListView::Manual ); mailView->addColumn( i18n( "Size" ),QListView::Manual); mailView->addColumn( i18n( "Date" ),QListView::Manual); if ( KOPrefs::instance()->mShowToField ) mailView->addColumn( i18n( "To" ),QListView::Manual); mailView->setAllColumnsShowFocus(true); //mailView->setSorting(-1); mailView->setRootIsDecorated( false ); statusWidget = new StatusWidget( wrapperBox ); statusWidget->hide(); - + mailView->setSelectionMode( QListView::Multi ); + mailView->setMultiSelection( true); + mailView->setAlternateBackground(KPimGlobalPrefs::instance()->mAlternateColor ); //layout->addWidget( mailView ); //layout->setStretchFactor( folderView, 1 ); //layout->setStretchFactor( mailView, 2 ); slotAdjustLayout(); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); if ( subLE ) QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); if ( fromLE ) QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); if ( toLE ) QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); #endif connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, SLOT( mailLeftClicked(QListViewItem*) ) ); connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, SLOT( mailLeftClicked(QListViewItem*) ) ); connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), this,SLOT(refreshMailView(const QValueList<RecMailP>&))); connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this, SLOT( setInfoFields(QListViewItem*) ) ); connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); //mailView->setMultiSelection ( true ); - mailView->setSelectionMode( QListView::Extended ); + //mailView->setSelectionMode( QListView::Extended ); QValueList<int> list; int fw = 100; if ( QApplication::desktop()->width() > 320 ) fw = 50; list.append( fw ); list.append( 100 ); split->setSizes( list ); - QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); + QTimer::singleShot( 100, this, SLOT( slotAdjustColumns() ) ); mailView->setShowSortIndicator ( true ); QLabel *spacer = new QLabel( toolBar ); spacer->setBackgroundMode( QWidget::PaletteButton ); toolBar->setStretchableWidget( spacer ); QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); if ( QApplication::desktop()->width() > 320 ) closeMail->addTo(toolBar); closeMail->addTo(mailMenu); QPopupMenu* helpMenu = new QPopupMenu( menuBar ); menuBar->insertItem( i18n( "Help" ), helpMenu ); QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); li->addTo(helpMenu); li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); li->addTo(helpMenu); li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 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 } MainWindow::~MainWindow() { } void MainWindow::setInfoFields(QListViewItem* item ) { if ( item == 0) { if ( subLE ) subLE->setText(""); if ( fromLE ) fromLE->setText(""); if ( toLE ) toLE->setText(""); return; } RecMailP mail = ((MailListViewItem*)item)->data(); if ( subLE ) subLE->setText(mail->getSubject()); if ( fromLE ) fromLE->setText(mail->getFrom()); if ( toLE ) toLE->setText(mail->To().join(";" )); if ( subLE ) subLE->setCursorPosition(0); if ( fromLE ) fromLE->setCursorPosition(0); if ( toLE ) toLE->setCursorPosition(0); } void MainWindow::slotSetCodec( int codec ) { codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); //qDebug("codec %d ", codec); KOPrefs::instance()->mCurrentCodec = codec; KOPrefs::instance()->isDirty = true; QString name; switch ( codec ) { case 0: name = "iso-8859-1"; break; case 1: name = "iso-8859-5"; break; case 2: name = "iso-8859-15"; break; case 3: name = "big-5"; break; case 4: name = "utf-8"; break; case 5: name = KOPrefs::instance()->mSendCodec.lower(); break; } KOPrefs::instance()->mCurrentCodeName = name ; codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); } void MainWindow::showLicence() { KApplication::showLicence(); } void MainWindow::showAbout() { QString version; #include <../version> QString cap = "About KOpieMail/Pi"; QString text = i18n("KOpieMail/Platform-independent\n") + "(OM/Pi) " + version + " - " #ifdef DESKTOP_VERSION "Desktop Edition\n" #else "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" #endif "www.pi-sync.info\n\n" "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n" "KOpieMail/Pi is based on Opie Mail\n" "Copyright (c) Rajko Albrecht and the Opie team\n" "KOpieMail/Pi is licensed under the GPL\n" "\n" "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" "libEtPan has its own licence - see LibEtPan licence\n"; KApplication::showText( cap, text ); } void MainWindow::showEtpanLicence() { KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); } void MainWindow::appMessage(const QCString &, const QByteArray &) { qDebug("appMessage implemented by subclass"); } void MainWindow::slotAdjustLayout() { /* QWidget *d = QApplication::desktop(); if ( d->width() < d->height() ) { layout->setDirection( QBoxLayout::TopToBottom ); } else { layout->setDirection( QBoxLayout::LeftToRight ); } */ } void MainWindow::slotAdjustColumns() { bool hidden = folderView->isHidden(); if ( hidden ) folderView->show(); folderView->setColumnWidth( 0, folderView->visibleWidth() ); if ( hidden ) folderView->hide(); mailView->setColumnWidth( 0, 10 ); mailView->setColumnWidth( 1, 100 ); mailView->setColumnWidth( 2, 100 ); - mailView->setColumnWidth( 3, 50 ); - mailView->setColumnWidth( 4, 120 ); + mailView->setColumnWidth( 3, 70 ); + mailView->setColumnWidth( 4, 170 ); if ( KOPrefs::instance()->mShowToField ) mailView->setColumnWidth( 5, 100 ); + mailView->setColumnAlignment( 3, AlignRight); } void MainWindow::slotEditSettings() { } void MainWindow::slotEditGlobalSettings() { } void MainWindow::slotShowFolders( bool ) { qDebug("not implemented: "); } void MainWindow::refreshMailView(const QValueList<RecMailP>&) { qDebug("not implemented: "); } void MainWindow::mailLeftClicked(QListViewItem * ) { qDebug("not implemented: "); } void MainWindow::displayMail() { qDebug("not implemented: "); } void MainWindow::slotDeleteMail() { qDebug("not implemented: "); } void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) { qDebug("not implemented: "); } void MainWindow::slotSendQueued() { qDebug("not implemented: "); } void MainWindow::slotEditAccounts() { qDebug("not implemented: "); } void MainWindow::slotComposeMail() { qDebug("not implemented: "); } diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h index 6894039..178d2bb 100644 --- a/kmicromail/mainwindow.h +++ b/kmicromail/mainwindow.h @@ -1,74 +1,74 @@ // CHANGED 2004-08-06 Lutz Rogowski #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <qmainwindow.h> -#include <qlistview.h> +#include <klistview.h> #include <qaction.h> #include <qlineedit.h> #include <qtoolbar.h> #ifdef DESKTOP_VERSION #include <qmenubar.h> #define QPEMenuBar QMenuBar #else #include <qpe/qpemenubar.h> #endif #include "accountview.h" #include "statuswidget.h" #include <libmailwrapper/mailtypes.h> #include <opie2/osmartpointer.h> class RecMail; class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); virtual ~MainWindow(); public slots: virtual void slotAdjustColumns(); virtual void appMessage(const QCString &msg, const QByteArray &data); virtual void slotComposeMail(); protected slots: virtual void setInfoFields(QListViewItem* ); virtual void slotSendQueued(); virtual void slotEditAccounts(); virtual void slotShowFolders( bool show ); virtual void refreshMailView(const QValueList<RecMailP>&); virtual void displayMail(); virtual void slotGetMail() = 0; virtual void slotGetAllMail() = 0; virtual void slotDeleteMail(); virtual void slotDeleteAllMail() = 0; virtual void slotSetCodec(int); virtual void mailHold(int, QListViewItem *,const QPoint&,int); virtual void slotAdjustLayout(); virtual void slotEditSettings(); virtual void slotEditGlobalSettings(); virtual void mailLeftClicked( QListViewItem * ); void showLicence(); void showAbout(); void showEtpanLicence(); protected: QToolBar *toolBar; StatusWidget *statusWidget; QPEMenuBar *menuBar; QPopupMenu *mailMenu, *settingsMenu, *codecMenu; QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, *editSettings, *editAccounts, *syncFolders; AccountView *folderView; - QListView *mailView; + KListView *mailView; QLineEdit* toLE,*fromLE,*subLE; //QBoxLayout *layout; }; #endif |