author | zautrix <zautrix> | 2004-08-06 22:27:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-06 22:27:51 (UTC) |
commit | 81a027fdb113968401105258cf89b56b96987103 (patch) (unidiff) | |
tree | 1e5e91873d80618f296190c64bf4c056a3a79ea2 /kmicromail | |
parent | c07b730f8f38aabf365a67578df6140080824f10 (diff) | |
download | kdepimpi-81a027fdb113968401105258cf89b56b96987103.zip kdepimpi-81a027fdb113968401105258cf89b56b96987103.tar.gz kdepimpi-81a027fdb113968401105258cf89b56b96987103.tar.bz2 |
SOme change logs
-rw-r--r-- | kmicromail/composemail.cpp | 1 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 1 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.h | 1 | ||||
-rw-r--r-- | kmicromail/main.cpp | 1 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 2 | ||||
-rw-r--r-- | kmicromail/mainwindow.h | 2 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 1 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 1 | ||||
-rw-r--r-- | kmicromail/viewmailbase.cpp | 1 | ||||
-rw-r--r-- | kmicromail/viewmailbase.h | 1 |
10 files changed, 12 insertions, 0 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 9060364..654cfc0 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,96 +1,97 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | 2 | ||
2 | #include "composemail.h" | 3 | #include "composemail.h" |
3 | 4 | ||
4 | #include <libmailwrapper/smtpwrapper.h> | 5 | #include <libmailwrapper/smtpwrapper.h> |
5 | #include <libmailwrapper/storemail.h> | 6 | #include <libmailwrapper/storemail.h> |
6 | #include <libmailwrapper/abstractmail.h> | 7 | #include <libmailwrapper/abstractmail.h> |
7 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
8 | 9 | ||
9 | /* OPIE */ | 10 | /* OPIE */ |
10 | //#include <opie2/ofiledialog.h> | 11 | //#include <opie2/ofiledialog.h> |
11 | //#include <opie2/odebug.h> | 12 | //#include <opie2/odebug.h> |
12 | #include <kfiledialog.h> | 13 | #include <kfiledialog.h> |
13 | //#include <qpe/resource.h> | 14 | //#include <qpe/resource.h> |
14 | #include <qpe/config.h> | 15 | #include <qpe/config.h> |
15 | #include <qpe/global.h> | 16 | #include <qpe/global.h> |
16 | //#include <qpe/contact.h> | 17 | //#include <qpe/contact.h> |
17 | 18 | ||
18 | 19 | ||
19 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
20 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
21 | #include <qtimer.h> | 22 | #include <qtimer.h> |
22 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
23 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
24 | #include <qmultilineedit.h> | 25 | #include <qmultilineedit.h> |
25 | #include <qlabel.h> | 26 | #include <qlabel.h> |
26 | #include <qtabwidget.h> | 27 | #include <qtabwidget.h> |
27 | #include <qlistview.h> | 28 | #include <qlistview.h> |
28 | #include <kabc/addresseedialog.h> | 29 | #include <kabc/addresseedialog.h> |
29 | #include <kabc/stdaddressbook.h> | 30 | #include <kabc/stdaddressbook.h> |
30 | #include <kabc/addressee.h> | 31 | #include <kabc/addressee.h> |
31 | 32 | ||
32 | 33 | ||
33 | 34 | ||
34 | //using namespace Opie::Core; | 35 | //using namespace Opie::Core; |
35 | //using namespace Opie::Ui; | 36 | //using namespace Opie::Ui; |
36 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 37 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
37 | : ComposeMailUI( parent, name, modal, flags ) | 38 | : ComposeMailUI( parent, name, modal, flags ) |
38 | { | 39 | { |
39 | 40 | ||
40 | settings = s; | 41 | settings = s; |
41 | m_replyid = ""; | 42 | m_replyid = ""; |
42 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 43 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
43 | QStringList mails = con.emails(); | 44 | QStringList mails = con.emails(); |
44 | QString defmail = con.preferredEmail(); | 45 | QString defmail = con.preferredEmail(); |
45 | if ( mails.count() == 0) | 46 | if ( mails.count() == 0) |
46 | QMessageBox::information( 0, tr( "Hint" ), | 47 | QMessageBox::information( 0, tr( "Hint" ), |
47 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 48 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
48 | tr( "Ok" ) ); | 49 | tr( "Ok" ) ); |
49 | if (defmail.length()!=0) { | 50 | if (defmail.length()!=0) { |
50 | fromBox->insertItem(defmail); | 51 | fromBox->insertItem(defmail); |
51 | } | 52 | } |
52 | QStringList::ConstIterator sit = mails.begin(); | 53 | QStringList::ConstIterator sit = mails.begin(); |
53 | for (;sit!=mails.end();++sit) { | 54 | for (;sit!=mails.end();++sit) { |
54 | if ( (*sit)==defmail) | 55 | if ( (*sit)==defmail) |
55 | continue; | 56 | continue; |
56 | fromBox->insertItem((*sit)); | 57 | fromBox->insertItem((*sit)); |
57 | } | 58 | } |
58 | senderNameEdit->setText(con.formattedName()); | 59 | senderNameEdit->setText(con.formattedName()); |
59 | Config cfg( "mail" ); | 60 | Config cfg( "mail" ); |
60 | cfg.setGroup( "Compose" ); | 61 | cfg.setGroup( "Compose" ); |
61 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 62 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
62 | 63 | ||
63 | attList->addColumn( tr( "Name" ) ); | 64 | attList->addColumn( tr( "Name" ) ); |
64 | attList->addColumn( tr( "Size" ) ); | 65 | attList->addColumn( tr( "Size" ) ); |
65 | 66 | ||
66 | QList<Account> accounts = settings->getAccounts(); | 67 | QList<Account> accounts = settings->getAccounts(); |
67 | 68 | ||
68 | Account *it; | 69 | Account *it; |
69 | for ( it = accounts.first(); it; it = accounts.next() ) { | 70 | for ( it = accounts.first(); it; it = accounts.next() ) { |
70 | if ( it->getType()==MAILLIB::A_SMTP ) { | 71 | if ( it->getType()==MAILLIB::A_SMTP ) { |
71 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 72 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
72 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 73 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
73 | smtpAccounts.append( smtp ); | 74 | smtpAccounts.append( smtp ); |
74 | } | 75 | } |
75 | } | 76 | } |
76 | if ( smtpAccounts.count() > 0 ) { | 77 | if ( smtpAccounts.count() > 0 ) { |
77 | fillValues( smtpAccountBox->currentItem() ); | 78 | fillValues( smtpAccountBox->currentItem() ); |
78 | } else { | 79 | } else { |
79 | QMessageBox::information( 0, tr( "Problem" ), | 80 | QMessageBox::information( 0, tr( "Problem" ), |
80 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), | 81 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), |
81 | tr( "Ok" ) ); | 82 | tr( "Ok" ) ); |
82 | return; | 83 | return; |
83 | } | 84 | } |
84 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 85 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
85 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 86 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
86 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 87 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
87 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 88 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
88 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 89 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
89 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 90 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
90 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 91 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
91 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 92 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
92 | mMail = 0; | 93 | mMail = 0; |
93 | warnAttach = true; | 94 | warnAttach = true; |
94 | 95 | ||
95 | } | 96 | } |
96 | void ComposeMail::saveAsDraft() | 97 | void ComposeMail::saveAsDraft() |
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 1ca0ada..b92b0cf 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -1,96 +1,97 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | #include "mailistviewitem.h" | 2 | #include "mailistviewitem.h" |
2 | #include <libmailwrapper/abstractmail.h> | 3 | #include <libmailwrapper/abstractmail.h> |
3 | #include <qtextstream.h> | 4 | #include <qtextstream.h> |
4 | #include <kiconloader.h> | 5 | #include <kiconloader.h> |
5 | //#include <qpe/resource.h> | 6 | //#include <qpe/resource.h> |
6 | 7 | ||
7 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 8 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
8 | :QListViewItem(parent,item),mail_data() | 9 | :QListViewItem(parent,item),mail_data() |
9 | { | 10 | { |
10 | } | 11 | } |
11 | 12 | ||
12 | void MailListViewItem::showEntry() | 13 | void MailListViewItem::showEntry() |
13 | { | 14 | { |
14 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { | 15 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { |
15 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); | 16 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); |
16 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { | 17 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { |
17 | /* I think it looks nicer if there are not such a log of icons but only on mails | 18 | /* I think it looks nicer if there are not such a log of icons but only on mails |
18 | replied or new - Alwin*/ | 19 | replied or new - Alwin*/ |
19 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); | 20 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); |
20 | } else { | 21 | } else { |
21 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); | 22 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); |
22 | } | 23 | } |
23 | double s = mail_data->Msgsize(); | 24 | double s = mail_data->Msgsize(); |
24 | int w = 0; | 25 | int w = 0; |
25 | s/=1024; | 26 | s/=1024; |
26 | if (s>999.0) { | 27 | if (s>999.0) { |
27 | s/=1024.0; | 28 | s/=1024.0; |
28 | ++w; | 29 | ++w; |
29 | } | 30 | } |
30 | QString fsort; | 31 | QString fsort; |
31 | fsort.sprintf( "%.2f", s ); | 32 | fsort.sprintf( "%.2f", s ); |
32 | QString fsize = QString::number( s, 'f', 2 ); | 33 | QString fsize = QString::number( s, 'f', 2 ); |
33 | // 1.23 | 34 | // 1.23 |
34 | // 11.23 | 35 | // 11.23 |
35 | // 111.23 | 36 | // 111.23 |
36 | // 999.23 maxlen | 37 | // 999.23 maxlen |
37 | switch(fsize.length() ) { | 38 | switch(fsize.length() ) { |
38 | case 4: | 39 | case 4: |
39 | fsort = "00" + fsize ; | 40 | fsort = "00" + fsize ; |
40 | break; | 41 | break; |
41 | case 5: | 42 | case 5: |
42 | fsort = "0" + fsize ; | 43 | fsort = "0" + fsize ; |
43 | break; | 44 | break; |
44 | default: | 45 | default: |
45 | fsort = fsize ; | 46 | fsort = fsize ; |
46 | break; | 47 | break; |
47 | 48 | ||
48 | } | 49 | } |
49 | if ( w == 0 ) { | 50 | if ( w == 0 ) { |
50 | setText(3, fsize + "kB" ); | 51 | setText(3, fsize + "kB" ); |
51 | mKeyMap.insert(3, "k" + fsort); | 52 | mKeyMap.insert(3, "k" + fsort); |
52 | //setText(3, "kB" + fsort ); // test only | 53 | //setText(3, "kB" + fsort ); // test only |
53 | } else { | 54 | } else { |
54 | //setText(3, fsize + "MB"); | 55 | //setText(3, fsize + "MB"); |
55 | mKeyMap.insert(4, "M" +fsort ); | 56 | mKeyMap.insert(4, "M" +fsort ); |
56 | } | 57 | } |
57 | setText(1,mail_data->getSubject()); | 58 | setText(1,mail_data->getSubject()); |
58 | setText(2,mail_data->getFrom()); | 59 | setText(2,mail_data->getFrom()); |
59 | 60 | ||
60 | QString date = mail_data->getDate(); | 61 | QString date = mail_data->getDate(); |
61 | 62 | ||
62 | int kom = date.find( ",")+2; | 63 | int kom = date.find( ",")+2; |
63 | if ( kom == 1 ) | 64 | if ( kom == 1 ) |
64 | kom = 0; | 65 | kom = 0; |
65 | if ( date.mid(kom,1) == " ") | 66 | if ( date.mid(kom,1) == " ") |
66 | ++kom; | 67 | ++kom; |
67 | if ( date.mid(kom+1,1) == " " ) | 68 | if ( date.mid(kom+1,1) == " " ) |
68 | date = "0" + date.mid( kom ); | 69 | date = "0" + date.mid( kom ); |
69 | else if ( kom ) | 70 | else if ( kom ) |
70 | date = date.mid( kom ); | 71 | date = date.mid( kom ); |
71 | if ( kom || date.mid(2,1 ) == " ") { | 72 | if ( kom || date.mid(2,1 ) == " ") { |
72 | QString mon = date.mid(3,3); | 73 | QString mon = date.mid(3,3); |
73 | QString so = 00; | 74 | QString so = 00; |
74 | if ( mon == "Jan" ) | 75 | if ( mon == "Jan" ) |
75 | so = "01"; | 76 | so = "01"; |
76 | else if ( mon == "Feb" ) | 77 | else if ( mon == "Feb" ) |
77 | so = "02"; | 78 | so = "02"; |
78 | else if ( mon == "Mar" ) | 79 | else if ( mon == "Mar" ) |
79 | so = "03"; | 80 | so = "03"; |
80 | else if ( mon == "Apr" ) | 81 | else if ( mon == "Apr" ) |
81 | so = "04"; | 82 | so = "04"; |
82 | else if ( mon == "May" ) | 83 | else if ( mon == "May" ) |
83 | so = "05"; | 84 | so = "05"; |
84 | else if ( mon == "Jun" ) | 85 | else if ( mon == "Jun" ) |
85 | so = "06"; | 86 | so = "06"; |
86 | else if ( mon == "Jul" ) | 87 | else if ( mon == "Jul" ) |
87 | so = "07"; | 88 | so = "07"; |
88 | else if ( mon == "Aug" ) | 89 | else if ( mon == "Aug" ) |
89 | so = "08"; | 90 | so = "08"; |
90 | else if ( mon == "Sep" ) | 91 | else if ( mon == "Sep" ) |
91 | so = "09"; | 92 | so = "09"; |
92 | else if ( mon == "Oct" ) | 93 | else if ( mon == "Oct" ) |
93 | so = "10"; | 94 | so = "10"; |
94 | else if ( mon == "Nov" ) | 95 | else if ( mon == "Nov" ) |
95 | so = "11"; | 96 | so = "11"; |
96 | else if ( mon == "Dec" ) | 97 | else if ( mon == "Dec" ) |
diff --git a/kmicromail/mailistviewitem.h b/kmicromail/mailistviewitem.h index cf8040b..0fd44d3 100644 --- a/kmicromail/mailistviewitem.h +++ b/kmicromail/mailistviewitem.h | |||
@@ -1,26 +1,27 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | #ifndef __MAILLISTVIEWITEM_H | 2 | #ifndef __MAILLISTVIEWITEM_H |
2 | #define __MAILLISTVIEWITEM_H | 3 | #define __MAILLISTVIEWITEM_H |
3 | 4 | ||
4 | #include <qlistview.h> | 5 | #include <qlistview.h> |
5 | #include <libmailwrapper/mailtypes.h> | 6 | #include <libmailwrapper/mailtypes.h> |
6 | #include <libmailwrapper/maildefines.h> | 7 | #include <libmailwrapper/maildefines.h> |
7 | 8 | ||
8 | class MailListViewItem:public QListViewItem | 9 | class MailListViewItem:public QListViewItem |
9 | { | 10 | { |
10 | public: | 11 | public: |
11 | MailListViewItem(QListView * parent, MailListViewItem * after ); | 12 | MailListViewItem(QListView * parent, MailListViewItem * after ); |
12 | virtual ~MailListViewItem(){} | 13 | virtual ~MailListViewItem(){} |
13 | 14 | ||
14 | void storeData(const RecMailP&data); | 15 | void storeData(const RecMailP&data); |
15 | const RecMailP&data()const; | 16 | const RecMailP&data()const; |
16 | void showEntry(); | 17 | void showEntry(); |
17 | MAILLIB::ATYPE wrapperType(); | 18 | MAILLIB::ATYPE wrapperType(); |
18 | QString key(int column, bool) const; | 19 | QString key(int column, bool) const; |
19 | void setSortKey(int column,const QString &key); | 20 | void setSortKey(int column,const QString &key); |
20 | protected: | 21 | protected: |
21 | RecMailP mail_data; | 22 | RecMailP mail_data; |
22 | private: | 23 | private: |
23 | QMap<int,QString> mKeyMap; | 24 | QMap<int,QString> mKeyMap; |
24 | }; | 25 | }; |
25 | 26 | ||
26 | #endif | 27 | #endif |
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index 8a093c6..22f1200 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp | |||
@@ -1,57 +1,58 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | 2 | ||
2 | #ifndef DESKTOP_VERSION | 3 | #ifndef DESKTOP_VERSION |
3 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
4 | #include <stdlib.h> | 5 | #include <stdlib.h> |
5 | #else | 6 | #else |
6 | #include <qapplication.h> | 7 | #include <qapplication.h> |
7 | #include <qstring.h> | 8 | #include <qstring.h> |
8 | #include <qwindowsstyle.h> | 9 | #include <qwindowsstyle.h> |
9 | #include <qplatinumstyle.h> | 10 | #include <qplatinumstyle.h> |
10 | #include <qsgistyle.h> | 11 | #include <qsgistyle.h> |
11 | #endif | 12 | #endif |
12 | #include "opiemail.h" | 13 | #include "opiemail.h" |
13 | #include <qdir.h> | 14 | #include <qdir.h> |
14 | #include <kstandarddirs.h> | 15 | #include <kstandarddirs.h> |
15 | #include <kglobal.h> | 16 | #include <kglobal.h> |
16 | #include <stdio.h> | 17 | #include <stdio.h> |
17 | #include "mainwindow.h" | 18 | #include "mainwindow.h" |
18 | 19 | ||
19 | using namespace Opie::Core; | 20 | using namespace Opie::Core; |
20 | int main( int argc, char **argv ) { | 21 | int main( int argc, char **argv ) { |
21 | 22 | ||
22 | #ifndef DESKTOP_VERSION | 23 | #ifndef DESKTOP_VERSION |
23 | QPEApplication a( argc, argv ); | 24 | QPEApplication a( argc, argv ); |
24 | a.setKeepRunning (); | 25 | a.setKeepRunning (); |
25 | #else | 26 | #else |
26 | QApplication a( argc, argv ); | 27 | QApplication a( argc, argv ); |
27 | QApplication::setStyle( new QPlatinumStyle ()); | 28 | QApplication::setStyle( new QPlatinumStyle ()); |
28 | #endif | 29 | #endif |
29 | 30 | ||
30 | KGlobal::setAppName( "kmicromail" ); | 31 | KGlobal::setAppName( "kmicromail" ); |
31 | QString fileName ; | 32 | QString fileName ; |
32 | #ifndef DESKTOP_VERSION | 33 | #ifndef DESKTOP_VERSION |
33 | fileName = getenv("QPEDIR"); | 34 | fileName = getenv("QPEDIR"); |
34 | if ( QApplication::desktop()->width() > 320 ) | 35 | if ( QApplication::desktop()->width() > 320 ) |
35 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); | 36 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/icons22/"); |
36 | else | 37 | else |
37 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); | 38 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kmicromail/"); |
38 | #else | 39 | #else |
39 | fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; | 40 | fileName = qApp->applicationDirPath () + "/kdepim/kmicromail/"; |
40 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 41 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
41 | #endif | 42 | #endif |
42 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); | 43 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kmicromail"))); |
43 | OpieMail mw; | 44 | OpieMail mw; |
44 | #ifndef DESKTOP_VERSION | 45 | #ifndef DESKTOP_VERSION |
45 | //qDebug("CONNECT "); | 46 | //qDebug("CONNECT "); |
46 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); | 47 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); |
47 | a.showMainWidget(&mw ); | 48 | a.showMainWidget(&mw ); |
48 | #else | 49 | #else |
49 | a.setMainWidget(&mw ); | 50 | a.setMainWidget(&mw ); |
50 | mw.show(); | 51 | mw.show(); |
51 | //m.resize( 800, 600 ); | 52 | //m.resize( 800, 600 ); |
52 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 53 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
53 | #endif | 54 | #endif |
54 | int rv = a.exec(); | 55 | int rv = a.exec(); |
55 | return rv; | 56 | return rv; |
56 | 57 | ||
57 | } | 58 | } |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index e020297..2de5b40 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,96 +1,98 @@ | |||
1 | |||
2 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | #include <qlabel.h> | 3 | #include <qlabel.h> |
2 | #include <qvbox.h> | 4 | #include <qvbox.h> |
3 | #include <qheader.h> | 5 | #include <qheader.h> |
4 | #include <qtimer.h> | 6 | #include <qtimer.h> |
5 | #include <qlayout.h> | 7 | #include <qlayout.h> |
6 | #include <kdialog.h> | 8 | #include <kdialog.h> |
7 | #include <kiconloader.h> | 9 | #include <kiconloader.h> |
8 | #include <kapplication.h> | 10 | #include <kapplication.h> |
9 | 11 | ||
10 | #ifndef DESKTOP_VERSION | 12 | #ifndef DESKTOP_VERSION |
11 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
12 | #endif | 14 | #endif |
13 | #include "defines.h" | 15 | #include "defines.h" |
14 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
15 | #include <KDGanttMinimizeSplitter.h> | 17 | #include <KDGanttMinimizeSplitter.h> |
16 | 18 | ||
17 | 19 | ||
18 | #include <kabc/stdaddressbook.h> | 20 | #include <kabc/stdaddressbook.h> |
19 | 21 | ||
20 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
21 | : QMainWindow( parent, name ) //, flags ) | 23 | : QMainWindow( parent, name ) //, flags ) |
22 | { | 24 | { |
23 | setCaption( tr( "OpieMail/Pi" ) ); | 25 | setCaption( tr( "OpieMail/Pi" ) ); |
24 | setToolBarsMovable( false ); | 26 | setToolBarsMovable( false ); |
25 | KABC::StdAddressBook::self(); | 27 | KABC::StdAddressBook::self(); |
26 | toolBar = new QToolBar( this ); | 28 | toolBar = new QToolBar( this ); |
27 | menuBar = new QMenuBar( toolBar ); | 29 | menuBar = new QMenuBar( toolBar ); |
28 | mailMenu = new QPopupMenu( menuBar ); | 30 | mailMenu = new QPopupMenu( menuBar ); |
29 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
30 | settingsMenu = new QPopupMenu( menuBar ); | 32 | settingsMenu = new QPopupMenu( menuBar ); |
31 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
32 | 34 | ||
33 | addToolBar( toolBar ); | 35 | addToolBar( toolBar ); |
34 | toolBar->setHorizontalStretchable( true ); | 36 | toolBar->setHorizontalStretchable( true ); |
35 | 37 | ||
36 | 38 | ||
37 | 39 | ||
38 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), | 40 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), |
39 | 0, 0, this ); | 41 | 0, 0, this ); |
40 | composeMail->addTo( toolBar ); | 42 | composeMail->addTo( toolBar ); |
41 | composeMail->addTo( mailMenu ); | 43 | composeMail->addTo( mailMenu ); |
42 | 44 | ||
43 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , | 45 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , |
44 | 0, 0, this ); | 46 | 0, 0, this ); |
45 | sendQueued->addTo( toolBar ); | 47 | sendQueued->addTo( toolBar ); |
46 | sendQueued->addTo( mailMenu ); | 48 | sendQueued->addTo( mailMenu ); |
47 | 49 | ||
48 | /* | 50 | /* |
49 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 51 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
50 | 0, 0, this ); | 52 | 0, 0, this ); |
51 | syncFolders->addTo( toolBar ); | 53 | syncFolders->addTo( toolBar ); |
52 | syncFolders->addTo( mailMenu ); | 54 | syncFolders->addTo( mailMenu ); |
53 | */ | 55 | */ |
54 | 56 | ||
55 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , | 57 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , |
56 | 0, 0, this, 0, true ); | 58 | 0, 0, this, 0, true ); |
57 | showFolders->addTo( toolBar ); | 59 | showFolders->addTo( toolBar ); |
58 | showFolders->addTo( mailMenu ); | 60 | showFolders->addTo( mailMenu ); |
59 | showFolders->setOn( true ); | 61 | showFolders->setOn( true ); |
60 | connect(showFolders, SIGNAL( toggled(bool) ), | 62 | connect(showFolders, SIGNAL( toggled(bool) ), |
61 | SLOT( slotShowFolders(bool) ) ); | 63 | SLOT( slotShowFolders(bool) ) ); |
62 | 64 | ||
63 | /* | 65 | /* |
64 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), | 66 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), |
65 | 0, 0, this ); | 67 | 0, 0, this ); |
66 | searchMails->addTo( toolBar ); | 68 | searchMails->addTo( toolBar ); |
67 | searchMails->addTo( mailMenu ); | 69 | searchMails->addTo( mailMenu ); |
68 | */ | 70 | */ |
69 | 71 | ||
70 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 72 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
71 | deleteMails->addTo( toolBar ); | 73 | deleteMails->addTo( toolBar ); |
72 | deleteMails->addTo( mailMenu ); | 74 | deleteMails->addTo( mailMenu ); |
73 | connect( deleteMails, SIGNAL( activated() ), | 75 | connect( deleteMails, SIGNAL( activated() ), |
74 | SLOT( slotDeleteMail() ) ); | 76 | SLOT( slotDeleteMail() ) ); |
75 | 77 | ||
76 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , | 78 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , |
77 | 0, 0, this ); | 79 | 0, 0, this ); |
78 | editSettings->addTo( settingsMenu ); | 80 | editSettings->addTo( settingsMenu ); |
79 | connect( editSettings, SIGNAL( activated() ), | 81 | connect( editSettings, SIGNAL( activated() ), |
80 | SLOT( slotEditSettings() ) ); | 82 | SLOT( slotEditSettings() ) ); |
81 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , | 83 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , |
82 | 0, 0, this ); | 84 | 0, 0, this ); |
83 | editAccounts->addTo( settingsMenu ); | 85 | editAccounts->addTo( settingsMenu ); |
84 | 86 | ||
85 | //setCentralWidget( view ); | 87 | //setCentralWidget( view ); |
86 | 88 | ||
87 | QVBox* wrapperBox = new QVBox( this ); | 89 | QVBox* wrapperBox = new QVBox( this ); |
88 | setCentralWidget( wrapperBox ); | 90 | setCentralWidget( wrapperBox ); |
89 | 91 | ||
90 | // QWidget *view = new QWidget( wrapperBox ); | 92 | // QWidget *view = new QWidget( wrapperBox ); |
91 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); | 93 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); |
92 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 94 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
93 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 95 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
94 | 96 | ||
95 | folderView = new AccountView( split ); | 97 | folderView = new AccountView( split ); |
96 | folderView->header()->hide(); | 98 | folderView->header()->hide(); |
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h index d6dc6cc..f5b81aa 100644 --- a/kmicromail/mainwindow.h +++ b/kmicromail/mainwindow.h | |||
@@ -1,59 +1,61 @@ | |||
1 | |||
2 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | #ifndef MAINWINDOW_H | 3 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 4 | #define MAINWINDOW_H |
3 | 5 | ||
4 | #include <qmainwindow.h> | 6 | #include <qmainwindow.h> |
5 | #include <qlistview.h> | 7 | #include <qlistview.h> |
6 | #include <qaction.h> | 8 | #include <qaction.h> |
7 | 9 | ||
8 | #include <qtoolbar.h> | 10 | #include <qtoolbar.h> |
9 | #include <qmenubar.h> | 11 | #include <qmenubar.h> |
10 | 12 | ||
11 | #include "accountview.h" | 13 | #include "accountview.h" |
12 | #include "statuswidget.h" | 14 | #include "statuswidget.h" |
13 | 15 | ||
14 | #include <libmailwrapper/mailtypes.h> | 16 | #include <libmailwrapper/mailtypes.h> |
15 | #include <opie2/osmartpointer.h> | 17 | #include <opie2/osmartpointer.h> |
16 | 18 | ||
17 | class RecMail; | 19 | class RecMail; |
18 | 20 | ||
19 | class MainWindow : public QMainWindow | 21 | class MainWindow : public QMainWindow |
20 | { | 22 | { |
21 | Q_OBJECT | 23 | Q_OBJECT |
22 | 24 | ||
23 | public: | 25 | public: |
24 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 26 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
25 | virtual ~MainWindow(); | 27 | virtual ~MainWindow(); |
26 | 28 | ||
27 | public slots: | 29 | public slots: |
28 | virtual void slotAdjustColumns(); | 30 | virtual void slotAdjustColumns(); |
29 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 31 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
30 | virtual void slotComposeMail(); | 32 | virtual void slotComposeMail(); |
31 | 33 | ||
32 | protected slots: | 34 | protected slots: |
33 | virtual void slotSendQueued(); | 35 | virtual void slotSendQueued(); |
34 | virtual void slotEditAccounts(); | 36 | virtual void slotEditAccounts(); |
35 | virtual void slotShowFolders( bool show ); | 37 | virtual void slotShowFolders( bool show ); |
36 | virtual void refreshMailView(const QValueList<RecMailP>&); | 38 | virtual void refreshMailView(const QValueList<RecMailP>&); |
37 | virtual void displayMail(); | 39 | virtual void displayMail(); |
38 | virtual void slotDeleteMail(); | 40 | virtual void slotDeleteMail(); |
39 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 41 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
40 | virtual void slotAdjustLayout(); | 42 | virtual void slotAdjustLayout(); |
41 | virtual void slotEditSettings(); | 43 | virtual void slotEditSettings(); |
42 | virtual void mailLeftClicked( QListViewItem * ); | 44 | virtual void mailLeftClicked( QListViewItem * ); |
43 | void showLicence(); | 45 | void showLicence(); |
44 | void showAbout(); | 46 | void showAbout(); |
45 | void showEtpanLicence(); | 47 | void showEtpanLicence(); |
46 | 48 | ||
47 | protected: | 49 | protected: |
48 | QToolBar *toolBar; | 50 | QToolBar *toolBar; |
49 | StatusWidget *statusWidget; | 51 | StatusWidget *statusWidget; |
50 | QMenuBar *menuBar; | 52 | QMenuBar *menuBar; |
51 | QPopupMenu *mailMenu, *settingsMenu; | 53 | QPopupMenu *mailMenu, *settingsMenu; |
52 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, | 54 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, |
53 | *editSettings, *editAccounts, *syncFolders; | 55 | *editSettings, *editAccounts, *syncFolders; |
54 | AccountView *folderView; | 56 | AccountView *folderView; |
55 | QListView *mailView; | 57 | QListView *mailView; |
56 | //QBoxLayout *layout; | 58 | //QBoxLayout *layout; |
57 | }; | 59 | }; |
58 | 60 | ||
59 | #endif | 61 | #endif |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 70fbcb2..d522ad0 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,96 +1,97 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | 2 | ||
2 | #include "settingsdialog.h" | 3 | #include "settingsdialog.h" |
3 | #include "opiemail.h" | 4 | #include "opiemail.h" |
4 | #include "editaccounts.h" | 5 | #include "editaccounts.h" |
5 | #include "composemail.h" | 6 | #include "composemail.h" |
6 | #include "mailistviewitem.h" | 7 | #include "mailistviewitem.h" |
7 | #include "viewmail.h" | 8 | #include "viewmail.h" |
8 | #include "selectstore.h" | 9 | #include "selectstore.h" |
9 | #include "selectsmtp.h" | 10 | #include "selectsmtp.h" |
10 | 11 | ||
11 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
12 | 13 | ||
13 | #include <qpe/qpeapplication.h> | 14 | #include <qpe/qpeapplication.h> |
14 | #include <libmailwrapper/smtpwrapper.h> | 15 | #include <libmailwrapper/smtpwrapper.h> |
15 | #include <libmailwrapper/mailtypes.h> | 16 | #include <libmailwrapper/mailtypes.h> |
16 | #include <libmailwrapper/abstractmail.h> | 17 | #include <libmailwrapper/abstractmail.h> |
17 | /* OPIE */ | 18 | /* OPIE */ |
18 | //#include <qpe/resource.h> | 19 | //#include <qpe/resource.h> |
19 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
20 | 21 | ||
21 | /* QT */ | 22 | /* QT */ |
22 | 23 | ||
23 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
24 | 25 | ||
25 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 26 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) |
26 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 27 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
27 | { | 28 | { |
28 | settings = new Settings(); | 29 | settings = new Settings(); |
29 | 30 | ||
30 | folderView->populate( settings->getAccounts() ); | 31 | folderView->populate( settings->getAccounts() ); |
31 | 32 | ||
32 | } | 33 | } |
33 | 34 | ||
34 | OpieMail::~OpieMail() | 35 | OpieMail::~OpieMail() |
35 | { | 36 | { |
36 | if (settings) delete settings; | 37 | if (settings) delete settings; |
37 | } | 38 | } |
38 | 39 | ||
39 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 40 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
40 | { | 41 | { |
41 | 42 | ||
42 | } | 43 | } |
43 | #include <stdlib.h> | 44 | #include <stdlib.h> |
44 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 45 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
45 | { | 46 | { |
46 | // copied from old mail2 | 47 | // copied from old mail2 |
47 | static int ii = 0; | 48 | static int ii = 0; |
48 | 49 | ||
49 | // block second call | 50 | // block second call |
50 | if ( ii < 2 ) { | 51 | if ( ii < 2 ) { |
51 | ++ii; | 52 | ++ii; |
52 | if ( ii > 1 ) { | 53 | if ( ii > 1 ) { |
53 | qDebug("qcop call blocked "); | 54 | qDebug("qcop call blocked "); |
54 | return; | 55 | return; |
55 | } | 56 | } |
56 | } | 57 | } |
57 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 58 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
58 | if (msg == "writeMail(QString,QString)") | 59 | if (msg == "writeMail(QString,QString)") |
59 | { | 60 | { |
60 | QDataStream stream(data,IO_ReadOnly); | 61 | QDataStream stream(data,IO_ReadOnly); |
61 | QString name, email; | 62 | QString name, email; |
62 | stream >> name >> email; | 63 | stream >> name >> email; |
63 | // removing the whitespaces at beginning and end is needed! | 64 | // removing the whitespaces at beginning and end is needed! |
64 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 65 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
65 | } | 66 | } |
66 | else if (msg == "newMail()") | 67 | else if (msg == "newMail()") |
67 | { | 68 | { |
68 | slotComposeMail(); | 69 | slotComposeMail(); |
69 | } | 70 | } |
70 | else if (msg == "newMail(QString)") | 71 | else if (msg == "newMail(QString)") |
71 | { | 72 | { |
72 | QDataStream stream(data,IO_ReadOnly); | 73 | QDataStream stream(data,IO_ReadOnly); |
73 | QString nameemail; | 74 | QString nameemail; |
74 | stream >> nameemail; | 75 | stream >> nameemail; |
75 | // the format is | 76 | // the format is |
76 | // NAME <EMAIL>:SUBJECT | 77 | // NAME <EMAIL>:SUBJECT |
77 | //qDebug("message %s ", nameemail.latin1()); | 78 | //qDebug("message %s ", nameemail.latin1()); |
78 | 79 | ||
79 | slotwriteMail2( nameemail ); | 80 | slotwriteMail2( nameemail ); |
80 | } | 81 | } |
81 | } | 82 | } |
82 | void OpieMail::slotwriteMail2(const QString& namemail ) | 83 | void OpieMail::slotwriteMail2(const QString& namemail ) |
83 | { | 84 | { |
84 | // qDebug("OpieMail::slotwriteMail2 "); | 85 | // qDebug("OpieMail::slotwriteMail2 "); |
85 | qApp->processEvents(); | 86 | qApp->processEvents(); |
86 | ComposeMail compose( settings, this, 0, true ); | 87 | ComposeMail compose( settings, this, 0, true ); |
87 | if ( !namemail.isEmpty() ) { | 88 | if ( !namemail.isEmpty() ) { |
88 | QString to = namemail; | 89 | QString to = namemail; |
89 | if ( namemail.find( " <") > 1 ) { | 90 | if ( namemail.find( " <") > 1 ) { |
90 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 91 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
91 | } else | 92 | } else |
92 | if ( namemail.find( "<") > 1 ) { | 93 | if ( namemail.find( "<") > 1 ) { |
93 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 94 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
94 | } | 95 | } |
95 | int sub = to.find( ">:"); | 96 | int sub = to.find( ">:"); |
96 | if ( sub > 0 ) { | 97 | if ( sub > 0 ) { |
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 703711d..67b77f8 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -1,96 +1,97 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | #include "composemail.h" | 2 | #include "composemail.h" |
2 | #include "viewmail.h" | 3 | #include "viewmail.h" |
3 | 4 | ||
4 | #include <libmailwrapper/settings.h> | 5 | #include <libmailwrapper/settings.h> |
5 | #include <libmailwrapper/abstractmail.h> | 6 | #include <libmailwrapper/abstractmail.h> |
6 | #include <libmailwrapper/mailtypes.h> | 7 | #include <libmailwrapper/mailtypes.h> |
7 | #include <kapplication.h> | 8 | #include <kapplication.h> |
8 | 9 | ||
9 | /* OPIE */ | 10 | /* OPIE */ |
10 | //#include <opie2/odebug.h> | 11 | //#include <opie2/odebug.h> |
11 | //#include <opie2/ofiledialog.h> | 12 | //#include <opie2/ofiledialog.h> |
12 | //#include <opie2/oimagescrollview.h> | 13 | //#include <opie2/oimagescrollview.h> |
13 | 14 | ||
14 | #include <kfiledialog.h> | 15 | #include <kfiledialog.h> |
15 | #include <kdialog.h> | 16 | #include <kdialog.h> |
16 | 17 | ||
17 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
18 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
19 | 20 | ||
20 | /* QT */ | 21 | /* QT */ |
21 | #include <qtextbrowser.h> | 22 | #include <qtextbrowser.h> |
22 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
23 | #include <qtextstream.h> | 24 | #include <qtextstream.h> |
24 | #include <qaction.h> | 25 | #include <qaction.h> |
25 | #include <qpopupmenu.h> | 26 | #include <qpopupmenu.h> |
26 | #include <qfile.h> | 27 | #include <qfile.h> |
27 | #include <qlayout.h> | 28 | #include <qlayout.h> |
28 | 29 | ||
29 | //using namespace Opie::Ui; | 30 | //using namespace Opie::Ui; |
30 | //using namespace Opie::Core; | 31 | //using namespace Opie::Core; |
31 | 32 | ||
32 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 33 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
33 | const QString&fsize,int num,const QValueList<int>&path) | 34 | const QString&fsize,int num,const QValueList<int>&path) |
34 | : QListViewItem(parent,after),_partNum(num) | 35 | : QListViewItem(parent,after),_partNum(num) |
35 | { | 36 | { |
36 | _path=path; | 37 | _path=path; |
37 | setText(0, mime); | 38 | setText(0, mime); |
38 | setText(1, desc); | 39 | setText(1, desc); |
39 | setText(2, file); | 40 | setText(2, file); |
40 | setText(3, fsize); | 41 | setText(3, fsize); |
41 | } | 42 | } |
42 | 43 | ||
43 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 44 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
44 | const QString&fsize,int num,const QValueList<int>&path) | 45 | const QString&fsize,int num,const QValueList<int>&path) |
45 | : QListViewItem(parent,after),_partNum(num) | 46 | : QListViewItem(parent,after),_partNum(num) |
46 | { | 47 | { |
47 | _path=path; | 48 | _path=path; |
48 | setText(0, mime); | 49 | setText(0, mime); |
49 | setText(1, desc); | 50 | setText(1, desc); |
50 | setText(2, file); | 51 | setText(2, file); |
51 | setText(3, fsize); | 52 | setText(3, fsize); |
52 | } | 53 | } |
53 | 54 | ||
54 | bool AttachItem::isParentof(const QValueList<int>&path) | 55 | bool AttachItem::isParentof(const QValueList<int>&path) |
55 | { | 56 | { |
56 | /* if not set, then no parent */ | 57 | /* if not set, then no parent */ |
57 | if (path.count()==0||_path.count()==0) return false; | 58 | if (path.count()==0||_path.count()==0) return false; |
58 | /* the parent must have one digit less then a child */ | 59 | /* the parent must have one digit less then a child */ |
59 | if (path.count()!=_path.count()+1) return false; | 60 | if (path.count()!=_path.count()+1) return false; |
60 | for (unsigned int i=0; i < _path.count();++i) | 61 | for (unsigned int i=0; i < _path.count();++i) |
61 | { | 62 | { |
62 | if (_path[i]!=path[i]) return false; | 63 | if (_path[i]!=path[i]) return false; |
63 | } | 64 | } |
64 | return true; | 65 | return true; |
65 | } | 66 | } |
66 | 67 | ||
67 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) | 68 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) |
68 | { | 69 | { |
69 | QListViewItemIterator it( attachments ); | 70 | QListViewItemIterator it( attachments ); |
70 | for ( ; it.current(); ++it ) | 71 | for ( ; it.current(); ++it ) |
71 | { | 72 | { |
72 | AttachItem*ati = (AttachItem*)it.current(); | 73 | AttachItem*ati = (AttachItem*)it.current(); |
73 | if (ati->isParentof(path)) return ati; | 74 | if (ati->isParentof(path)) return ati; |
74 | } | 75 | } |
75 | return 0; | 76 | return 0; |
76 | } | 77 | } |
77 | 78 | ||
78 | AttachItem* ViewMail::lastChild(AttachItem*parent) | 79 | AttachItem* ViewMail::lastChild(AttachItem*parent) |
79 | { | 80 | { |
80 | if (!parent) return 0; | 81 | if (!parent) return 0; |
81 | AttachItem* item = (AttachItem*)parent->firstChild(); | 82 | AttachItem* item = (AttachItem*)parent->firstChild(); |
82 | if (!item) return item; | 83 | if (!item) return item; |
83 | AttachItem*temp=0; | 84 | AttachItem*temp=0; |
84 | while( (temp=(AttachItem*)item->nextSibling())) | 85 | while( (temp=(AttachItem*)item->nextSibling())) |
85 | { | 86 | { |
86 | item = temp; | 87 | item = temp; |
87 | } | 88 | } |
88 | return item; | 89 | return item; |
89 | } | 90 | } |
90 | 91 | ||
91 | void ViewMail::setBody(const RecBodyP&body ) | 92 | void ViewMail::setBody(const RecBodyP&body ) |
92 | { | 93 | { |
93 | 94 | ||
94 | m_body = body; | 95 | m_body = body; |
95 | m_mail[2] = body->Bodytext(); | 96 | m_mail[2] = body->Bodytext(); |
96 | attachbutton->setEnabled(body->Parts().count()>0); | 97 | attachbutton->setEnabled(body->Parts().count()>0); |
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp index 584a0ac..705b57f 100644 --- a/kmicromail/viewmailbase.cpp +++ b/kmicromail/viewmailbase.cpp | |||
@@ -1,91 +1,92 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | #include <qtextbrowser.h> | 2 | #include <qtextbrowser.h> |
2 | #include <qlistview.h> | 3 | #include <qlistview.h> |
3 | #include <qaction.h> | 4 | #include <qaction.h> |
4 | #include <qlabel.h> | 5 | #include <qlabel.h> |
5 | #include <qvbox.h> | 6 | #include <qvbox.h> |
6 | 7 | ||
7 | #include <qtoolbar.h> | 8 | #include <qtoolbar.h> |
8 | #include <qmenubar.h> | 9 | #include <qmenubar.h> |
9 | #include <kiconloader.h> | 10 | #include <kiconloader.h> |
10 | //#include <qpe/resource.h> | 11 | //#include <qpe/resource.h> |
11 | 12 | ||
12 | #include "viewmailbase.h" | 13 | #include "viewmailbase.h" |
13 | //#include "opendiag.h" | 14 | //#include "opendiag.h" |
14 | 15 | ||
15 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) | 16 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) |
16 | : QMainWindow(parent, name, fl) | 17 | : QMainWindow(parent, name, fl) |
17 | { | 18 | { |
18 | 19 | ||
19 | setToolBarsMovable(false); | 20 | setToolBarsMovable(false); |
20 | 21 | ||
21 | toolbar = new QToolBar(this); | 22 | toolbar = new QToolBar(this); |
22 | menubar = new QMenuBar( toolbar ); | 23 | menubar = new QMenuBar( toolbar ); |
23 | mailmenu = new QPopupMenu( menubar ); | 24 | mailmenu = new QPopupMenu( menubar ); |
24 | menubar->insertItem( tr( "Mail" ), mailmenu ); | 25 | menubar->insertItem( tr( "Mail" ), mailmenu ); |
25 | 26 | ||
26 | toolbar->setHorizontalStretchable(true); | 27 | toolbar->setHorizontalStretchable(true); |
27 | addToolBar(toolbar); | 28 | addToolBar(toolbar); |
28 | 29 | ||
29 | reply = new QAction(tr("Reply"),SmallIcon("reply"), 0, 0, this); | 30 | reply = new QAction(tr("Reply"),SmallIcon("reply"), 0, 0, this); |
30 | reply->addTo(toolbar); | 31 | reply->addTo(toolbar); |
31 | reply->addTo(mailmenu); | 32 | reply->addTo(mailmenu); |
32 | 33 | ||
33 | forward = new QAction(tr("Forward"),SmallIcon("forward"), 0, 0, this); | 34 | forward = new QAction(tr("Forward"),SmallIcon("forward"), 0, 0, this); |
34 | forward->addTo(toolbar); | 35 | forward->addTo(toolbar); |
35 | forward->addTo(mailmenu); | 36 | forward->addTo(mailmenu); |
36 | 37 | ||
37 | attachbutton = new QAction(tr("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); | 38 | attachbutton = new QAction(tr("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); |
38 | attachbutton->addTo(toolbar); | 39 | attachbutton->addTo(toolbar); |
39 | attachbutton->addTo(mailmenu); | 40 | attachbutton->addTo(mailmenu); |
40 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); | 41 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); |
41 | 42 | ||
42 | 43 | ||
43 | showHtml = new QAction( tr( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); | 44 | showHtml = new QAction( tr( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); |
44 | showHtml->addTo( toolbar ); | 45 | showHtml->addTo( toolbar ); |
45 | showHtml->addTo( mailmenu ); | 46 | showHtml->addTo( mailmenu ); |
46 | 47 | ||
47 | deleteMail = new QAction(tr("Delete Mail"),SmallIcon("trash"), 0, 0, this); | 48 | deleteMail = new QAction(tr("Delete Mail"),SmallIcon("trash"), 0, 0, this); |
48 | deleteMail->addTo(toolbar); | 49 | deleteMail->addTo(toolbar); |
49 | deleteMail->addTo(mailmenu); | 50 | deleteMail->addTo(mailmenu); |
50 | closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); | 51 | closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); |
51 | QLabel *spacer = new QLabel(toolbar); | 52 | QLabel *spacer = new QLabel(toolbar); |
52 | spacer->setBackgroundMode(QWidget::PaletteButton); | 53 | spacer->setBackgroundMode(QWidget::PaletteButton); |
53 | toolbar->setStretchableWidget(spacer); | 54 | toolbar->setStretchableWidget(spacer); |
54 | closeMail->addTo(toolbar); | 55 | closeMail->addTo(toolbar); |
55 | closeMail->addTo(mailmenu); | 56 | closeMail->addTo(mailmenu); |
56 | QVBox *view = new QVBox(this); | 57 | QVBox *view = new QVBox(this); |
57 | setCentralWidget(view); | 58 | setCentralWidget(view); |
58 | 59 | ||
59 | attachments = new QListView(view); | 60 | attachments = new QListView(view); |
60 | attachments->setMinimumHeight(90); | 61 | attachments->setMinimumHeight(90); |
61 | attachments->setMaximumHeight(90); | 62 | attachments->setMaximumHeight(90); |
62 | attachments->setAllColumnsShowFocus(true); | 63 | attachments->setAllColumnsShowFocus(true); |
63 | attachments->addColumn("Mime Type", 60); | 64 | attachments->addColumn("Mime Type", 60); |
64 | attachments->addColumn(tr("Description"), 100); | 65 | attachments->addColumn(tr("Description"), 100); |
65 | attachments->addColumn(tr("Filename"), 80); | 66 | attachments->addColumn(tr("Filename"), 80); |
66 | attachments->addColumn(tr("Size"), 80); | 67 | attachments->addColumn(tr("Size"), 80); |
67 | attachments->setSorting(-1); | 68 | attachments->setSorting(-1); |
68 | attachments->hide(); | 69 | attachments->hide(); |
69 | 70 | ||
70 | browser = new QTextBrowser(view); | 71 | browser = new QTextBrowser(view); |
71 | 72 | ||
72 | //openDiag = new OpenDiag(view); | 73 | //openDiag = new OpenDiag(view); |
73 | //openDiag->hide(); | 74 | //openDiag->hide(); |
74 | 75 | ||
75 | } | 76 | } |
76 | 77 | ||
77 | void ViewMailBase::slotChangeAttachview(bool state) | 78 | void ViewMailBase::slotChangeAttachview(bool state) |
78 | { | 79 | { |
79 | if (state) attachments->show(); | 80 | if (state) attachments->show(); |
80 | else attachments->hide(); | 81 | else attachments->hide(); |
81 | } | 82 | } |
82 | 83 | ||
83 | void ViewMailBase::keyPressEvent ( QKeyEvent * e ) | 84 | void ViewMailBase::keyPressEvent ( QKeyEvent * e ) |
84 | { | 85 | { |
85 | if( e->key()==Qt::Key_Escape ) { | 86 | if( e->key()==Qt::Key_Escape ) { |
86 | close(); | 87 | close(); |
87 | e->accept(); | 88 | e->accept(); |
88 | return; | 89 | return; |
89 | } | 90 | } |
90 | QWidget::keyPressEvent(e); | 91 | QWidget::keyPressEvent(e); |
91 | } | 92 | } |
diff --git a/kmicromail/viewmailbase.h b/kmicromail/viewmailbase.h index c29d143..1c8948a 100644 --- a/kmicromail/viewmailbase.h +++ b/kmicromail/viewmailbase.h | |||
@@ -1,38 +1,39 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | ||
1 | #ifndef VIEWMAILBASE_H | 2 | #ifndef VIEWMAILBASE_H |
2 | #define VIEWMAILBASE_H | 3 | #define VIEWMAILBASE_H |
3 | 4 | ||
4 | #include <qmainwindow.h> | 5 | #include <qmainwindow.h> |
5 | 6 | ||
6 | class QAction; | 7 | class QAction; |
7 | class OpenDiag; | 8 | class OpenDiag; |
8 | class QListView; | 9 | class QListView; |
9 | class QToolBar; | 10 | class QToolBar; |
10 | class QTextBrowser; | 11 | class QTextBrowser; |
11 | class QMenuBar; | 12 | class QMenuBar; |
12 | class QPopupMenu; | 13 | class QPopupMenu; |
13 | 14 | ||
14 | class ViewMailBase : public QMainWindow | 15 | class ViewMailBase : public QMainWindow |
15 | { | 16 | { |
16 | Q_OBJECT | 17 | Q_OBJECT |
17 | 18 | ||
18 | public: | 19 | public: |
19 | ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 20 | ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); |
20 | 21 | ||
21 | protected: | 22 | protected: |
22 | QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail; | 23 | QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail; |
23 | QListView *attachments; | 24 | QListView *attachments; |
24 | QToolBar *toolbar; | 25 | QToolBar *toolbar; |
25 | QTextBrowser *browser; | 26 | QTextBrowser *browser; |
26 | OpenDiag *openDiag; | 27 | OpenDiag *openDiag; |
27 | QMenuBar *menubar; | 28 | QMenuBar *menubar; |
28 | QPopupMenu *mailmenu; | 29 | QPopupMenu *mailmenu; |
29 | 30 | ||
30 | protected slots: | 31 | protected slots: |
31 | void slotChangeAttachview(bool state); | 32 | void slotChangeAttachview(bool state); |
32 | virtual void keyPressEvent ( QKeyEvent * e ); | 33 | virtual void keyPressEvent ( QKeyEvent * e ); |
33 | 34 | ||
34 | 35 | ||
35 | }; | 36 | }; |
36 | 37 | ||
37 | #endif | 38 | #endif |
38 | 39 | ||