-rw-r--r-- | kmicromail/composemail.cpp | 28 | ||||
-rw-r--r-- | kmicromail/composemailui.ui | 4 | ||||
-rw-r--r-- | kmicromail/selectstoreui.ui | 8 |
3 files changed, 27 insertions, 13 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 35ad367..5f7a76f 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp @@ -1,254 +1,268 @@ // CHANGED 2004-08-06 Lutz Rogowski #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> #include <kabc/addresseedialog.h> #include <kabc/stdaddressbook.h> #include <kabc/addressee.h> #ifdef DESKTOP_VERSION #include <kabc/addresseedialog.h> #else //DESKTOP_VERSION #include <libkdepim/externalapphandler.h> #endif //DESKTOP_VERSION #include "koprefs.h" //using namespace Opie::Core; //using namespace Opie::Ui; ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) : ComposeMailUI( parent, name, modal ) { mPickLineEdit = 0; 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 = s; 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 SMTP account first.\nThe SMTP is needed for sending mail.\n" ), + 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) ) ); - message->setFont ( KOPrefs::instance()->mComposeFont ); - message->setWordWrap (QMultiLineEdit::WidgetWidth); -#ifndef DESKTOP_VERSION - QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); -#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::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 ); /* 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") ); } 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(); 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]; diff --git a/kmicromail/composemailui.ui b/kmicromail/composemailui.ui index 0a5a750..c66b0c8 100644 --- a/kmicromail/composemailui.ui +++ b/kmicromail/composemailui.ui @@ -1,144 +1,144 @@ <!DOCTYPE UI><UI> <class>ComposeMailUI</class> <include location="local">tr.h</include> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>ComposeMailUI</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> <width>276</width> - <height>262</height> + <height>263</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Compose Message</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>2</number> </property> <property stdset="1"> <name>spacing</name> <number>1</number> </property> <widget row="1" column="0" rowspan="1" colspan="4" > <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>tabWidget</cstring> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>mailTab</cstring> </property> <attribute> <name>title</name> <string>Mail</string> </attribute> <vbox> <property stdset="1"> <name>margin</name> <number>1</number> </property> <property stdset="1"> <name>spacing</name> <number>1</number> </property> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout10</cstring> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>1</number> </property> <widget row="0" column="1" > <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout9</cstring> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="0" column="1" > <class>QComboBox</class> <property stdset="1"> <name>name</name> <cstring>fromBox</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>editable</name> <bool>true</bool> </property> <property stdset="1"> <name>duplicatesEnabled</name> <bool>false</bool> </property> </widget> <widget row="0" column="0" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>senderNameEdit</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>0</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>minimumSize</name> <size> <width>70</width> <height>0</height> @@ -322,152 +322,152 @@ <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>ccButton</cstring> </property> <property stdset="1"> <name>text</name> <string>CC</string> </property> </widget> </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>attachTab</cstring> </property> <attribute> <name>title</name> <string>Attachment</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>4</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="0" column="0" rowspan="1" colspan="3" > <class>QListView</class> <property stdset="1"> <name>name</name> <cstring>attList</cstring> </property> <property stdset="1"> <name>selectionMode</name> <enum>Single</enum> </property> <property stdset="1"> <name>allColumnsShowFocus</name> <bool>true</bool> </property> <property stdset="1"> <name>showSortIndicator</name> <bool>true</bool> </property> </widget> <widget row="1" column="2" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>deleteButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Delete File</string> </property> </widget> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>addButton</cstring> </property> <property stdset="1"> <name>text</name> <string>Add File</string> </property> </widget> </grid> </widget> </widget> <widget row="0" column="0" > <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>checkBoxLater</cstring> </property> <property stdset="1"> <name>text</name> <string>send later</string> </property> </widget> <widget row="0" column="1" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>accountLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>use:</string> </property> </widget> <widget row="0" column="2" > <class>QComboBox</class> <property stdset="1"> <name>name</name> <cstring>smtpAccountBox</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> </widget> <widget row="0" column="3" > <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>SaveButton</cstring> </property> <property stdset="1"> <name>text</name> - <string>Save</string> + <string> S</string> </property> </widget> </grid> </widget> <tabstops> <tabstop>fromBox</tabstop> <tabstop>toButton</tabstop> <tabstop>toLine</tabstop> <tabstop>subjectLine</tabstop> <tabstop>message</tabstop> <tabstop>tabWidget</tabstop> <tabstop>ccButton</tabstop> <tabstop>ccLine</tabstop> <tabstop>bccButton</tabstop> <tabstop>bccLine</tabstop> <tabstop>replyButton</tabstop> <tabstop>replyLine</tabstop> <tabstop>sigMultiLine</tabstop> <tabstop>attList</tabstop> <tabstop>addButton</tabstop> <tabstop>deleteButton</tabstop> </tabstops> </UI> diff --git a/kmicromail/selectstoreui.ui b/kmicromail/selectstoreui.ui index 2da103b..89f6ebc 100644 --- a/kmicromail/selectstoreui.ui +++ b/kmicromail/selectstoreui.ui @@ -1,318 +1,318 @@ <!DOCTYPE UI><UI> <class>selectstoreui</class> <include location="local">tr.h</include> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>selectstoreui</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>279</width> - <height>304</height> + <width>230</width> + <height>307</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Select target box</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>11</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="0" column="0" rowspan="1" colspan="2" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>headlabel</cstring> </property> <property stdset="1"> <name>text</name> <string><b>Store mail(s) to</b></string> </property> <property stdset="1"> <name>alignment</name> <set>AlignCenter</set> </property> <property> <name>hAlign</name> </property> </widget> <widget row="1" column="0" rowspan="1" colspan="2" > <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout2</cstring> </property> <grid> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget row="1" column="1" > <class>QComboBox</class> <property stdset="1"> <name>name</name> <cstring>folderSelection</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> </widget> <widget row="1" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>folderLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>Folder:</string> </property> <property stdset="1"> <name>alignment</name> <set>AlignVCenter|AlignRight</set> </property> <property> <name>hAlign</name> </property> </widget> <widget row="0" column="1" > <class>QComboBox</class> <property stdset="1"> <name>name</name> <cstring>accountSelection</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>3</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>accountlabel</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>1</hsizetype> <vsizetype>1</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>text</name> <string>Account:</string> </property> <property stdset="1"> <name>alignment</name> <set>AlignVCenter|AlignRight</set> </property> <property> <name>hAlign</name> </property> </widget> </grid> </widget> <widget row="2" column="0" rowspan="1" colspan="2" > <class>Line</class> <property stdset="1"> <name>name</name> <cstring>Line1</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> </widget> <widget row="3" column="0" rowspan="1" colspan="2" > <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>newFoldersel</cstring> </property> <property stdset="1"> <name>text</name> <string>Create new folder</string> </property> </widget> <widget row="4" column="0" rowspan="1" colspan="2" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> <cstring>newFolderedit</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>false</bool> </property> </widget> <widget row="5" column="0" rowspan="1" colspan="2" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>newFolderLabel</cstring> </property> <property stdset="1"> <name>text</name> - <string>Prefix will prepend, no need to enter it!</string> + <string>Prefix will prepend, do not enter</string> </property> <property stdset="1"> <name>alignment</name> <set>WordBreak|AlignCenter</set> </property> <property> <name>hAlign</name> </property> <property> <name>wordwrap</name> </property> </widget> <widget row="6" column="0" rowspan="1" colspan="2" > <class>Line</class> <property stdset="1"> <name>name</name> <cstring>Line2</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Horizontal</enum> </property> </widget> <spacer row="9" column="0" > <property> <name>name</name> <cstring>Spacer2</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> <widget row="8" column="0" rowspan="1" colspan="2" > <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>selMove</cstring> </property> <property stdset="1"> <name>text</name> <string>Move mail(s)</string> </property> </widget> <widget row="7" column="0" > <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>useSize</cstring> </property> <property stdset="1"> <name>text</name> - <string>apply only to mails smaller</string> + <string>only mails smaller</string> </property> </widget> <widget row="7" column="1" > <class>QSpinBox</class> <property stdset="1"> <name>name</name> <cstring>sizeSpinBox</cstring> </property> <property stdset="1"> <name>suffix</name> <string> kB</string> </property> <property stdset="1"> <name>maxValue</name> <number>8192</number> </property> <property stdset="1"> <name>minValue</name> <number>1</number> </property> <property stdset="1"> <name>lineStep</name> <number>1</number> </property> <property stdset="1"> <name>value</name> <number>5</number> </property> </widget> </grid> </widget> <connections> <connection> <sender>selMove</sender> <signal>clicked()</signal> <receiver>selectstoreui</receiver> <slot>slotMoveMail()</slot> </connection> <connection> <sender>newFoldersel</sender> <signal>clicked()</signal> <receiver>selectstoreui</receiver> <slot>slotCreateNewFolder()</slot> </connection> <connection> <sender>accountSelection</sender> <signal>activated(int)</signal> <receiver>selectstoreui</receiver> <slot>slotAccountselected(int)</slot> </connection> <connection> <sender>folderSelection</sender> <signal>activated(int)</signal> <receiver>selectstoreui</receiver> <slot>slotFolderSelected(int)</slot> </connection> <slot access="protected">slotFolderSelected(int)</slot> <slot access="protected">slotAccountselected(int)</slot> <slot access="protected">slotCreateNewFolder()</slot> <slot access="protected">slotMoveMail()</slot> </connections> <tabstops> <tabstop>accountSelection</tabstop> <tabstop>folderSelection</tabstop> <tabstop>newFoldersel</tabstop> <tabstop>newFolderedit</tabstop> <tabstop>selMove</tabstop> </tabstops> </UI> |