summaryrefslogtreecommitdiffabout
path: root/kmicromail
Unidiff
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/koprefs.cpp1
-rw-r--r--kmicromail/koprefs.h2
-rw-r--r--kmicromail/koprefsdialog.cpp3
-rw-r--r--kmicromail/mailistviewitem.cpp49
-rw-r--r--kmicromail/mainwindow.cpp4
-rw-r--r--kmicromail/opiemail.cpp17
-rw-r--r--kmicromail/opiemail.h3
-rw-r--r--kmicromail/viewmail.cpp25
-rw-r--r--kmicromail/viewmail.h4
-rw-r--r--kmicromail/viewmailbase.cpp8
-rw-r--r--kmicromail/viewmailbase.h2
11 files changed, 66 insertions, 52 deletions
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp
index 342bbf3..2bae5f6 100644
--- a/kmicromail/koprefs.cpp
+++ b/kmicromail/koprefs.cpp
@@ -1,125 +1,126 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <time.h> 24#include <time.h>
25#ifndef _WIN32_ 25#ifndef _WIN32_
26#include <unistd.h> 26#include <unistd.h>
27#endif 27#endif
28#include <qdir.h> 28#include <qdir.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qtextcodec.h> 30#include <qtextcodec.h>
31#include <qstring.h> 31#include <qstring.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qfont.h> 33#include <qfont.h>
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qstringlist.h> 35#include <qstringlist.h>
36#include <stdlib.h> 36#include <stdlib.h>
37 37
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kdebug.h> 41#include <kdebug.h>
42#include <kemailsettings.h> 42#include <kemailsettings.h>
43#include <kstaticdeleter.h> 43#include <kstaticdeleter.h>
44 44
45#include "koprefs.h" 45#include "koprefs.h"
46#include "mainwindow.h" 46#include "mainwindow.h"
47 47
48 48
49KOPrefs *KOPrefs::mInstance = 0; 49KOPrefs *KOPrefs::mInstance = 0;
50static KStaticDeleter<KOPrefs> insd; 50static KStaticDeleter<KOPrefs> insd;
51 51
52KOPrefs::KOPrefs() : 52KOPrefs::KOPrefs() :
53 KPimPrefs("kopiemailrc") 53 KPimPrefs("kopiemailrc")
54{ 54{
55 mAppFont = QFont("helvetica",12); 55 mAppFont = QFont("helvetica",12);
56 mComposeFont = QFont("helvetica",12); 56 mComposeFont = QFont("helvetica",12);
57 mReadFont = QFont("helvetica",12); 57 mReadFont = QFont("helvetica",12);
58 58
59 KPrefs::setCurrentGroup("General"); 59 KPrefs::setCurrentGroup("General");
60 addItemString("SendCodec",&mSendCodec,i18n ("userdefined") ); 60 addItemString("SendCodec",&mSendCodec,i18n ("userdefined") );
61 addItemString("SenderName",&mName,i18n ("Please set at") ); 61 addItemString("SenderName",&mName,i18n ("Please set at") );
62 addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); 62 addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") );
63 addItemBool("ViewMailAsHtml",&mViewAsHtml,false); 63 addItemBool("ViewMailAsHtml",&mViewAsHtml,false);
64 addItemBool("SendMailLater",&mSendLater,true); 64 addItemBool("SendMailLater",&mSendLater,true);
65 addItemBool("ShowToField",&mShowToField,false);
65 addItemBool("UseKapi",&mUseKapi,false); 66 addItemBool("UseKapi",&mUseKapi,false);
66 addItemInt("CurrentCodec",&mCurrentCodec,0); 67 addItemInt("CurrentCodec",&mCurrentCodec,0);
67 68
68 KPrefs::setCurrentGroup("Fonts"); 69 KPrefs::setCurrentGroup("Fonts");
69 addItemFont("Application Font",&mAppFont); 70 addItemFont("Application Font",&mAppFont);
70 addItemFont("Compose Font",&mComposeFont); 71 addItemFont("Compose Font",&mComposeFont);
71 addItemFont("Read Font",&mReadFont); 72 addItemFont("Read Font",&mReadFont);
72 fillMailDefaults(); 73 fillMailDefaults();
73 isDirty = false; 74 isDirty = false;
74} 75}
75 76
76 77
77KOPrefs::~KOPrefs() 78KOPrefs::~KOPrefs()
78{ 79{
79 if ( isDirty ) 80 if ( isDirty )
80 writeConfig(); 81 writeConfig();
81 if (mInstance == this) 82 if (mInstance == this)
82 mInstance = insd.setObject(0); 83 mInstance = insd.setObject(0);
83 84
84} 85}
85 86
86 87
87KOPrefs *KOPrefs::instance() 88KOPrefs *KOPrefs::instance()
88{ 89{
89 if (!mInstance) { 90 if (!mInstance) {
90 mInstance = insd.setObject(new KOPrefs()); 91 mInstance = insd.setObject(new KOPrefs());
91 mInstance->readConfig(); 92 mInstance->readConfig();
92 } 93 }
93 94
94 return mInstance; 95 return mInstance;
95} 96}
96 97
97void KOPrefs::usrSetDefaults() 98void KOPrefs::usrSetDefaults()
98{ 99{
99 100
100} 101}
101 102
102void KOPrefs::fillMailDefaults() 103void KOPrefs::fillMailDefaults()
103{ 104{
104 if (mName.isEmpty()) mName = i18n ("Please set at"); 105 if (mName.isEmpty()) mName = i18n ("Please set at");
105 if (mEmail.isEmpty()) mEmail = i18n ("Settings@General TAB"); 106 if (mEmail.isEmpty()) mEmail = i18n ("Settings@General TAB");
106} 107}
107 108
108void KOPrefs::usrReadConfig() 109void KOPrefs::usrReadConfig()
109{ 110{
110 111
111 KPimPrefs::usrReadConfig(); 112 KPimPrefs::usrReadConfig();
112} 113}
113 114
114 115
115void KOPrefs::usrWriteConfig() 116void KOPrefs::usrWriteConfig()
116{ 117{
117 KPimPrefs::usrWriteConfig(); 118 KPimPrefs::usrWriteConfig();
118} 119}
119 120
120 121
121 122
122KConfig* KOPrefs::getConfig() 123KConfig* KOPrefs::getConfig()
123{ 124{
124 return config(); 125 return config();
125} 126}
diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h
index 91f3fa3..f2c4fbb 100644
--- a/kmicromail/koprefs.h
+++ b/kmicromail/koprefs.h
@@ -1,80 +1,80 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KOPREFS_H 23#ifndef KOPREFS_H
24#define KOPREFS_H 24#define KOPREFS_H
25 25
26 26
27#include <libkdepim/kpimprefs.h> 27#include <libkdepim/kpimprefs.h>
28 28
29class KConfig; 29class KConfig;
30class QFont; 30class QFont;
31class QColor; 31class QColor;
32class QStringList; 32class QStringList;
33 33
34class KOPrefs : public KPimPrefs 34class KOPrefs : public KPimPrefs
35{ 35{
36 public: 36 public:
37 virtual ~KOPrefs(); 37 virtual ~KOPrefs();
38 38
39 /** Get instance of KOPrefs. It is made sure that there is only one 39 /** Get instance of KOPrefs. It is made sure that there is only one
40 instance. */ 40 instance. */
41 static KOPrefs *instance(); 41 static KOPrefs *instance();
42 42
43 /** Set preferences to default values */ 43 /** Set preferences to default values */
44 void usrSetDefaults(); 44 void usrSetDefaults();
45 45
46 /** Read preferences from config file */ 46 /** Read preferences from config file */
47 void usrReadConfig(); 47 void usrReadConfig();
48 48
49 /** Write preferences to config file */ 49 /** Write preferences to config file */
50 void usrWriteConfig(); 50 void usrWriteConfig();
51 void setCategoryDefaults(){;}; 51 void setCategoryDefaults(){;};
52 52
53 protected: 53 protected:
54 54
55 /** Fill empty mail fields with default values. */ 55 /** Fill empty mail fields with default values. */
56 void fillMailDefaults(); 56 void fillMailDefaults();
57 57
58 private: 58 private:
59 /** Constructor disabled for public. Use instance() to create a KOPrefs 59 /** Constructor disabled for public. Use instance() to create a KOPrefs
60 object. */ 60 object. */
61 KOPrefs(); 61 KOPrefs();
62 62
63 static KOPrefs *mInstance; 63 static KOPrefs *mInstance;
64 public: 64 public:
65 // preferences data 65 // preferences data
66 KConfig* getConfig(); 66 KConfig* getConfig();
67 QFont mAppFont; 67 QFont mAppFont;
68 QFont mComposeFont; 68 QFont mComposeFont;
69 QFont mReadFont; 69 QFont mReadFont;
70 QString mName; 70 QString mName;
71 QString mSendCodec; 71 QString mSendCodec;
72 QString mEmail; 72 QString mEmail;
73 QString mCurrentCodeName; 73 QString mCurrentCodeName;
74 int mCurrentCodec; 74 int mCurrentCodec;
75 bool mSendLater, mViewAsHtml, mUseKapi, isDirty; 75 bool mSendLater, mViewAsHtml, mUseKapi, isDirty, mShowToField;
76 private: 76 private:
77 77
78}; 78};
79 79
80#endif 80#endif
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp
index 13d6681..5c8a5a9 100644
--- a/kmicromail/koprefsdialog.cpp
+++ b/kmicromail/koprefsdialog.cpp
@@ -1,533 +1,536 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#include <kdialog.h> 23#include <kdialog.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qtextstream.h> 32#include <qtextstream.h>
33#include <qcombobox.h> 33#include <qcombobox.h>
34#include <qvbox.h> 34#include <qvbox.h>
35#include <qhbox.h> 35#include <qhbox.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44 44
45#include <kcolorbutton.h> 45#include <kcolorbutton.h>
46#include <kdebug.h> 46#include <kdebug.h>
47#include <klocale.h> 47#include <klocale.h>
48#include <kglobal.h> 48#include <kglobal.h>
49#include <kfontdialog.h> 49#include <kfontdialog.h>
50#include <kfiledialog.h> 50#include <kfiledialog.h>
51#include <kmessagebox.h> 51#include <kmessagebox.h>
52#include <kcolordialog.h> 52#include <kcolordialog.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54#include <kemailsettings.h> 54#include <kemailsettings.h>
55#include <kstandarddirs.h> 55#include <kstandarddirs.h>
56 56
57#include <klineedit.h> 57#include <klineedit.h>
58 58
59 59
60#include "koprefs.h" 60#include "koprefs.h"
61 61
62#include "koprefsdialog.h" 62#include "koprefsdialog.h"
63//#include <kprefswidget.h> 63//#include <kprefswidget.h>
64 64
65 65
66KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 66KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
67 KPrefsDialog(KOPrefs::instance(),parent,name,true) 67 KPrefsDialog(KOPrefs::instance(),parent,name,true)
68{ 68{
69 69
70 setCaption( i18n("Settings - some need a restart (nr)")); 70 setCaption( i18n("Settings - some need a restart (nr)"));
71 setupGlobalTab(); 71 setupGlobalTab();
72 setupMainTab(); 72 setupMainTab();
73 setupMailTab();; 73 setupMailTab();;
74 setupFontsTab(); 74 setupFontsTab();
75 readConfig(); 75 readConfig();
76 76
77#if 0 77#if 0
78 78
79 setupMainTab(); 79 setupMainTab();
80 setupLocaleTab(); 80 setupLocaleTab();
81 setupTimeZoneTab(); 81 setupTimeZoneTab();
82 setupTimeTab(); 82 setupTimeTab();
83 setupLocaleDateTab(); 83 setupLocaleDateTab();
84 setupFontsTab(); 84 setupFontsTab();
85 setupColorsTab(); 85 setupColorsTab();
86 setupViewsTab(); 86 setupViewsTab();
87 //setupSyncTab(); 87 //setupSyncTab();
88 //setupSyncAlgTab(); 88 //setupSyncAlgTab();
89 //setupPrinterTab(); 89 //setupPrinterTab();
90 //setupGroupSchedulingTab(); 90 //setupGroupSchedulingTab();
91 //setupGroupAutomationTab(); 91 //setupGroupAutomationTab();
92#endif 92#endif
93} 93}
94 94
95#include "kpimglobalprefs.h" 95#include "kpimglobalprefs.h"
96 96
97KOPrefsDialog::~KOPrefsDialog() 97KOPrefsDialog::~KOPrefsDialog()
98{ 98{
99} 99}
100void KOPrefsDialog::setupGlobalTab() 100void KOPrefsDialog::setupGlobalTab()
101{ 101{
102 QFrame *topFrame = addPage(i18n("Global"),0,0); 102 QFrame *topFrame = addPage(i18n("Global"),0,0);
103 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); 103 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
104 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 104 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
105 topLayout->addWidget( kdelibcfg ); 105 topLayout->addWidget( kdelibcfg );
106 106
107 107
108} 108}
109void KOPrefsDialog::setupMainTab() 109void KOPrefsDialog::setupMainTab()
110{ 110{
111 QFrame *topFrame = addPage(i18n("General"),0,0); 111 QFrame *topFrame = addPage(i18n("General"),0,0);
112 112
113 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 113 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
114 topLayout->setSpacing(spacingHint()); 114 topLayout->setSpacing(spacingHint());
115 topLayout->setMargin(marginHint()); 115 topLayout->setMargin(marginHint());
116 116
117 117
118 mNameEdit = new QLineEdit(topFrame); 118 mNameEdit = new QLineEdit(topFrame);
119 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 119 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
120 topLayout->addWidget(mNameLabel,0,0); 120 topLayout->addWidget(mNameLabel,0,0);
121 topLayout->addWidget(mNameEdit,0,1); 121 topLayout->addWidget(mNameEdit,0,1);
122 122
123 mEmailEdit = new QLineEdit(topFrame); 123 mEmailEdit = new QLineEdit(topFrame);
124 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 124 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
125 topLayout->addWidget(mEmailLabel,1,0); 125 topLayout->addWidget(mEmailLabel,1,0);
126 topLayout->addWidget(mEmailEdit,1,1); 126 topLayout->addWidget(mEmailEdit,1,1);
127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); 127 QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame);
128 topLayout->addMultiCellWidget(lab,2,2,0,1); 128 topLayout->addMultiCellWidget(lab,2,2,0,1);
129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), 129 KPrefsDialogWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"),
130 &(KOPrefs::instance()->mUseKapi),topFrame); 130 &(KOPrefs::instance()->mUseKapi),topFrame);
131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); 131 topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1);
132} 132}
133 133
134void KOPrefsDialog::setupMailTab() 134void KOPrefsDialog::setupMailTab()
135{ 135{
136 QFrame *topFrame = addPage(i18n("Mail"),0,0); 136 QFrame *topFrame = addPage(i18n("Mail"),0,0);
137 137
138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 138 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
139 topLayout->setSpacing(spacingHint()); 139 topLayout->setSpacing(spacingHint());
140 topLayout->setMargin(marginHint()); 140 topLayout->setMargin(marginHint());
141 141
142 KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"), 142 KPrefsDialogWidBool* ttt = addWidBool(i18n("View mail as html"),
143 &(KOPrefs::instance()->mViewAsHtml),topFrame); 143 &(KOPrefs::instance()->mViewAsHtml),topFrame);
144 topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); 144 topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1);
145 145
146 146
147 ttt = addWidBool(i18n("Send mails later"), 147 ttt = addWidBool(i18n("Send mails later"),
148 &(KOPrefs::instance()->mSendLater),topFrame); 148 &(KOPrefs::instance()->mSendLater),topFrame);
149 topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); 149 topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1);
150 ttt = addWidBool(i18n("Show \"To\" field in list view"),
151 &(KOPrefs::instance()->mShowToField),topFrame);
152 topLayout->addMultiCellWidget(ttt->checkBox(),2,2,0,1);
150 /* 153 /*
151 mCodecEdit = new QLineEdit(topFrame); 154 mCodecEdit = new QLineEdit(topFrame);
152 topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1); 155 topLayout->addMultiCellWidget( new QLabel(mCodecEdit, i18n("User defined codec for new mails:"), topFrame),2,2,0,1);
153 topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1); 156 topLayout->addMultiCellWidget(mCodecEdit,3,3,0,1);
154 topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1); 157 topLayout->addMultiCellWidget( new QLabel(0, i18n("Example: iso-8859-15"), topFrame),4,4,0,1);
155 */ 158 */
156} 159}
157void KOPrefsDialog::setupFontsTab() 160void KOPrefsDialog::setupFontsTab()
158{ 161{
159 162
160 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 163 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
161 // DesktopIcon("fonts",KIcon::SizeMedium)); 164 // DesktopIcon("fonts",KIcon::SizeMedium));
162 165
163 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 166 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
164 topLayout->setSpacing(1); 167 topLayout->setSpacing(1);
165 topLayout->setMargin(3); 168 topLayout->setMargin(3);
166 KPrefsDialogWidFont * tVFont; 169 KPrefsDialogWidFont * tVFont;
167 int i = 0; 170 int i = 0;
168 KPrefsDialogWidFont *timeLabelsFont = 171 KPrefsDialogWidFont *timeLabelsFont =
169 addWidFont(i18n("OK"),i18n("Application(nr)"), 172 addWidFont(i18n("OK"),i18n("Application(nr)"),
170 &(KOPrefs::instance()->mAppFont),topFrame); 173 &(KOPrefs::instance()->mAppFont),topFrame);
171 topLayout->addWidget(timeLabelsFont->label(),i,0); 174 topLayout->addWidget(timeLabelsFont->label(),i,0);
172 topLayout->addWidget(timeLabelsFont->preview(),i,1); 175 topLayout->addWidget(timeLabelsFont->preview(),i,1);
173 topLayout->addWidget(timeLabelsFont->button(),i,2); 176 topLayout->addWidget(timeLabelsFont->button(),i,2);
174 ++i; 177 ++i;
175 178
176 179
177 timeLabelsFont = 180 timeLabelsFont =
178 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), 181 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"),
179 &(KOPrefs::instance()->mComposeFont),topFrame); 182 &(KOPrefs::instance()->mComposeFont),topFrame);
180 topLayout->addWidget(timeLabelsFont->label(),i,0); 183 topLayout->addWidget(timeLabelsFont->label(),i,0);
181 topLayout->addWidget(timeLabelsFont->preview(),i,1); 184 topLayout->addWidget(timeLabelsFont->preview(),i,1);
182 topLayout->addWidget(timeLabelsFont->button(),i,2); 185 topLayout->addWidget(timeLabelsFont->button(),i,2);
183 ++i; 186 ++i;
184 187
185 KPrefsDialogWidFont *timeBarFont = 188 KPrefsDialogWidFont *timeBarFont =
186 addWidFont(i18n("Hello"),i18n("Read mail:"), 189 addWidFont(i18n("Hello"),i18n("Read mail:"),
187 &(KOPrefs::instance()->mReadFont),topFrame); 190 &(KOPrefs::instance()->mReadFont),topFrame);
188 topLayout->addWidget(timeBarFont->label(),i,0); 191 topLayout->addWidget(timeBarFont->label(),i,0);
189 topLayout->addWidget(timeBarFont->preview(),i,1); 192 topLayout->addWidget(timeBarFont->preview(),i,1);
190 topLayout->addWidget(timeBarFont->button(),i,2); 193 topLayout->addWidget(timeBarFont->button(),i,2);
191 ++i; 194 ++i;
192 195
193 topLayout->setColStretch(1,1); 196 topLayout->setColStretch(1,1);
194 topLayout->setRowStretch(4,1); 197 topLayout->setRowStretch(4,1);
195 198
196} 199}
197void KOPrefsDialog::usrReadConfig() 200void KOPrefsDialog::usrReadConfig()
198{ 201{
199 202
200 mNameEdit->setText(KOPrefs::instance()->mName); 203 mNameEdit->setText(KOPrefs::instance()->mName);
201 mEmailEdit->setText(KOPrefs::instance()->mEmail); 204 mEmailEdit->setText(KOPrefs::instance()->mEmail);
202 //mCodecEdit->setText(KOPrefs::instance()->mSendCodec); 205 //mCodecEdit->setText(KOPrefs::instance()->mSendCodec);
203 kdelibcfg->readConfig(); 206 kdelibcfg->readConfig();
204} 207}
205void KOPrefsDialog::usrWriteConfig() 208void KOPrefsDialog::usrWriteConfig()
206{ 209{
207 KOPrefs::instance()->mName = mNameEdit->text(); 210 KOPrefs::instance()->mName = mNameEdit->text();
208 KOPrefs::instance()->mEmail = mEmailEdit->text(); 211 KOPrefs::instance()->mEmail = mEmailEdit->text();
209 //KOPrefs::instance()->mSendCodec = mCodecEdit->text(); 212 //KOPrefs::instance()->mSendCodec = mCodecEdit->text();
210 kdelibcfg->writeConfig(); 213 kdelibcfg->writeConfig();
211 214
212 215
213} 216}
214 217
215#if 0 218#if 0
216void KOPrefsDialog::setupLocaleDateTab() 219void KOPrefsDialog::setupLocaleDateTab()
217{ 220{
218QFrame *topFrame = addPage(i18n("Date Format"),0,0); 221QFrame *topFrame = addPage(i18n("Date Format"),0,0);
219 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 222 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
220 topLayout->setSpacing(spacingHint()); 223 topLayout->setSpacing(spacingHint());
221 topLayout->setMargin(marginHint()); 224 topLayout->setMargin(marginHint());
222 int iii = 0; 225 int iii = 0;
223 226
224 227
225 KPrefsWidRadios *syncPrefsGroup = 228 KPrefsWidRadios *syncPrefsGroup =
226 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 229 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
227 QString format; 230 QString format;
228 if ( QApplication::desktop()->width() < 480 ) 231 if ( QApplication::desktop()->width() < 480 )
229 format = "(%d.%m.%Y)"; 232 format = "(%d.%m.%Y)";
230 else 233 else
231 format = "(%d.%m.%Y|%A %d %B %Y)"; 234 format = "(%d.%m.%Y|%A %d %B %Y)";
232 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 235 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
233 if ( QApplication::desktop()->width() < 480 ) 236 if ( QApplication::desktop()->width() < 480 )
234 format = "(%m.%d.%Y)"; 237 format = "(%m.%d.%Y)";
235 else 238 else
236 format = "(%m.%d.%Y|%A %B %d %Y)"; 239 format = "(%m.%d.%Y|%A %B %d %Y)";
237 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 240 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
238 if ( QApplication::desktop()->width() < 480 ) 241 if ( QApplication::desktop()->width() < 480 )
239 format = "(%Y-%m-%d)"; 242 format = "(%Y-%m-%d)";
240 else 243 else
241 format = "(%Y-%m-%d|%A %Y %B %d)"; 244 format = "(%Y-%m-%d|%A %Y %B %d)";
242 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 245 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
243 syncPrefsGroup->addRadio(i18n("User defined")); 246 syncPrefsGroup->addRadio(i18n("User defined"));
244 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 247 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
245 ++iii; 248 ++iii;
246 ++iii; 249 ++iii;
247 QLabel * lab; 250 QLabel * lab;
248 mUserDateFormatLong = new QLineEdit(topFrame); 251 mUserDateFormatLong = new QLineEdit(topFrame);
249 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 252 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
250 topLayout->addWidget(lab ,iii,0); 253 topLayout->addWidget(lab ,iii,0);
251 topLayout->addWidget(mUserDateFormatLong,iii,1); 254 topLayout->addWidget(mUserDateFormatLong,iii,1);
252 ++iii; 255 ++iii;
253 mUserDateFormatShort = new QLineEdit(topFrame); 256 mUserDateFormatShort = new QLineEdit(topFrame);
254 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 257 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
255 topLayout->addWidget(lab ,iii,0); 258 topLayout->addWidget(lab ,iii,0);
256 topLayout->addWidget(mUserDateFormatShort,iii,1); 259 topLayout->addWidget(mUserDateFormatShort,iii,1);
257 ++iii; 260 ++iii;
258 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 261 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
259 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 262 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
260 ++iii; 263 ++iii;
261 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 264 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
262 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 265 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
263 ++iii; 266 ++iii;
264 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 267 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
265 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 268 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
266 ++iii; 269 ++iii;
267 270
268} 271}
269 272
270void KOPrefsDialog::setupLocaleTab() 273void KOPrefsDialog::setupLocaleTab()
271{ 274{
272 QFrame *topFrame = addPage(i18n("Locale"),0,0); 275 QFrame *topFrame = addPage(i18n("Locale"),0,0);
273 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 276 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
274 topLayout->setSpacing(spacingHint()); 277 topLayout->setSpacing(spacingHint());
275 topLayout->setMargin(marginHint()); 278 topLayout->setMargin(marginHint());
276 int iii = 0; 279 int iii = 0;
277 KPrefsWidRadios *syncPrefsGroup = 280 KPrefsWidRadios *syncPrefsGroup =
278 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 281 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
279 syncPrefsGroup->addRadio(i18n("English")); 282 syncPrefsGroup->addRadio(i18n("English"));
280 syncPrefsGroup->addRadio(i18n("German")); 283 syncPrefsGroup->addRadio(i18n("German"));
281 syncPrefsGroup->addRadio(i18n("French")); 284 syncPrefsGroup->addRadio(i18n("French"));
282 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 285 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
283 if ( QApplication::desktop()->width() < 300 ) 286 if ( QApplication::desktop()->width() < 300 )
284 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 287 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
285 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 288 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
286 ++iii; 289 ++iii;
287 290
288 syncPrefsGroup = 291 syncPrefsGroup =
289 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 292 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
290 if ( QApplication::desktop()->width() > 300 ) 293 if ( QApplication::desktop()->width() > 300 )
291 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 294 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
292 syncPrefsGroup->addRadio(i18n("24:00")); 295 syncPrefsGroup->addRadio(i18n("24:00"));
293 syncPrefsGroup->addRadio(i18n("12:00am")); 296 syncPrefsGroup->addRadio(i18n("12:00am"));
294 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 297 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
295 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 298 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
296 ++iii; 299 ++iii;
297 KPrefsDialogWidBool *sb; 300 KPrefsDialogWidBool *sb;
298 if ( QApplication::desktop()->width() < 300 ) { 301 if ( QApplication::desktop()->width() < 300 ) {
299 sb = 302 sb =
300 addWidBool(i18n("Week starts on Sunday"), 303 addWidBool(i18n("Week starts on Sunday"),
301 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 304 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
302 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 305 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
303 ++iii; 306 ++iii;
304 sb = 307 sb =
305 addWidBool(i18n("Use short date in (WN/E) view"), 308 addWidBool(i18n("Use short date in (WN/E) view"),
306 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 309 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
307 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 310 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
308 } 311 }
309 else { 312 else {
310 QWidget * hb = new QWidget( topFrame ); 313 QWidget * hb = new QWidget( topFrame );
311 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 314 QHBoxLayout *hbLayout = new QHBoxLayout(hb);
312 sb = 315 sb =
313 addWidBool(i18n("Week starts on Sunday"), 316 addWidBool(i18n("Week starts on Sunday"),
314 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 317 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
315 hbLayout->addWidget(sb->checkBox() ); 318 hbLayout->addWidget(sb->checkBox() );
316 sb = 319 sb =
317 addWidBool(i18n("Use short date in (WN/E) view"), 320 addWidBool(i18n("Use short date in (WN/E) view"),
318 &(KOPrefs::instance()->mShortDateInViewer),hb); 321 &(KOPrefs::instance()->mShortDateInViewer),hb);
319 hbLayout->addWidget(sb->checkBox() ); 322 hbLayout->addWidget(sb->checkBox() );
320 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 323 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
321 324
322 } 325 }
323 //#ifndef DESKTOP_VERSION 326 //#ifndef DESKTOP_VERSION
324#if 0 327#if 0
325 ++iii; 328 ++iii;
326 sb = 329 sb =
327 addWidBool(i18n("Quick load/save (w/o Unicode)"), 330 addWidBool(i18n("Quick load/save (w/o Unicode)"),
328 &(KOPrefs::instance()->mUseQuicksave),topFrame); 331 &(KOPrefs::instance()->mUseQuicksave),topFrame);
329 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 332 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
330#endif 333#endif
331} 334}
332void KOPrefsDialog::showSyncPage() 335void KOPrefsDialog::showSyncPage()
333{ 336{
334 showPage ( 2 ) ; 337 showPage ( 2 ) ;
335 338
336} 339}
337void KOPrefsDialog::setupSyncAlgTab() 340void KOPrefsDialog::setupSyncAlgTab()
338{ 341{
339#if 0 342#if 0
340 QLabel * lab; 343 QLabel * lab;
341 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); 344 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
342 mSetupSyncAlgTab = topFrame; 345 mSetupSyncAlgTab = topFrame;
343 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 346 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
344 topLayout->setSpacing(spacingHint()); 347 topLayout->setSpacing(spacingHint());
345 topLayout->setMargin(marginHint()); 348 topLayout->setMargin(marginHint());
346 int iii = 0; 349 int iii = 0;
347 350
348 KPrefsDialogWidBool *sb = 351 KPrefsDialogWidBool *sb =
349 addWidBool(i18n("Ask for preferences before syncing"), 352 addWidBool(i18n("Ask for preferences before syncing"),
350 &(KOPrefs::instance()->mAskForPreferences),topFrame); 353 &(KOPrefs::instance()->mAskForPreferences),topFrame);
351 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 354 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
352 355
353 ++iii; 356 ++iii;
354 357
355 KPrefsWidRadios *syncPrefsGroup = 358 KPrefsWidRadios *syncPrefsGroup =
356 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), 359 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
357 topFrame); 360 topFrame);
358 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 361 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
359 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 362 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
360 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 363 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
361 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 364 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
362 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 365 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
363 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 366 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
364 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 367 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
365 ++iii; 368 ++iii;
366 sb = 369 sb =
367 addWidBool(i18n("Show summary after syncing"), 370 addWidBool(i18n("Show summary after syncing"),
368 &(KOPrefs::instance()->mShowSyncSummary),topFrame); 371 &(KOPrefs::instance()->mShowSyncSummary),topFrame);
369 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 372 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
370 373
371 ++iii; 374 ++iii;
372#endif 375#endif
373 376
374 377
375 378
376} 379}
377 380
378 381
379void KOPrefsDialog::setupSyncTab() 382void KOPrefsDialog::setupSyncTab()
380{ 383{
381#if 0 384#if 0
382 QLabel * lab; 385 QLabel * lab;
383 QFrame *topFrame = addPage(i18n("Sync Network"),0,0); 386 QFrame *topFrame = addPage(i18n("Sync Network"),0,0);
384 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 387 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
385 topLayout->setSpacing(spacingHint()); 388 topLayout->setSpacing(spacingHint());
386 topLayout->setMargin(marginHint()); 389 topLayout->setMargin(marginHint());
387 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); 390 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame);
388 int iii = 0; 391 int iii = 0;
389 topLayout->addMultiCellWidget(lab , iii,iii,0,1); 392 topLayout->addMultiCellWidget(lab , iii,iii,0,1);
390 ++iii; 393 ++iii;
391 394
392 mRemoteIPEdit = new QLineEdit(topFrame); 395 mRemoteIPEdit = new QLineEdit(topFrame);
393 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); 396 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame);
394 topLayout->addWidget(lab ,iii,0); 397 topLayout->addWidget(lab ,iii,0);
395 topLayout->addWidget(mRemoteIPEdit,iii,1); 398 topLayout->addWidget(mRemoteIPEdit,iii,1);
396 ++iii; 399 ++iii;
397 mRemoteUser = new QLineEdit(topFrame); 400 mRemoteUser = new QLineEdit(topFrame);
398 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); 401 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame);
399 topLayout->addWidget(lab ,iii,0); 402 topLayout->addWidget(lab ,iii,0);
400 topLayout->addWidget(mRemoteUser, iii,1); 403 topLayout->addWidget(mRemoteUser, iii,1);
401 ++iii; 404 ++iii;
402 405
403 mRemoteFile = new QLineEdit(topFrame); 406 mRemoteFile = new QLineEdit(topFrame);
404 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); 407 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame);
405 topLayout->addWidget(lab ,iii,0); 408 topLayout->addWidget(lab ,iii,0);
406 topLayout->addWidget(mRemoteFile,iii,1); 409 topLayout->addWidget(mRemoteFile,iii,1);
407 ++iii; 410 ++iii;
408 411
409 mLocalTempFile = new QLineEdit(topFrame); 412 mLocalTempFile = new QLineEdit(topFrame);
410 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); 413 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame);
411 topLayout->addWidget(lab ,iii,0); 414 topLayout->addWidget(lab ,iii,0);
412 topLayout->addWidget(mLocalTempFile,iii,1); 415 topLayout->addWidget(mLocalTempFile,iii,1);
413 ++iii; 416 ++iii;
414 417
415 KPrefsDialogWidBool *wb = 418 KPrefsDialogWidBool *wb =
416 addWidBool(i18n("Write back synced file"), 419 addWidBool(i18n("Write back synced file"),
417 &(KOPrefs::instance()->mWriteBackFile),topFrame); 420 &(KOPrefs::instance()->mWriteBackFile),topFrame);
418 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 421 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
419 ++iii; 422 ++iii;
420 wb = 423 wb =
421 addWidBool(i18n("Write back existing entries only"), 424 addWidBool(i18n("Write back existing entries only"),
422 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); 425 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame);
423 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 426 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
424 ++iii; 427 ++iii;
425 428
426#endif 429#endif
427} 430}
428 431
429void KOPrefsDialog::setupMainTab() 432void KOPrefsDialog::setupMainTab()
430{ 433{
431 QFrame *topFrame = addPage(i18n("General"),0,0); 434 QFrame *topFrame = addPage(i18n("General"),0,0);
432 // DesktopIcon("identity",KIcon::SizeMedium)); 435 // DesktopIcon("identity",KIcon::SizeMedium));
433 436
434 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 437 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
435 topLayout->setSpacing(spacingHint()); 438 topLayout->setSpacing(spacingHint());
436 topLayout->setMargin(marginHint()); 439 topLayout->setMargin(marginHint());
437 440
438 // KPrefsDialogWidBool *emailControlCenter = 441 // KPrefsDialogWidBool *emailControlCenter =
439// addWidBool(i18n("&Use email settings from Control Center"), 442// addWidBool(i18n("&Use email settings from Control Center"),
440// &(KOPrefs::instance()->mEmailControlCenter),topFrame); 443// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
441// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); 444// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
442 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), 445 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
443 // SLOT(toggleEmailSettings(bool))); 446 // SLOT(toggleEmailSettings(bool)));
444 447
445 mNameEdit = new QLineEdit(topFrame); 448 mNameEdit = new QLineEdit(topFrame);
446 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 449 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
447 topLayout->addWidget(mNameLabel,0,0); 450 topLayout->addWidget(mNameLabel,0,0);
448 topLayout->addWidget(mNameEdit,0,1); 451 topLayout->addWidget(mNameEdit,0,1);
449 452
450 mEmailEdit = new QLineEdit(topFrame); 453 mEmailEdit = new QLineEdit(topFrame);
451 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 454 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
452 topLayout->addWidget(mEmailLabel,1,0); 455 topLayout->addWidget(mEmailLabel,1,0);
453 topLayout->addWidget(mEmailEdit,1,1); 456 topLayout->addWidget(mEmailEdit,1,1);
454 KPrefsDialogWidBool *wb; 457 KPrefsDialogWidBool *wb;
455 QHBox *dummy; 458 QHBox *dummy;
456 if ( QApplication::desktop()->width() > 480 ) { 459 if ( QApplication::desktop()->width() > 480 ) {
457 dummy = new QHBox(topFrame); 460 dummy = new QHBox(topFrame);
458 } else { 461 } else {
459 dummy = new QVBox(topFrame); 462 dummy = new QVBox(topFrame);
460 } 463 }
461 464
462 topLayout->addMultiCellWidget(dummy, 2,2,0,1); 465 topLayout->addMultiCellWidget(dummy, 2,2,0,1);
463 addWidBool(i18n("Full menu bar(nr)"), 466 addWidBool(i18n("Full menu bar(nr)"),
464 &(KOPrefs::instance()->mShowFullMenu),dummy); 467 &(KOPrefs::instance()->mShowFullMenu),dummy);
465 468
466 469
467 addWidBool(i18n("Mini icons in toolbar(nr)"), 470 addWidBool(i18n("Mini icons in toolbar(nr)"),
468 &(KOPrefs::instance()->mToolBarMiniIcons),dummy); 471 &(KOPrefs::instance()->mToolBarMiniIcons),dummy);
469 472
470 473
471 dummy = new QHBox(topFrame); 474 dummy = new QHBox(topFrame);
472 new QLabel(i18n("Days in What's Next:"),dummy); 475 new QLabel(i18n("Days in What's Next:"),dummy);
473 mWhatsNextSpin = new QSpinBox(1,14,1,dummy); 476 mWhatsNextSpin = new QSpinBox(1,14,1,dummy);
474 477
475 topLayout->addMultiCellWidget(dummy,3,3,0,1); 478 topLayout->addMultiCellWidget(dummy,3,3,0,1);
476 479
477 480
478 481
479 dummy = new QHBox(topFrame); 482 dummy = new QHBox(topFrame);
480 new QLabel(i18n("Days in Next-X-Days:"),dummy); 483 new QLabel(i18n("Days in Next-X-Days:"),dummy);
481 mNextXDaysSpin = new QSpinBox(2,14,1,dummy); 484 mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
482 485
483 topLayout->addMultiCellWidget(dummy,4,4,0,1); 486 topLayout->addMultiCellWidget(dummy,4,4,0,1);
484 487
485 QHBox *prioBox = new QHBox(topFrame); 488 QHBox *prioBox = new QHBox(topFrame);
486 // intervalBox->setSpacing(spacingHint()); 489 // intervalBox->setSpacing(spacingHint());
487 topLayout->addMultiCellWidget(prioBox,5,5,0,1); 490 topLayout->addMultiCellWidget(prioBox,5,5,0,1);
488 QString messa = i18n("Show topmost todo prios in What's Next:"); 491 QString messa = i18n("Show topmost todo prios in What's Next:");
489 492
490 if ( QApplication::desktop()->width() < 300 ) 493 if ( QApplication::desktop()->width() < 300 )
491 messa = i18n("Show topmost todo prios in What's N.:"); 494 messa = i18n("Show topmost todo prios in What's N.:");
492 QLabel *prioLabel = new QLabel(messa, prioBox); 495 QLabel *prioLabel = new QLabel(messa, prioBox);
493 mPrioSpin = new QSpinBox(0,5,1,prioBox); 496 mPrioSpin = new QSpinBox(0,5,1,prioBox);
494 if ( QApplication::desktop()->width() < 300 ) 497 if ( QApplication::desktop()->width() < 300 )
495 mPrioSpin->setFixedWidth( 40 ); 498 mPrioSpin->setFixedWidth( 40 );
496 499
497 // KPrefsDialogWidBool *bcc = 500 // KPrefsDialogWidBool *bcc =
498// addWidBool(i18n("Send copy to owner when mailing events"), 501// addWidBool(i18n("Send copy to owner when mailing events"),
499// &(KOPrefs::instance()->mBcc),topFrame); 502// &(KOPrefs::instance()->mBcc),topFrame);
500// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); 503// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
501 504
502 505
503 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); 506 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
504 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); 507 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
505 508
506 // addWidBool(i18n("Enable automatic saving of calendar"), 509 // addWidBool(i18n("Enable automatic saving of calendar"),
507 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); 510 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
508 511
509 QHBox *intervalBox = new QHBox(topFrame); 512 QHBox *intervalBox = new QHBox(topFrame);
510 // intervalBox->setSpacing(spacingHint()); 513 // intervalBox->setSpacing(spacingHint());
511 topLayout->addMultiCellWidget(intervalBox,6,6,0,1); 514 topLayout->addMultiCellWidget(intervalBox,6,6,0,1);
512 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); 515 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
513 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); 516 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
514 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); 517 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
515 /* 518 /*
516 QHBox * agendasize = new QHBox ( topFrame ); 519 QHBox * agendasize = new QHBox ( topFrame );
517 520
518 new QLabel (i18n("AllDayAgenda Height:"), agendasize ); 521 new QLabel (i18n("AllDayAgenda Height:"), agendasize );
519 522
520 523
521 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); 524 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
522 topLayout->addMultiCellWidget(agendasize,7,7,0,1); 525 topLayout->addMultiCellWidget(agendasize,7,7,0,1);
523 */ 526 */
524 KPrefsDialogWidBool *verticalScreen = 527 KPrefsDialogWidBool *verticalScreen =
525 addWidBool(i18n("Show vertical screen (Needs restart)"), 528 addWidBool(i18n("Show vertical screen (Needs restart)"),
526 &(KOPrefs::instance()->mVerticalScreen),topFrame); 529 &(KOPrefs::instance()->mVerticalScreen),topFrame);
527 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); 530 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
528 topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); 531 topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1);
529 532
530 KPrefsDialogWidBool *ask = 533 KPrefsDialogWidBool *ask =
531 addWidBool(i18n("Ask for quit when closing KO/Pi"), 534 addWidBool(i18n("Ask for quit when closing KO/Pi"),
532 &(KOPrefs::instance()->mAskForQuit),topFrame); 535 &(KOPrefs::instance()->mAskForQuit),topFrame);
533 topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); 536 topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1);
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index 484a635..ffb835c 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -1,146 +1,103 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#include "mailistviewitem.h" 2#include "mailistviewitem.h"
3#include <libmailwrapper/abstractmail.h> 3#include <libmailwrapper/abstractmail.h>
4#include <qtextstream.h> 4#include <qtextstream.h>
5#include <kiconloader.h> 5#include <kiconloader.h>
6#include "koprefs.h"
6//#include <qpe/resource.h> 7//#include <qpe/resource.h>
7 8
8MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 9MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
9 :QListViewItem(parent,item),mail_data() 10 :QListViewItem(parent,item),mail_data()
10{ 11{
11} 12}
12 13
13void MailListViewItem::showEntry() 14void MailListViewItem::showEntry()
14{ 15{
15 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { 16 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
16 setPixmap( 0, SmallIcon ( "kmmsgreplied") ); 17 setPixmap( 0, SmallIcon ( "kmmsgreplied") );
17 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { 18 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
18 /* I think it looks nicer if there are not such a log of icons but only on mails 19 /* I think it looks nicer if there are not such a log of icons but only on mails
19 replied or new - Alwin*/ 20 replied or new - Alwin*/
20 //setPixmap( 0,SmallIcon ("kmmsgunseen") ); 21 //setPixmap( 0,SmallIcon ("kmmsgunseen") );
21 } else { 22 } else {
22 setPixmap( 0,SmallIcon ( "kmmsgnew") ); 23 setPixmap( 0,SmallIcon ( "kmmsgnew") );
23 } 24 }
24 double s = mail_data->Msgsize(); 25 double s = mail_data->Msgsize();
25 int w = 0; 26 int w = 0;
26 s/=1024; 27 s/=1024;
27 if (s>999.0) { 28 if (s>999.0) {
28 s/=1024.0; 29 s/=1024.0;
29 ++w; 30 ++w;
30 } 31 }
31 QString fsort; 32 QString fsort;
32 fsort.sprintf( "%.2f", s ); 33 fsort.sprintf( "%.2f", s );
33 QString fsize = QString::number( s, 'f', 2 ); 34 QString fsize = QString::number( s, 'f', 2 );
34 // 1.23 35 // 1.23
35 // 11.23 36 // 11.23
36 // 111.23 37 // 111.23
37 // 999.23 maxlen 38 // 999.23 maxlen
38 switch(fsize.length() ) { 39 switch(fsize.length() ) {
39 case 4: 40 case 4:
40 fsort = "00" + fsize ; 41 fsort = "00" + fsize ;
41 break; 42 break;
42 case 5: 43 case 5:
43 fsort = "0" + fsize ; 44 fsort = "0" + fsize ;
44 break; 45 break;
45 default: 46 default:
46 fsort = fsize ; 47 fsort = fsize ;
47 break; 48 break;
48 49
49 } 50 }
50 if ( w == 0 ) { 51 if ( w == 0 ) {
51 setText(3, fsize + "kB" ); 52 setText(3, fsize + "kB" );
52 mKeyMap.insert(3, "k" + fsort); 53 mKeyMap.insert(3, "k" + fsort);
53 //setText(3, "kB" + fsort ); // test only 54 //setText(3, "kB" + fsort ); // test only
54 } else { 55 } else {
55 //setText(3, fsize + "MB"); 56 //setText(3, fsize + "MB");
56 mKeyMap.insert(3, "M" +fsort ); 57 mKeyMap.insert(3, "M" +fsort );
57 } 58 }
58 setText(1,mail_data->getSubject()); 59 setText(1,mail_data->getSubject());
59 setText(2,mail_data->getFrom()); 60 setText(2,mail_data->getFrom());
60#if 0
61 QString date = mail_data->getDate();
62
63 int kom = date.find( ",")+2;
64 if ( kom == 1 )
65 kom = 0;
66 if ( date.mid(kom,1) == " ")
67 ++kom;
68 if ( date.mid(kom+1,1) == " " )
69 date = "0" + date.mid( kom );
70 else if ( kom )
71 date = date.mid( kom );
72 if ( kom || date.mid(2,1 ) == " ") {
73 QString mon = date.mid(3,3);
74 QString so = 00;
75 if ( mon == "Jan" )
76 so = "01";
77 else if ( mon == "Feb" )
78 so = "02";
79 else if ( mon == "Mar" )
80 so = "03";
81 else if ( mon == "Apr" )
82 so = "04";
83 else if ( mon == "May" )
84 so = "05";
85 else if ( mon == "Jun" )
86 so = "06";
87 else if ( mon == "Jul" )
88 so = "07";
89 else if ( mon == "Aug" )
90 so = "08";
91 else if ( mon == "Sep" )
92 so = "09";
93 else if ( mon == "Oct" )
94 so = "10";
95 else if ( mon == "Nov" )
96 so = "11";
97 else if ( mon == "Dec" )
98 so = "12";
99 date = date.mid(7,4)+so+date.left(2)+date.mid(12,14);
100 }
101 //qDebug("insert Date %s ", date.latin1());
102 // if ( date.left(1) != "1" || date.left(1) != "2" )
103 // date = date.mid(5);
104 mKeyMap.insert(4,date);
105#endif
106 mKeyMap.insert(4,mail_data->getIsoDate()); 61 mKeyMap.insert(4,mail_data->getIsoDate());
107 setText(4,mail_data->getDate()); 62 setText(4,mail_data->getDate());
63 if ( KOPrefs::instance()->mShowToField )
64 setText(5,mail_data->To()[0]);
108} 65}
109 66
110void MailListViewItem::storeData(const RecMailP&data) 67void MailListViewItem::storeData(const RecMailP&data)
111{ 68{
112 mail_data = data; 69 mail_data = data;
113} 70}
114void MailListViewItem::setSortKey(int column,const QString &key) 71void MailListViewItem::setSortKey(int column,const QString &key)
115{ 72{
116 mKeyMap.insert(column,key); 73 mKeyMap.insert(column,key);
117} 74}
118QString MailListViewItem::key(int column, bool) const 75QString MailListViewItem::key(int column, bool) const
119{ 76{
120 // to make is fast, we use here special cases 77 // to make is fast, we use here special cases
121 if ( column == 3 || column == 4 ) { 78 if ( column == 3 || column == 4 ) {
122 return *mKeyMap.find(column); 79 return *mKeyMap.find(column);
123 } 80 }
124 if ( column == 1 ) { 81 if ( column == 1 ) {
125 if ( text(1).left(4).lower() == "re: " ) 82 if ( text(1).left(4).lower() == "re: " )
126 return text(1).mid(4); 83 return text(1).mid(4);
127 84
128 } 85 }
129 return text(column); 86 return text(column);
130 /* 87 /*
131 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 88 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
132 if (it == mKeyMap.end()) return text(column); 89 if (it == mKeyMap.end()) return text(column);
133 else return *it; 90 else return *it;
134 */ 91 */
135} 92}
136 93
137const RecMailP& MailListViewItem::data()const 94const RecMailP& MailListViewItem::data()const
138{ 95{
139 return mail_data; 96 return mail_data;
140} 97}
141 98
142MAILLIB::ATYPE MailListViewItem::wrapperType() 99MAILLIB::ATYPE MailListViewItem::wrapperType()
143{ 100{
144 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; 101 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
145 return mail_data->Wrapper()->getType(); 102 return mail_data->Wrapper()->getType();
146} 103}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index 1dc374b..875ab77 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,355 +1,359 @@
1 1
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qvbox.h> 4#include <qvbox.h>
5#include <qheader.h> 5#include <qheader.h>
6#include <qtimer.h> 6#include <qtimer.h>
7#include <qlayout.h> 7#include <qlayout.h>
8//#include <kdialog.h> 8//#include <kdialog.h>
9#include <kiconloader.h> 9#include <kiconloader.h>
10#include <kapplication.h> 10#include <kapplication.h>
11 11
12#ifdef DESKTOP_VERSION 12#ifdef DESKTOP_VERSION
13#include <qapplication.h> 13#include <qapplication.h>
14#include <qstatusbar.h> 14#include <qstatusbar.h>
15#include <kabc/stdaddressbook.h> 15#include <kabc/stdaddressbook.h>
16extern QStatusBar* globalSstatusBarMainWindow; 16extern QStatusBar* globalSstatusBarMainWindow;
17#else 17#else
18#include <qpe/qpeapplication.h> 18#include <qpe/qpeapplication.h>
19#include <klocale.h> 19#include <klocale.h>
20#endif 20#endif
21#include "defines.h" 21#include "defines.h"
22#include "mainwindow.h" 22#include "mainwindow.h"
23#include <KDGanttMinimizeSplitter.h> 23#include <KDGanttMinimizeSplitter.h>
24 24
25#include "koprefs.h" 25#include "koprefs.h"
26 26
27MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 27MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
28 : QMainWindow( parent, name ) //, flags ) 28 : QMainWindow( parent, name ) //, flags )
29{ 29{
30#ifdef DESKTOP_VERSION 30#ifdef DESKTOP_VERSION
31 globalSstatusBarMainWindow = statusBar(); 31 globalSstatusBarMainWindow = statusBar();
32#endif 32#endif
33 setCaption( i18n( "KOpieMail/Pi" ) ); 33 setCaption( i18n( "KOpieMail/Pi" ) );
34 setToolBarsMovable( false ); 34 setToolBarsMovable( false );
35 //KABC::StdAddressBook::self(); 35 //KABC::StdAddressBook::self();
36 toolBar = new QToolBar( this ); 36 toolBar = new QToolBar( this );
37 menuBar = new QPEMenuBar( toolBar ); 37 menuBar = new QPEMenuBar( toolBar );
38 mailMenu = new QPopupMenu( menuBar ); 38 mailMenu = new QPopupMenu( menuBar );
39 menuBar->insertItem( i18n( "Mail" ), mailMenu ); 39 menuBar->insertItem( i18n( "Mail" ), mailMenu );
40 settingsMenu = new QPopupMenu( menuBar ); 40 settingsMenu = new QPopupMenu( menuBar );
41 menuBar->insertItem( i18n( "Settings" ), settingsMenu ); 41 menuBar->insertItem( i18n( "Settings" ), settingsMenu );
42 42
43 addToolBar( toolBar ); 43 addToolBar( toolBar );
44 toolBar->setHorizontalStretchable( true ); 44 toolBar->setHorizontalStretchable( true );
45 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), 45 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"),
46 0, 0, this ); 46 0, 0, this );
47 connect(getMail, SIGNAL( activated() ), 47 connect(getMail, SIGNAL( activated() ),
48 SLOT( slotGetAllMail() ) ); 48 SLOT( slotGetAllMail() ) );
49 getMail->addTo( mailMenu ); 49 getMail->addTo( mailMenu );
50 50
51 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), 51 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
52 0, 0, this ); 52 0, 0, this );
53 getMail->addTo( toolBar ); 53 getMail->addTo( toolBar );
54 getMail->addTo( mailMenu ); 54 getMail->addTo( mailMenu );
55 connect(getMail, SIGNAL( activated() ), 55 connect(getMail, SIGNAL( activated() ),
56 SLOT( slotGetMail() ) ); 56 SLOT( slotGetMail() ) );
57 57
58 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), 58 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
59 0, 0, this ); 59 0, 0, this );
60 composeMail->addTo( toolBar ); 60 composeMail->addTo( toolBar );
61 composeMail->addTo( mailMenu ); 61 composeMail->addTo( mailMenu );
62 62
63 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , 63 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
64 0, 0, this ); 64 0, 0, this );
65 sendQueued->addTo( toolBar ); 65 sendQueued->addTo( toolBar );
66 sendQueued->addTo( mailMenu ); 66 sendQueued->addTo( mailMenu );
67 67
68 /* 68 /*
69 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, 69 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
70 0, 0, this ); 70 0, 0, this );
71 syncFolders->addTo( toolBar ); 71 syncFolders->addTo( toolBar );
72 syncFolders->addTo( mailMenu ); 72 syncFolders->addTo( mailMenu );
73 */ 73 */
74 74
75 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , 75 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") ,
76 0, 0, this, 0, true ); 76 0, 0, this, 0, true );
77 showFolders->addTo( toolBar ); 77 showFolders->addTo( toolBar );
78 showFolders->addTo( mailMenu ); 78 showFolders->addTo( mailMenu );
79 showFolders->setOn( true ); 79 showFolders->setOn( true );
80 connect(showFolders, SIGNAL( toggled(bool) ), 80 connect(showFolders, SIGNAL( toggled(bool) ),
81 SLOT( slotShowFolders(bool) ) ); 81 SLOT( slotShowFolders(bool) ) );
82 82
83 /* 83 /*
84 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 84 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
85 0, 0, this ); 85 0, 0, this );
86 searchMails->addTo( toolBar ); 86 searchMails->addTo( toolBar );
87 searchMails->addTo( mailMenu ); 87 searchMails->addTo( mailMenu );
88 */ 88 */
89 89
90 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); 90 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
91 deleteMails->addTo( toolBar ); 91 deleteMails->addTo( toolBar );
92 deleteMails->addTo( mailMenu ); 92 deleteMails->addTo( mailMenu );
93 connect( deleteMails, SIGNAL( activated() ), 93 connect( deleteMails, SIGNAL( activated() ),
94 SLOT( slotDeleteAllMail() ) ); 94 SLOT( slotDeleteAllMail() ) );
95 95
96 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , 96 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") ,
97 0, 0, this ); 97 0, 0, this );
98 editSettings->addTo( settingsMenu ); 98 editSettings->addTo( settingsMenu );
99 connect( editSettings, SIGNAL( activated() ), 99 connect( editSettings, SIGNAL( activated() ),
100 SLOT( slotEditSettings() ) ); 100 SLOT( slotEditSettings() ) );
101 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 101 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
102 0, 0, this ); 102 0, 0, this );
103 editAccounts->addTo( settingsMenu ); 103 editAccounts->addTo( settingsMenu );
104 codecMenu = new QPopupMenu( menuBar ); 104 codecMenu = new QPopupMenu( menuBar );
105 codecMenu->insertItem( "Western (iso-8859-1)",0,0); 105 codecMenu->insertItem( "Western (iso-8859-1)",0,0);
106 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1); 106 codecMenu->insertItem( "Cyrillic (iso-8859-5)",1,1);
107 codecMenu->insertItem( "Western (iso-8859-15)",2,2); 107 codecMenu->insertItem( "Western (iso-8859-15)",2,2);
108 codecMenu->insertItem( "Chinese (big-5)",3,3); 108 codecMenu->insertItem( "Chinese (big-5)",3,3);
109 codecMenu->insertItem( "Unicode (utf-8)",4,4); 109 codecMenu->insertItem( "Unicode (utf-8)",4,4);
110 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5); 110 codecMenu->insertItem( "Userdefined ("+KOPrefs::instance()->mSendCodec+")",5,5);
111 //disabled 111 //disabled
112 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu); 112 //settingsMenu->insertItem( i18n("Codec for new mails"), codecMenu);
113 //setCentralWidget( view ); 113 //setCentralWidget( view );
114 114
115 QVBox* wrapperBox = new QVBox( this ); 115 QVBox* wrapperBox = new QVBox( this );
116 setCentralWidget( wrapperBox ); 116 setCentralWidget( wrapperBox );
117 117
118 // QWidget *view = new QWidget( wrapperBox ); 118 // QWidget *view = new QWidget( wrapperBox );
119 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 119 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
120 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 120 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
121 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 121 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
122 122
123 folderView = new AccountView( split ); 123 folderView = new AccountView( split );
124 folderView->header()->hide(); 124 folderView->header()->hide();
125 folderView->setRootIsDecorated( false ); 125 folderView->setRootIsDecorated( false );
126 folderView->addColumn( i18n( "Mailbox" ) ); 126 folderView->addColumn( i18n( "Mailbox" ) );
127 127
128 //layout->addWidget( folderView ); 128 //layout->addWidget( folderView );
129 129
130 mailView = new QListView( split ); 130 mailView = new QListView( split );
131 mailView->addColumn( i18n( " " ) ); 131 mailView->addColumn( i18n( " " ) );
132 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 132 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
133 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 133 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
134 mailView->addColumn( i18n( "Size" ),QListView::Manual); 134 mailView->addColumn( i18n( "Size" ),QListView::Manual);
135 mailView->addColumn( i18n( "Date" ),QListView::Manual); 135 mailView->addColumn( i18n( "Date" ),QListView::Manual);
136 if ( KOPrefs::instance()->mShowToField )
137 mailView->addColumn( i18n( "To" ),QListView::Manual);
136 mailView->setAllColumnsShowFocus(true); 138 mailView->setAllColumnsShowFocus(true);
137 //mailView->setSorting(-1); 139 //mailView->setSorting(-1);
138 mailView->setRootIsDecorated( false ); 140 mailView->setRootIsDecorated( false );
139 statusWidget = new StatusWidget( wrapperBox ); 141 statusWidget = new StatusWidget( wrapperBox );
140 statusWidget->hide(); 142 statusWidget->hide();
141 143
142 //layout->addWidget( mailView ); 144 //layout->addWidget( mailView );
143 //layout->setStretchFactor( folderView, 1 ); 145 //layout->setStretchFactor( folderView, 1 );
144 //layout->setStretchFactor( mailView, 2 ); 146 //layout->setStretchFactor( mailView, 2 );
145 147
146 slotAdjustLayout(); 148 slotAdjustLayout();
147#ifndef DESKTOP_VERSION 149#ifndef DESKTOP_VERSION
148 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 150 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
149 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 151 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
150#endif 152#endif
151 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 153 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
152 SLOT( mailLeftClicked(QListViewItem*) ) ); 154 SLOT( mailLeftClicked(QListViewItem*) ) );
153 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 155 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
154 SLOT( mailLeftClicked(QListViewItem*) ) ); 156 SLOT( mailLeftClicked(QListViewItem*) ) );
155 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 157 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
156 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 158 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
157 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 159 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
158 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 160 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
159 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 161 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
160 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 162 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
161// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 163// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
162 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 164 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
163 //mailView->setMultiSelection ( true ); 165 //mailView->setMultiSelection ( true );
164 mailView->setSelectionMode( QListView::Extended ); 166 mailView->setSelectionMode( QListView::Extended );
165 QValueList<int> list; 167 QValueList<int> list;
166 int fw = 100; 168 int fw = 100;
167 if ( QApplication::desktop()->width() > 320 ) 169 if ( QApplication::desktop()->width() > 320 )
168 fw = 50; 170 fw = 50;
169 list.append( fw ); 171 list.append( fw );
170 list.append( 100 ); 172 list.append( 100 );
171 split->setSizes( list ); 173 split->setSizes( list );
172 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 174 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
173 mailView->setShowSortIndicator ( true ); 175 mailView->setShowSortIndicator ( true );
174 QLabel *spacer = new QLabel( toolBar ); 176 QLabel *spacer = new QLabel( toolBar );
175 spacer->setBackgroundMode( QWidget::PaletteButton ); 177 spacer->setBackgroundMode( QWidget::PaletteButton );
176 toolBar->setStretchableWidget( spacer ); 178 toolBar->setStretchableWidget( spacer );
177 179
178 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); 180 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
179 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 181 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
180 if ( QApplication::desktop()->width() > 320 ) 182 if ( QApplication::desktop()->width() > 320 )
181 closeMail->addTo(toolBar); 183 closeMail->addTo(toolBar);
182 closeMail->addTo(mailMenu); 184 closeMail->addTo(mailMenu);
183 185
184 186
185 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 187 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
186 menuBar->insertItem( i18n( "Help" ), helpMenu ); 188 menuBar->insertItem( i18n( "Help" ), helpMenu );
187 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); 189 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this);
188 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 190 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
189 li->addTo(helpMenu); 191 li->addTo(helpMenu);
190 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); 192 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this);
191 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 193 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
192 li->addTo(helpMenu); 194 li->addTo(helpMenu);
193 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); 195 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this);
194 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 196 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
195 li->addTo(helpMenu); 197 li->addTo(helpMenu);
196 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); 198 connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) );
197 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 199 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
198#ifdef DESKTOP_VERSION 200#ifdef DESKTOP_VERSION
199 resize ( 640, 480 ); 201 resize ( 640, 480 );
200#endif 202#endif
201} 203}
202 204
203MainWindow::~MainWindow() 205MainWindow::~MainWindow()
204{ 206{
205} 207}
206 208
207void MainWindow::slotSetCodec( int codec ) 209void MainWindow::slotSetCodec( int codec )
208{ 210{
209 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); 211 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false );
210 //qDebug("codec %d ", codec); 212 //qDebug("codec %d ", codec);
211 KOPrefs::instance()->mCurrentCodec = codec; 213 KOPrefs::instance()->mCurrentCodec = codec;
212 KOPrefs::instance()->isDirty = true; 214 KOPrefs::instance()->isDirty = true;
213 QString name; 215 QString name;
214 switch ( codec ) { 216 switch ( codec ) {
215 case 0: 217 case 0:
216 name = "iso-8859-1"; 218 name = "iso-8859-1";
217 break; 219 break;
218 case 1: 220 case 1:
219 name = "iso-8859-5"; 221 name = "iso-8859-5";
220 break; 222 break;
221 case 2: 223 case 2:
222 name = "iso-8859-15"; 224 name = "iso-8859-15";
223 break; 225 break;
224 case 3: 226 case 3:
225 name = "big-5"; 227 name = "big-5";
226 break; 228 break;
227 case 4: 229 case 4:
228 name = "utf-8"; 230 name = "utf-8";
229 break; 231 break;
230 case 5: 232 case 5:
231 name = KOPrefs::instance()->mSendCodec.lower(); 233 name = KOPrefs::instance()->mSendCodec.lower();
232 break; 234 break;
233 } 235 }
234 KOPrefs::instance()->mCurrentCodeName = name ; 236 KOPrefs::instance()->mCurrentCodeName = name ;
235 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); 237 codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")");
236 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); 238 codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true );
237} 239}
238void MainWindow::showLicence() 240void MainWindow::showLicence()
239{ 241{
240 KApplication::showLicence(); 242 KApplication::showLicence();
241} 243}
242void MainWindow::showAbout() 244void MainWindow::showAbout()
243{ 245{
244 QString version; 246 QString version;
245#include <../version> 247#include <../version>
246 248
247 QString cap = "About KOpieMail/Pi"; 249 QString cap = "About KOpieMail/Pi";
248 QString text =i18n("KOpieMail/Platform-independent\n") + 250 QString text =i18n("KOpieMail/Platform-independent\n") +
249 "(OM/Pi) " + version + " - " 251 "(OM/Pi) " + version + " - "
250 252
251#ifdef DESKTOP_VERSION 253#ifdef DESKTOP_VERSION
252 "Desktop Edition\n" 254 "Desktop Edition\n"
253#else 255#else
254 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 256 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
255#endif 257#endif
256 "www.pi-sync.net\n\n" 258 "www.pi-sync.net\n\n"
257 259
258 260
259 261
260"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" 262"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n"
261 "KOpieMail/Pi is based on Opie Mail\n" 263 "KOpieMail/Pi is based on Opie Mail\n"
262 "Copyright (c) Rajko Albrecht and the Opie team\n" 264 "Copyright (c) Rajko Albrecht and the Opie team\n"
263 "KOpieMail/Pi is licensed under the GPL\n" 265 "KOpieMail/Pi is licensed under the GPL\n"
264 "\n" 266 "\n"
265 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 267 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
266 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 268 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
267 "libEtPan has its own licence - see LibEtPan licence\n"; 269 "libEtPan has its own licence - see LibEtPan licence\n";
268 270
269 KApplication::showText( cap, text ); 271 KApplication::showText( cap, text );
270} 272}
271void MainWindow::showEtpanLicence() 273void MainWindow::showEtpanLicence()
272{ 274{
273 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 275 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
274 276
275} 277}
276void MainWindow::appMessage(const QCString &, const QByteArray &) 278void MainWindow::appMessage(const QCString &, const QByteArray &)
277{ 279{
278 qDebug("appMessage implemented by subclass"); 280 qDebug("appMessage implemented by subclass");
279} 281}
280 282
281void MainWindow::slotAdjustLayout() { 283void MainWindow::slotAdjustLayout() {
282 284
283 /* 285 /*
284 QWidget *d = QApplication::desktop(); 286 QWidget *d = QApplication::desktop();
285 287
286 if ( d->width() < d->height() ) { 288 if ( d->width() < d->height() ) {
287 layout->setDirection( QBoxLayout::TopToBottom ); 289 layout->setDirection( QBoxLayout::TopToBottom );
288 } else { 290 } else {
289 layout->setDirection( QBoxLayout::LeftToRight ); 291 layout->setDirection( QBoxLayout::LeftToRight );
290 } 292 }
291 */ 293 */
292} 294}
293 295
294void MainWindow::slotAdjustColumns() 296void MainWindow::slotAdjustColumns()
295{ 297{
296 bool hidden = folderView->isHidden(); 298 bool hidden = folderView->isHidden();
297 if ( hidden ) folderView->show(); 299 if ( hidden ) folderView->show();
298 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 300 folderView->setColumnWidth( 0, folderView->visibleWidth() );
299 if ( hidden ) folderView->hide(); 301 if ( hidden ) folderView->hide();
300 302
301 mailView->setColumnWidth( 0, 10 ); 303 mailView->setColumnWidth( 0, 10 );
302 mailView->setColumnWidth( 1, 100 ); 304 mailView->setColumnWidth( 1, 100 );
303 mailView->setColumnWidth( 2, 100 ); 305 mailView->setColumnWidth( 2, 100 );
304 mailView->setColumnWidth( 3, 50 ); 306 mailView->setColumnWidth( 3, 50 );
305 mailView->setColumnWidth( 4, 120 ); 307 mailView->setColumnWidth( 4, 120 );
308 if ( KOPrefs::instance()->mShowToField )
309 mailView->setColumnWidth( 5, 100 );
306} 310}
307 311
308void MainWindow::slotEditSettings() 312void MainWindow::slotEditSettings()
309{ 313{
310} 314}
311 315
312void MainWindow::slotShowFolders( bool ) 316void MainWindow::slotShowFolders( bool )
313{ 317{
314 qDebug("not implemented: "); 318 qDebug("not implemented: ");
315} 319}
316 320
317void MainWindow::refreshMailView(const QValueList<RecMailP>&) 321void MainWindow::refreshMailView(const QValueList<RecMailP>&)
318{ 322{
319 qDebug("not implemented: "); 323 qDebug("not implemented: ");
320} 324}
321 325
322void MainWindow::mailLeftClicked(QListViewItem * ) 326void MainWindow::mailLeftClicked(QListViewItem * )
323{ 327{
324 qDebug("not implemented: "); 328 qDebug("not implemented: ");
325} 329}
326 330
327void MainWindow::displayMail() 331void MainWindow::displayMail()
328{ 332{
329 qDebug("not implemented: "); 333 qDebug("not implemented: ");
330} 334}
331 335
332void MainWindow::slotDeleteMail() 336void MainWindow::slotDeleteMail()
333{ 337{
334 qDebug("not implemented: "); 338 qDebug("not implemented: ");
335} 339}
336 340
337void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 341void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
338{ 342{
339 qDebug("not implemented: "); 343 qDebug("not implemented: ");
340} 344}
341 345
342void MainWindow::slotSendQueued() 346void MainWindow::slotSendQueued()
343{ 347{
344 qDebug("not implemented: "); 348 qDebug("not implemented: ");
345} 349}
346 350
347void MainWindow::slotEditAccounts() 351void MainWindow::slotEditAccounts()
348{ 352{
349 qDebug("not implemented: "); 353 qDebug("not implemented: ");
350} 354}
351 355
352void MainWindow::slotComposeMail() 356void MainWindow::slotComposeMail()
353{ 357{
354 qDebug("not implemented: "); 358 qDebug("not implemented: ");
355} 359}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 915b3e8..6e54bf4 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,587 +1,602 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4
5#define protected public
6#include <qwidget.h>
7#undef protected
4#include "koprefsdialog.h" 8#include "koprefsdialog.h"
5#include <kapplication.h> 9#include <kapplication.h>
6#include <libkdepim/externalapphandler.h> 10#include <libkdepim/externalapphandler.h>
7#include <libkdepim/kpimglobalprefs.h> 11#include <libkdepim/kpimglobalprefs.h>
8#ifdef MINIKDE_KDIALOG_H 12#ifdef MINIKDE_KDIALOG_H
9#undef MINIKDE_KDIALOG_H 13#undef MINIKDE_KDIALOG_H
10#endif 14#endif
11#include "settingsdialog.h" 15#include "settingsdialog.h"
12#include "opiemail.h" 16#include "opiemail.h"
13#include "editaccounts.h" 17#include "editaccounts.h"
14#include "composemail.h" 18#include "composemail.h"
15#include "mailistviewitem.h" 19#include "mailistviewitem.h"
16#include "viewmail.h" 20#include "viewmail.h"
17#include "selectstore.h" 21#include "selectstore.h"
18#include "selectsmtp.h" 22#include "selectsmtp.h"
19#include "accountitem.h" 23#include "accountitem.h"
20#include "klocale.h" 24#include "klocale.h"
21 25
22#include <qmessagebox.h> 26#include <qmessagebox.h>
23#include <qtimer.h> 27#include <qtimer.h>
24#include <qcursor.h> 28#include <qcursor.h>
29#include <qtextbrowser.h>
25#include <qregexp.h> 30#include <qregexp.h>
26#include <qpe/global.h> 31#include <qpe/global.h>
27 32
28#ifdef DESKTOP_VERSION 33#ifdef DESKTOP_VERSION
29#include <qapplication.h> 34#include <qapplication.h>
30#else 35#else
31#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
32#endif 37#endif
33#include <libmailwrapper/smtpwrapper.h> 38#include <libmailwrapper/smtpwrapper.h>
34#include <libmailwrapper/mailtypes.h> 39#include <libmailwrapper/mailtypes.h>
35#include <libmailwrapper/abstractmail.h> 40#include <libmailwrapper/abstractmail.h>
36#include "koprefs.h" 41#include "koprefs.h"
37 42
38//using namespace Opie::Core; 43//using namespace Opie::Core;
39 44
40OpieMail::OpieMail( QWidget *parent, const char *name ) 45OpieMail::OpieMail( QWidget *parent, const char *name )
41 : MainWindow( parent, name) //, WStyle_ContextHelp ) 46 : MainWindow( parent, name) //, WStyle_ContextHelp )
42{ 47{
43 settings = new Settings(); 48 settings = new Settings();
44 49 tb = 0;
45 setIcon(SmallIcon( "kmicromail" ) ); 50 setIcon(SmallIcon( "kmicromail" ) );
46 folderView->populate( settings->getAccounts() ); 51 folderView->populate( settings->getAccounts() );
47 52
48} 53}
49 54
50OpieMail::~OpieMail() 55OpieMail::~OpieMail()
51{ 56{
52 if (settings) delete settings; 57 if (settings) delete settings;
58 if ( tb )
59 delete tb;
53} 60}
54 61
55void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 62void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
56{ 63{
57 64
58} 65}
59#include <stdlib.h> 66#include <stdlib.h>
60void OpieMail::message(const QCString &msg, const QByteArray &data) 67void OpieMail::message(const QCString &msg, const QByteArray &data)
61{ 68{
62 // copied from old mail2 69 // copied from old mail2
63 static int ii = 0; 70 static int ii = 0;
64 //qDebug("QCOP CALL ############################# %d ", ii); 71 //qDebug("QCOP CALL ############################# %d ", ii);
65 //QString mess ( msg ); 72 //QString mess ( msg );
66 //qDebug("Message = %s ",mess.latin1()); 73 //qDebug("Message = %s ",mess.latin1());
67 ++ii; 74 ++ii;
68 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 75 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
69 76
70 mPendingEmail = QString::null; 77 mPendingEmail = QString::null;
71 mPendingName = QString::null; 78 mPendingName = QString::null;
72 if (msg == "writeMail(QString,QString)") 79 if (msg == "writeMail(QString,QString)")
73 { 80 {
74 //qDebug("writeMail(QString,QString) "); 81 //qDebug("writeMail(QString,QString) ");
75 QDataStream stream(data,IO_ReadOnly); 82 QDataStream stream(data,IO_ReadOnly);
76 stream >> mPendingName >> mPendingEmail; 83 stream >> mPendingName >> mPendingEmail;
77 // removing the whitespaces at beginning and end is needed! 84 // removing the whitespaces at beginning and end is needed!
78 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 85 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
79 } 86 }
80 else if (msg == "newMail()") 87 else if (msg == "newMail()")
81 { 88 {
82 //qDebug("slotComposeMail() "); 89 //qDebug("slotComposeMail() ");
83 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 90 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
84 // and a QCOP call does not like a processevents in his execution 91 // and a QCOP call does not like a processevents in his execution
85 // with the Qtimer we call slotComposeMail() after we reached the main event loop 92 // with the Qtimer we call slotComposeMail() after we reached the main event loop
86 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 93 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
87 // slotComposeMail(); 94 // slotComposeMail();
88 } 95 }
89 else if (msg == "newMail(QString)") 96 else if (msg == "newMail(QString)")
90 { 97 {
91 //qDebug(" newMail(QString)"); 98 //qDebug(" newMail(QString)");
92 QDataStream stream(data,IO_ReadOnly); 99 QDataStream stream(data,IO_ReadOnly);
93 stream >> mPendingName; 100 stream >> mPendingName;
94 // the format is 101 // the format is
95 // NAME <EMAIL>:SUBJECT 102 // NAME <EMAIL>:SUBJECT
96 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 103 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
97 } else { 104 } else {
98 mPendingData = data; 105 mPendingData = data;
99 mPendingMessage = msg; 106 mPendingMessage = msg;
100 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 107 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
101 } 108 }
102 109
103 //qDebug("END OpieMail::message "); 110 //qDebug("END OpieMail::message ");
104} 111}
105void OpieMail::slotExtAppHandler() 112void OpieMail::slotExtAppHandler()
106{ 113{
107 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 114 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
108} 115}
109void OpieMail::slotwriteMail2(const QString& namemail ) 116void OpieMail::slotwriteMail2(const QString& namemail )
110{ 117{
111 //qDebug("OpieMail::slotwriteMail2 "); 118 //qDebug("OpieMail::slotwriteMail2 ");
112 //qApp->processEvents(); 119 //qApp->processEvents();
113 ComposeMail compose( settings, this, 0, true ); 120 ComposeMail compose( settings, this, 0, true );
114 if ( !namemail.isEmpty() ) { 121 if ( !namemail.isEmpty() ) {
115 QString to = namemail; 122 QString to = namemail;
116 if ( namemail.find( " <") > 1 ) { 123 if ( namemail.find( " <") > 1 ) {
117 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 124 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
118 } else 125 } else
119 if ( namemail.find( "<") > 1 ) { 126 if ( namemail.find( "<") > 1 ) {
120 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 127 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
121 } 128 }
122 int sub = to.find( ">:"); 129 int sub = to.find( ">:");
123 if ( sub > 0 ) { 130 if ( sub > 0 ) {
124 compose.setTo( to.left(sub+1) ); 131 compose.setTo( to.left(sub+1) );
125 compose.setSubject( to.mid(sub+2) ); 132 compose.setSubject( to.mid(sub+2) );
126 } else 133 } else
127 compose.setTo( to ); 134 compose.setTo( to );
128 } 135 }
129 compose.slotAdjustColumns(); 136 compose.slotAdjustColumns();
130#ifndef DESKTOP_VERSION 137#ifndef DESKTOP_VERSION
131 compose.showMaximized(); 138 compose.showMaximized();
132#endif 139#endif
133 compose.exec(); 140 compose.exec();
134 raise(); 141 raise();
135 //qDebug("retttich "); 142 //qDebug("retttich ");
136} 143}
137void OpieMail::slotwriteMail(const QString&name,const QString&email) 144void OpieMail::slotwriteMail(const QString&name,const QString&email)
138{ 145{
139 // qDebug("OpieMail::slotwriteMail "); 146 // qDebug("OpieMail::slotwriteMail ");
140 ComposeMail compose( settings, this, 0, true ); 147 ComposeMail compose( settings, this, 0, true );
141 if (!email.isEmpty()) 148 if (!email.isEmpty())
142 { 149 {
143 if (!name.isEmpty()) 150 if (!name.isEmpty())
144 { 151 {
145 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 152 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
146 } 153 }
147 else 154 else
148 { 155 {
149 compose.setTo(email); 156 compose.setTo(email);
150 } 157 }
151 } 158 }
152 compose.slotAdjustColumns(); 159 compose.slotAdjustColumns();
153#ifndef DESKTOP_VERSION 160#ifndef DESKTOP_VERSION
154 compose.showMaximized(); 161 compose.showMaximized();
155#endif 162#endif
156 compose.exec(); 163 compose.exec();
157 raise(); 164 raise();
158} 165}
159 166
160void OpieMail::slotComposeMail() 167void OpieMail::slotComposeMail()
161{ 168{
162 if ( mPendingEmail == QString::null && mPendingName == QString::null) 169 if ( mPendingEmail == QString::null && mPendingName == QString::null)
163 slotwriteMail2( QString () ); 170 slotwriteMail2( QString () );
164 else { 171 else {
165 if ( mPendingEmail == QString::null ) 172 if ( mPendingEmail == QString::null )
166 slotwriteMail2( mPendingName ); 173 slotwriteMail2( mPendingName );
167 else 174 else
168 slotwriteMail( mPendingName, mPendingEmail ); 175 slotwriteMail( mPendingName, mPendingEmail );
169 } 176 }
170 //slotwriteMail(0l,0l); 177 //slotwriteMail(0l,0l);
171} 178}
172 179
173void OpieMail::slotSendQueued() 180void OpieMail::slotSendQueued()
174{ 181{
175 SMTPaccount *smtp = 0; 182 SMTPaccount *smtp = 0;
176 183
177 QList<Account> list = settings->getAccounts(); 184 QList<Account> list = settings->getAccounts();
178 QList<SMTPaccount> smtpList; 185 QList<SMTPaccount> smtpList;
179 smtpList.setAutoDelete(false); 186 smtpList.setAutoDelete(false);
180 Account *it; 187 Account *it;
181 for ( it = list.first(); it; it = list.next() ) 188 for ( it = list.first(); it; it = list.next() )
182 { 189 {
183 if ( it->getType() == MAILLIB::A_SMTP ) 190 if ( it->getType() == MAILLIB::A_SMTP )
184 { 191 {
185 smtp = static_cast<SMTPaccount *>(it); 192 smtp = static_cast<SMTPaccount *>(it);
186 smtpList.append(smtp); 193 smtpList.append(smtp);
187 } 194 }
188 } 195 }
189 if (smtpList.count()==0) 196 if (smtpList.count()==0)
190 { 197 {
191 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); 198 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n"));
192 return; 199 return;
193 } 200 }
194 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 201 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
195 return; 202 return;
196 if (smtpList.count()==1) 203 if (smtpList.count()==1)
197 { 204 {
198 smtp = smtpList.at(0); 205 smtp = smtpList.at(0);
199 } 206 }
200 else 207 else
201 { 208 {
202 smtp = 0; 209 smtp = 0;
203 selectsmtp selsmtp; 210 selectsmtp selsmtp;
204 selsmtp.setSelectionlist(&smtpList); 211 selsmtp.setSelectionlist(&smtpList);
205#ifndef DESKTOP_VERSION 212#ifndef DESKTOP_VERSION
206 selsmtp.showMaximized(); 213 selsmtp.showMaximized();
207#endif 214#endif
208 if ( selsmtp.exec() == QDialog::Accepted ) 215 if ( selsmtp.exec() == QDialog::Accepted )
209 { 216 {
210 smtp = selsmtp.selected_smtp(); 217 smtp = selsmtp.selected_smtp();
211 } 218 }
212 } 219 }
213 if (smtp) 220 if (smtp)
214 { 221 {
215 222
216 Global::statusMessage("Sending mails...!"); 223 Global::statusMessage("Sending mails...!");
217 SMTPwrapper * wrap = new SMTPwrapper(smtp); 224 SMTPwrapper * wrap = new SMTPwrapper(smtp);
218 if ( wrap->flushOutbox() ) 225 if ( wrap->flushOutbox() )
219 { 226 {
220 Global::statusMessage("Mails sent!"); 227 Global::statusMessage("Mails sent!");
221 } 228 }
222 delete wrap; 229 delete wrap;
223 } 230 }
224 // pending refresh list view, if outgoing is displayed 231 // pending refresh list view, if outgoing is displayed
225} 232}
226 233
227void OpieMail::slotSearchMails() 234void OpieMail::slotSearchMails()
228{ 235{
229 qDebug("OpieMail::slotSearchMails():not implemented "); 236 qDebug("OpieMail::slotSearchMails():not implemented ");
230} 237}
231 238
232void OpieMail::slotEditSettings() 239void OpieMail::slotEditSettings()
233{ 240{
234 241
235 KOPrefsDialog settingsDialog( this, "koprefs", true ); 242 KOPrefsDialog settingsDialog( this, "koprefs", true );
236#ifndef DESKTOP_VERSION 243#ifndef DESKTOP_VERSION
237 settingsDialog.showMaximized(); 244 settingsDialog.showMaximized();
238#endif 245#endif
239 settingsDialog.exec(); 246 settingsDialog.exec();
240 247
241 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 248 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
242 // KApplication::execDialog(settingsDialog); 249 // KApplication::execDialog(settingsDialog);
243} 250}
244 251
245void OpieMail::slotEditAccounts() 252void OpieMail::slotEditAccounts()
246{ 253{
247 EditAccounts eaDialog( settings, this, 0, true ); 254 EditAccounts eaDialog( settings, this, 0, true );
248 eaDialog.slotAdjustColumns(); 255 eaDialog.slotAdjustColumns();
249#ifndef DESKTOP_VERSION 256#ifndef DESKTOP_VERSION
250 eaDialog.showMaximized(); 257 eaDialog.showMaximized();
251#endif 258#endif
252 eaDialog.exec(); 259 eaDialog.exec();
253 if ( settings ) delete settings; 260 if ( settings ) delete settings;
254 settings = new Settings(); 261 settings = new Settings();
255 262
256 folderView->populate( settings->getAccounts() ); 263 folderView->populate( settings->getAccounts() );
257} 264}
258void OpieMail::replyMail() 265void OpieMail::replyMail()
259{ 266{
260 267
261 QListViewItem*item = mailView->currentItem(); 268 QListViewItem*item = mailView->currentItem();
262 if (!item) return; 269 if (!item) return;
263 RecMailP mail = ((MailListViewItem*)item)->data(); 270 RecMailP mail = ((MailListViewItem*)item)->data();
264 RecBodyP body = folderView->fetchBody(mail); 271 RecBodyP body = folderView->fetchBody(mail);
265 272
266 QString rtext; 273 QString rtext;
267 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 274 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
268 .arg( mail->getFrom()) 275 .arg( mail->getFrom())
269 .arg( mail->getDate()); 276 .arg( mail->getDate());
270 277
271 QString text = body->Bodytext(); 278 QString text = body->Bodytext();
272 QStringList lines = QStringList::split(QRegExp("\\n"), text); 279 QStringList lines = QStringList::split(QRegExp("\\n"), text);
273 QStringList::Iterator it; 280 QStringList::Iterator it;
274 for (it = lines.begin(); it != lines.end(); it++) 281 for (it = lines.begin(); it != lines.end(); it++)
275 { 282 {
276 rtext += "> " + *it + "\n"; 283 rtext += "> " + *it + "\n";
277 } 284 }
278 rtext += "\n"; 285 rtext += "\n";
279 286
280 QString prefix; 287 QString prefix;
281 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; 288 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
282 else prefix = "Re: "; // no i18n on purpose 289 else prefix = "Re: "; // no i18n on purpose
283 290
284 Settings *settings = new Settings(); 291 Settings *settings = new Settings();
285 ComposeMail composer( settings ,this, 0, true); 292 ComposeMail composer( settings ,this, 0, true);
286 if (mail->Replyto().isEmpty()) { 293 if (mail->Replyto().isEmpty()) {
287 composer.setTo( mail->getFrom()); 294 composer.setTo( mail->getFrom());
288 } else { 295 } else {
289 composer.setTo( mail->Replyto()); 296 composer.setTo( mail->Replyto());
290 } 297 }
291 composer.setSubject( prefix + mail->getSubject()); 298 composer.setSubject( prefix + mail->getSubject());
292 composer.setMessage( rtext ); 299 composer.setMessage( rtext );
293 composer.setInReplyTo( mail->Msgid()); 300 composer.setInReplyTo( mail->Msgid());
294 composer.setCharset( body->getCharset() ); 301 composer.setCharset( body->getCharset() );
295 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 302 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
296 { 303 {
297 mail->Wrapper()->answeredMail(mail); 304 mail->Wrapper()->answeredMail(mail);
298 } 305 }
299 delete settings; 306 delete settings;
300 307
301} 308}
302void OpieMail::closeViewMail(ViewMail * vm) 309void OpieMail::closeViewMail(ViewMail * vm)
303{ 310{
304 vm->hide(); 311 vm->hide();
305} 312}
313
314void OpieMail::slotDownloadMail( )
315{
316 qDebug("slotDownloadMail( ) ");
317}
318
319
306void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) 320void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
307{ 321{
308 QListViewItem*item = mailView->currentItem(); 322 QListViewItem*item = mailView->currentItem();
309 if (!item ) { 323 if (!item ) {
310 closeViewMail(vm); 324 closeViewMail(vm);
311 return; 325 return;
312 } 326 }
313 RecMailP mail = ((MailListViewItem*)item)->data(); 327 RecMailP mail = ((MailListViewItem*)item)->data();
314 mail->Wrapper()->deleteMail( mail ); 328 mail->Wrapper()->deleteMail( mail );
315 item = item->itemBelow(); 329 item = item->itemBelow();
316 if (!item ) { 330 if (!item ) {
317 closeViewMail(vm); 331 closeViewMail(vm);
318 return; 332 return;
319 } 333 }
320 mailView->setCurrentItem(item); 334 mailView->setCurrentItem(item);
321 mail = ((MailListViewItem*)item)->data(); 335 mail = ((MailListViewItem*)item)->data();
322 RecBodyP body = folderView->fetchBody(mail); 336 RecBodyP body = folderView->fetchBody(mail);
323 vm->setBody( body ); 337 vm->setBody( body );
324 vm->setMail( mail ); 338 vm->setMail( mail );
325} 339}
326void OpieMail::displayNextMail(ViewMail * vm) 340void OpieMail::displayNextMail(ViewMail * vm)
327{ 341{
328 QListViewItem*item = mailView->currentItem(); 342 QListViewItem*item = mailView->currentItem();
329 if (!item) return; 343 if (!item) return;
330 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 344 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
331 item = item->itemBelow(); 345 item = item->itemBelow();
332 if (!item) { 346 if (!item) {
333 vm->setCaption(i18n("End of List" )); 347 vm->setCaption(i18n("End of List" ));
334 return; 348 return;
335 } 349 }
336 mailView->setCurrentItem(item); 350 mailView->setCurrentItem(item);
337 RecMailP mail = ((MailListViewItem*)item)->data(); 351 RecMailP mail = ((MailListViewItem*)item)->data();
338 RecBodyP body = folderView->fetchBody(mail); 352 RecBodyP body = folderView->fetchBody(mail);
339 vm->setBody( body ); 353 vm->setBody( body );
340 vm->setMail( mail ); 354 vm->setMail( mail );
341} 355}
342void OpieMail::displayMail() 356void OpieMail::displayMail()
343{ 357{
344 QListViewItem*item = mailView->currentItem(); 358 QListViewItem*item = mailView->currentItem();
345 if (!item) return; 359 if (!item) return;
346 RecMailP mail = ((MailListViewItem*)item)->data(); 360 RecMailP mail = ((MailListViewItem*)item)->data();
347 RecBodyP body = folderView->fetchBody(mail); 361 RecBodyP body = folderView->fetchBody(mail);
348 ViewMail readMail( this,"", Qt::WType_Modal ); 362 ViewMail readMail( this,"", Qt::WType_Modal );
349 readMail.setBody( body ); 363 readMail.setBody( body );
350 readMail.setMail( mail ); 364 readMail.setMail( mail );
351#ifndef DESKTOP_VERSION 365#ifndef DESKTOP_VERSION
352 readMail.showMaximized(); 366 readMail.showMaximized();
353#else 367#else
354 readMail.resize( 640, 480); 368 readMail.resize( 640, 480);
355#endif 369#endif
356 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); 370 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
357 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); 371 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
372 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
358 373
359 readMail.exec(); 374 readMail.exec();
360 375
361 if ( readMail.deleted ) 376 if ( readMail.deleted )
362 { 377 {
363 folderView->refreshCurrent(); 378 folderView->refreshCurrent();
364 } 379 }
365 else 380 else
366 { 381 {
367 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 382 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
368 } 383 }
369} 384}
370void OpieMail::slotGetAllMail() 385void OpieMail::slotGetAllMail()
371{ 386{
372 QListViewItem * item = folderView->firstChild(); 387 QListViewItem * item = folderView->firstChild();
373 while ( item ){ 388 while ( item ){
374 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 389 ((AccountViewItem *)item)->contextMenuSelected( 101 );
375 item = item->nextSibling (); 390 item = item->nextSibling ();
376 } 391 }
377} 392}
378void OpieMail::slotGetMail() 393void OpieMail::slotGetMail()
379{ 394{
380 QListViewItem * item = folderView->currentItem(); 395 QListViewItem * item = folderView->currentItem();
381 if ( ! item ) return; 396 if ( ! item ) return;
382 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 397 ((AccountViewItem *)item)->contextMenuSelected( 101 );
383} 398}
384void OpieMail::slotDeleteMail() 399void OpieMail::slotDeleteMail()
385{ 400{
386 if (!mailView->currentItem()) return; 401 if (!mailView->currentItem()) return;
387 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 402 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
388 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 403 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
389 { 404 {
390 mail->Wrapper()->deleteMail( mail ); 405 mail->Wrapper()->deleteMail( mail );
391 folderView->refreshCurrent(); 406 folderView->refreshCurrent();
392 } 407 }
393} 408}
394void OpieMail::slotDeleteAllMail() 409void OpieMail::slotDeleteAllMail()
395{ 410{
396 411
397 QValueList<RecMailP> t; 412 QValueList<RecMailP> t;
398 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 413 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
399 { 414 {
400 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 415 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
401 while ( item ) { 416 while ( item ) {
402 if ( item->isSelected() ) { 417 if ( item->isSelected() ) {
403 t.append( item->data() ); 418 t.append( item->data() );
404 } 419 }
405 item = (MailListViewItem*)item->nextSibling(); 420 item = (MailListViewItem*)item->nextSibling();
406 } 421 }
407 } 422 }
408 else 423 else
409 return; 424 return;
410 if ( t.count() == 0 ) 425 if ( t.count() == 0 )
411 return; 426 return;
412 RecMailP mail = t.first(); 427 RecMailP mail = t.first();
413 mail->Wrapper()->deleteMailList(t); 428 mail->Wrapper()->deleteMailList(t);
414 folderView->refreshCurrent(); 429 folderView->refreshCurrent();
415 430
416 431
417} 432}
418void OpieMail::clearSelection() 433void OpieMail::clearSelection()
419{ 434{
420 mailView->clearSelection(); 435 mailView->clearSelection();
421 436
422} 437}
423 438
424void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 439void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
425{ 440{
426 if (!mailView->currentItem()) return; 441 if (!mailView->currentItem()) return;
427 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 442 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
428 /* just the RIGHT button - or hold on pda */ 443 /* just the RIGHT button - or hold on pda */
429 if (button!=2) {return;} 444 if (button!=2) {return;}
430 if (!item) return; 445 if (!item) return;
431 QPopupMenu *m = new QPopupMenu(0); 446 QPopupMenu *m = new QPopupMenu(0);
432 if (m) 447 if (m)
433 { 448 {
434 if (mailtype==MAILLIB::A_NNTP) { 449 if (mailtype==MAILLIB::A_NNTP) {
435 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); 450 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
436 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); 451 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
437 m->insertSeparator(); 452 m->insertSeparator();
438 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 453 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
439 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 454 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
440 } else { 455 } else {
441 if (folderView->currentisDraft()) { 456 if (folderView->currentisDraft()) {
442 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); 457 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
443 } 458 }
444 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); 459 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
445 m->insertSeparator(); 460 m->insertSeparator();
446 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); 461 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
447 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 462 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
448 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); 463 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
449 m->insertSeparator(); 464 m->insertSeparator();
450 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 465 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
451 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 466 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
452 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 467 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
453 } 468 }
454 m->setFocus(); 469 m->setFocus();
455 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 470 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
456 delete m; 471 delete m;
457 } 472 }
458} 473}
459 474
460void OpieMail::slotShowFolders( bool show ) 475void OpieMail::slotShowFolders( bool show )
461{ 476{
462 if ( show && folderView->isHidden() ) 477 if ( show && folderView->isHidden() )
463 { 478 {
464 folderView->show(); 479 folderView->show();
465 } 480 }
466 else if ( !show && !folderView->isHidden() ) 481 else if ( !show && !folderView->isHidden() )
467 { 482 {
468 folderView->hide(); 483 folderView->hide();
469 } 484 }
470} 485}
471 486
472void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 487void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
473{ 488{
474 MailListViewItem*item = 0; 489 MailListViewItem*item = 0;
475 mailView->clear(); 490 mailView->clear();
476 491
477 QValueList<RecMailP>::ConstIterator it; 492 QValueList<RecMailP>::ConstIterator it;
478 for (it = list.begin(); it != list.end();++it) 493 for (it = list.begin(); it != list.end();++it)
479 { 494 {
480 item = new MailListViewItem(mailView,item); 495 item = new MailListViewItem(mailView,item);
481 item->storeData((*it)); 496 item->storeData((*it));
482 item->showEntry(); 497 item->showEntry();
483 } 498 }
484 mailView->setSorting ( 4, false ); 499 mailView->setSorting ( 4, false );
485} 500}
486 501
487void OpieMail::mailLeftClicked( QListViewItem *item ) 502void OpieMail::mailLeftClicked( QListViewItem *item )
488{ 503{
489 mailView->clearSelection(); 504 mailView->clearSelection();
490 /* just LEFT button - or tap with stylus on pda */ 505 /* just LEFT button - or tap with stylus on pda */
491 //if (button!=1) return; 506 //if (button!=1) return;
492 if (!item) return; 507 if (!item) return;
493 if (folderView->currentisDraft()) { 508 if (folderView->currentisDraft()) {
494 reEditMail(); 509 reEditMail();
495 } else { 510 } else {
496 displayMail(); 511 displayMail();
497 } 512 }
498} 513}
499 514
500void OpieMail::slotMoveCopyMail() 515void OpieMail::slotMoveCopyMail()
501{ 516{
502 if (!mailView->currentItem()) return; 517 if (!mailView->currentItem()) return;
503 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 518 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
504 AbstractMail*targetMail = 0; 519 AbstractMail*targetMail = 0;
505 QString targetFolder = ""; 520 QString targetFolder = "";
506 Selectstore sels; 521 Selectstore sels;
507 folderView->setupFolderselect(&sels); 522 folderView->setupFolderselect(&sels);
508 if (!sels.exec()) return; 523 if (!sels.exec()) return;
509 targetMail = sels.currentMail(); 524 targetMail = sels.currentMail();
510 targetFolder = sels.currentFolder(); 525 targetFolder = sels.currentFolder();
511 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 526 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
512 targetFolder.isEmpty()) 527 targetFolder.isEmpty())
513 { 528 {
514 return; 529 return;
515 } 530 }
516 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 531 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
517 { 532 {
518 QMessageBox::critical(0,i18n("Error creating new Folder"), 533 QMessageBox::critical(0,i18n("Error creating new Folder"),
519 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 534 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
520 return; 535 return;
521 } 536 }
522 sels.hide(); 537 sels.hide();
523 qApp->processEvents(); 538 qApp->processEvents();
524 // qDebug("hiding sels "); 539 // qDebug("hiding sels ");
525 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 540 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
526 folderView->refreshCurrent(); 541 folderView->refreshCurrent();
527} 542}
528 543
529void OpieMail::slotMoveCopyAllMail() 544void OpieMail::slotMoveCopyAllMail()
530{ 545{
531 546
532 if (!mailView->currentItem()) return; 547 if (!mailView->currentItem()) return;
533 QValueList<RecMailP> t; 548 QValueList<RecMailP> t;
534 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 549 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
535 { 550 {
536 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 551 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
537 while ( item ) { 552 while ( item ) {
538 if ( item->isSelected() ) { 553 if ( item->isSelected() ) {
539 t.append( item->data() ); 554 t.append( item->data() );
540 } 555 }
541 item = (MailListViewItem*)item->nextSibling(); 556 item = (MailListViewItem*)item->nextSibling();
542 } 557 }
543 } 558 }
544 // else 559 // else
545 // return; 560 // return;
546 if ( t.count() == 0 ) 561 if ( t.count() == 0 )
547 return; 562 return;
548 RecMailP mail = t.first(); 563 RecMailP mail = t.first();
549 AbstractMail*targetMail = 0; 564 AbstractMail*targetMail = 0;
550 QString targetFolder = ""; 565 QString targetFolder = "";
551 Selectstore sels; 566 Selectstore sels;
552 folderView->setupFolderselect(&sels); 567 folderView->setupFolderselect(&sels);
553 if (!sels.exec()) return; 568 if (!sels.exec()) return;
554 targetMail = sels.currentMail(); 569 targetMail = sels.currentMail();
555 targetFolder = sels.currentFolder(); 570 targetFolder = sels.currentFolder();
556 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 571 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
557 targetFolder.isEmpty()) 572 targetFolder.isEmpty())
558 { 573 {
559 return; 574 return;
560 } 575 }
561 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 576 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
562 { 577 {
563 QMessageBox::critical(0,i18n("Error creating new Folder"), 578 QMessageBox::critical(0,i18n("Error creating new Folder"),
564 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 579 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
565 return; 580 return;
566 } 581 }
567 sels.hide(); 582 sels.hide();
568 qApp->processEvents(); 583 qApp->processEvents();
569 //qDebug("hiding sels "); 584 //qDebug("hiding sels ");
570 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); 585 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails());
571 folderView->refreshCurrent(); 586 folderView->refreshCurrent();
572} 587}
573 588
574void OpieMail::reEditMail() 589void OpieMail::reEditMail()
575{ 590{
576 if (!mailView->currentItem()) return; 591 if (!mailView->currentItem()) return;
577 592
578 ComposeMail compose( settings, this, 0, true ); 593 ComposeMail compose( settings, this, 0, true );
579 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 594 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
580 compose.slotAdjustColumns(); 595 compose.slotAdjustColumns();
581#ifndef DESKTOP_VERSION 596#ifndef DESKTOP_VERSION
582 compose.showMaximized(); 597 compose.showMaximized();
583#else 598#else
584 compose.resize(640,480); 599 compose.resize(640,480);
585#endif 600#endif
586 compose.exec(); 601 compose.exec();
587} 602}
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h
index a81a34c..b8a527f 100644
--- a/kmicromail/opiemail.h
+++ b/kmicromail/opiemail.h
@@ -1,60 +1,61 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2#ifndef OPIEMAIL_H 2#ifndef OPIEMAIL_H
3#define OPIEMAIL_H 3#define OPIEMAIL_H
4 4
5#include "mainwindow.h" 5#include "mainwindow.h"
6#include <libmailwrapper/settings.h> 6#include <libmailwrapper/settings.h>
7 7
8#include <opie2/osmartpointer.h> 8#include <opie2/osmartpointer.h>
9#include <libmailwrapper/mailtypes.h> 9#include <libmailwrapper/mailtypes.h>
10#include <viewmail.h> 10#include <viewmail.h>
11 11
12class OpieMail : public MainWindow 12class OpieMail : public MainWindow
13{ 13{
14 Q_OBJECT 14 Q_OBJECT
15 15
16public: 16public:
17 OpieMail( QWidget *parent = 0, const char *name = 0 ); 17 OpieMail( QWidget *parent = 0, const char *name = 0 );
18 virtual ~OpieMail(); 18 virtual ~OpieMail();
19 static QString appName() { return QString::fromLatin1("kopiemail"); } 19 static QString appName() { return QString::fromLatin1("kopiemail"); }
20 20
21public slots: 21public slots:
22 virtual void slotwriteMail(const QString&name,const QString&email); 22 virtual void slotwriteMail(const QString&name,const QString&email);
23 virtual void slotwriteMail2(const QString&nameemail); 23 virtual void slotwriteMail2(const QString&nameemail);
24 virtual void slotComposeMail(); 24 virtual void slotComposeMail();
25 virtual void slotExtAppHandler(); 25 virtual void slotExtAppHandler();
26 virtual void appMessage(const QCString &msg, const QByteArray &data); 26 virtual void appMessage(const QCString &msg, const QByteArray &data);
27 virtual void message(const QCString &msg, const QByteArray &data); 27 virtual void message(const QCString &msg, const QByteArray &data);
28protected slots: 28protected slots:
29 virtual void deleteAndDisplayNextMail(ViewMail * vm); 29 virtual void deleteAndDisplayNextMail(ViewMail * vm);
30 virtual void displayNextMail(ViewMail * vm); 30 virtual void displayNextMail(ViewMail * vm);
31 virtual void slotSendQueued(); 31 virtual void slotSendQueued();
32 virtual void slotSearchMails(); 32 virtual void slotSearchMails();
33 virtual void slotEditSettings(); 33 virtual void slotEditSettings();
34 virtual void slotEditAccounts(); 34 virtual void slotEditAccounts();
35 virtual void displayMail(); 35 virtual void displayMail();
36 virtual void replyMail(); 36 virtual void replyMail();
37 virtual void slotDeleteMail(); 37 virtual void slotDeleteMail();
38 virtual void slotGetMail(); 38 virtual void slotGetMail();
39 virtual void slotGetAllMail(); 39 virtual void slotGetAllMail();
40 virtual void slotDeleteAllMail(); 40 virtual void slotDeleteAllMail();
41 virtual void mailHold(int, QListViewItem *,const QPoint&,int); 41 virtual void mailHold(int, QListViewItem *,const QPoint&,int);
42 virtual void slotShowFolders( bool show ); 42 virtual void slotShowFolders( bool show );
43 virtual void refreshMailView(const QValueList<RecMailP>&); 43 virtual void refreshMailView(const QValueList<RecMailP>&);
44 virtual void mailLeftClicked( QListViewItem * ); 44 virtual void mailLeftClicked( QListViewItem * );
45 virtual void slotMoveCopyMail(); 45 virtual void slotMoveCopyMail();
46 virtual void slotMoveCopyAllMail(); 46 virtual void slotMoveCopyAllMail();
47 virtual void reEditMail(); 47 virtual void reEditMail();
48 void clearSelection(); 48 void clearSelection();
49 49 void slotDownloadMail();
50private: 50private:
51 void closeViewMail(ViewMail * vm); 51 void closeViewMail(ViewMail * vm);
52 QString mPendingEmail; 52 QString mPendingEmail;
53 QString mPendingName; 53 QString mPendingName;
54 QByteArray mPendingData; 54 QByteArray mPendingData;
55 QCString mPendingMessage; 55 QCString mPendingMessage;
56 Settings *settings; 56 Settings *settings;
57 QTextBrowser * tb;
57 58
58}; 59};
59 60
60#endif 61#endif
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 6d88cad..767a369 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -1,534 +1,557 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3 3
4 4
5#include <kfiledialog.h> 5#include <kfiledialog.h>
6#include "koprefs.h" 6#include "koprefs.h"
7#include <klocale.h> 7#include <klocale.h>
8#include <kglobal.h> 8#include <kglobal.h>
9#include <kapplication.h> 9#include <kapplication.h>
10 10
11#ifdef MINIKDE_KDIALOG_H 11#ifdef MINIKDE_KDIALOG_H
12#undef MINIKDE_KDIALOG_H 12#undef MINIKDE_KDIALOG_H
13#endif 13#endif
14 14
15#include "composemail.h" 15#include "composemail.h"
16#include "viewmail.h" 16#include "viewmail.h"
17 17
18#include <libmailwrapper/settings.h> 18#include <libmailwrapper/settings.h>
19#include <libmailwrapper/abstractmail.h> 19#include <libmailwrapper/abstractmail.h>
20#include <libmailwrapper/mailtypes.h> 20#include <libmailwrapper/mailtypes.h>
21 21
22#include <qdialog.h> 22#include <qdialog.h>
23 23
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25 25
26/* QT */ 26/* QT */
27#include <qtextbrowser.h> 27#include <qtextbrowser.h>
28#include <qmessagebox.h> 28#include <qmessagebox.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qaction.h> 30#include <qaction.h>
31#include <qpopupmenu.h> 31#include <qpopupmenu.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qlayout.h> 33#include <qlayout.h>
34 34
35//using namespace Opie::Ui; 35//using namespace Opie::Ui;
36//using namespace Opie::Core; 36//using namespace Opie::Core;
37 37
38AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 38AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
39 const QString&fsize,int num,const QValueList<int>&path) 39 const QString&fsize,int num,const QValueList<int>&path)
40 : QListViewItem(parent,after),_partNum(num) 40 : QListViewItem(parent,after),_partNum(num)
41{ 41{
42 _path=path; 42 _path=path;
43 setText(0, mime); 43 setText(0, mime);
44 setText(1, desc); 44 setText(1, desc);
45 setText(2, file); 45 setText(2, file);
46 setText(3, fsize); 46 setText(3, fsize);
47} 47}
48 48
49AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 49AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
50 const QString&fsize,int num,const QValueList<int>&path) 50 const QString&fsize,int num,const QValueList<int>&path)
51 : QListViewItem(parent,after),_partNum(num) 51 : QListViewItem(parent,after),_partNum(num)
52{ 52{
53 _path=path; 53 _path=path;
54 setText(0, mime); 54 setText(0, mime);
55 setText(1, desc); 55 setText(1, desc);
56 setText(2, file); 56 setText(2, file);
57 setText(3, fsize); 57 setText(3, fsize);
58} 58}
59 59
60bool AttachItem::isParentof(const QValueList<int>&path) 60bool AttachItem::isParentof(const QValueList<int>&path)
61{ 61{
62 /* if not set, then no parent */ 62 /* if not set, then no parent */
63 if (path.count()==0||_path.count()==0) return false; 63 if (path.count()==0||_path.count()==0) return false;
64 /* the parent must have one digit less then a child */ 64 /* the parent must have one digit less then a child */
65 if (path.count()!=_path.count()+1) return false; 65 if (path.count()!=_path.count()+1) return false;
66 for (unsigned int i=0; i < _path.count();++i) 66 for (unsigned int i=0; i < _path.count();++i)
67 { 67 {
68 if (_path[i]!=path[i]) return false; 68 if (_path[i]!=path[i]) return false;
69 } 69 }
70 return true; 70 return true;
71} 71}
72 72
73AttachItem* ViewMail::searchParent(const QValueList<int>&path) 73AttachItem* ViewMail::searchParent(const QValueList<int>&path)
74{ 74{
75 QListViewItemIterator it( attachments ); 75 QListViewItemIterator it( attachments );
76 for ( ; it.current(); ++it ) 76 for ( ; it.current(); ++it )
77 { 77 {
78 AttachItem*ati = (AttachItem*)it.current(); 78 AttachItem*ati = (AttachItem*)it.current();
79 if (ati->isParentof(path)) return ati; 79 if (ati->isParentof(path)) return ati;
80 } 80 }
81 return 0; 81 return 0;
82} 82}
83 83
84AttachItem* ViewMail::lastChild(AttachItem*parent) 84AttachItem* ViewMail::lastChild(AttachItem*parent)
85{ 85{
86 if (!parent) return 0; 86 if (!parent) return 0;
87 AttachItem* item = (AttachItem*)parent->firstChild(); 87 AttachItem* item = (AttachItem*)parent->firstChild();
88 if (!item) return item; 88 if (!item) return item;
89 AttachItem*temp=0; 89 AttachItem*temp=0;
90 while( (temp=(AttachItem*)item->nextSibling())) 90 while( (temp=(AttachItem*)item->nextSibling()))
91 { 91 {
92 item = temp; 92 item = temp;
93 } 93 }
94 return item; 94 return item;
95} 95}
96 96
97void ViewMail::setBody(const RecBodyP&body ) 97void ViewMail::setBody(const RecBodyP&body )
98{ 98{
99 99
100 m_body = body; 100 m_body = body;
101 m_mail[2] = body->Bodytext(); 101 m_mail[2] = body->Bodytext();
102 // qDebug("********text %s ",m_mail[2].latin1() ); 102 // qDebug("********text %s ",m_mail[2].latin1() );
103 attachbutton->setEnabled(body->Parts().count()>0); 103 attachbutton->setEnabled(body->Parts().count()>0);
104 attachments->setEnabled(body->Parts().count()>0); 104 attachments->setEnabled(body->Parts().count()>0);
105 if (body->Parts().count()==0) 105 if (body->Parts().count()==0)
106 { 106 {
107 return; 107 return;
108 } 108 }
109 AttachItem * curItem=0; 109 AttachItem * curItem=0;
110 AttachItem * parentItem = 0; 110 AttachItem * parentItem = 0;
111 QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); 111 QString type=body->Description()->Type()+"/"+body->Description()->Subtype();
112 QString desc,fsize; 112 QString desc,fsize;
113 double s = body->Description()->Size(); 113 double s = body->Description()->Size();
114 int w; 114 int w;
115 w=0; 115 w=0;
116 116
117 while (s>1024) 117 while (s>1024)
118 { 118 {
119 s/=1024; 119 s/=1024;
120 ++w; 120 ++w;
121 if (w>=2) break; 121 if (w>=2) break;
122 } 122 }
123 123
124 QString q=""; 124 QString q="";
125 switch(w) 125 switch(w)
126 { 126 {
127 case 1: 127 case 1:
128 q="k"; 128 q="k";
129 break; 129 break;
130 case 2: 130 case 2:
131 q="M"; 131 q="M";
132 break; 132 break;
133 default: 133 default:
134 break; 134 break;
135 } 135 }
136 136
137 { 137 {
138 /* I did not found a method to make a CONTENT reset on a QTextStream 138 /* I did not found a method to make a CONTENT reset on a QTextStream
139 so I use this construct that the stream will re-constructed in each 139 so I use this construct that the stream will re-constructed in each
140 loop. To let it work, the textstream is packed into a own area of 140 loop. To let it work, the textstream is packed into a own area of
141 code is it will be destructed after finishing its small job. 141 code is it will be destructed after finishing its small job.
142 */ 142 */
143 QTextOStream o(&fsize); 143 QTextOStream o(&fsize);
144 if (w>0) o.precision(2); else o.precision(0); 144 if (w>0) o.precision(2); else o.precision(0);
145 o.setf(QTextStream::fixed); 145 o.setf(QTextStream::fixed);
146 o << s << " " << q << "Byte"; 146 o << s << " " << q << "Byte";
147 } 147 }
148 148
149 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); 149 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist());
150 QString filename = ""; 150 QString filename = "";
151 151
152 for (unsigned int i = 0; i < body->Parts().count();++i) 152 for (unsigned int i = 0; i < body->Parts().count();++i)
153 { 153 {
154 filename = ""; 154 filename = "";
155 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); 155 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype();
156 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); 156 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin();
157 for (;it!=body->Parts()[i]->Parameters().end();++it) 157 for (;it!=body->Parts()[i]->Parameters().end();++it)
158 { 158 {
159 if (it.key().lower()=="name") 159 if (it.key().lower()=="name")
160 { 160 {
161 filename=it.data(); 161 filename=it.data();
162 } 162 }
163 } 163 }
164 s = body->Parts()[i]->Size(); 164 s = body->Parts()[i]->Size();
165 w = 0; 165 w = 0;
166 while (s>1024) 166 while (s>1024)
167 { 167 {
168 s/=1024; 168 s/=1024;
169 ++w; 169 ++w;
170 if (w>=2) break; 170 if (w>=2) break;
171 } 171 }
172 switch(w) 172 switch(w)
173 { 173 {
174 case 1: 174 case 1:
175 q="k"; 175 q="k";
176 break; 176 break;
177 case 2: 177 case 2:
178 q="M"; 178 q="M";
179 break; 179 break;
180 default: 180 default:
181 q=""; 181 q="";
182 break; 182 break;
183 } 183 }
184 QTextOStream o(&fsize); 184 QTextOStream o(&fsize);
185 if (w>0) o.precision(2); else o.precision(0); 185 if (w>0) o.precision(2); else o.precision(0);
186 o.setf(QTextStream::fixed); 186 o.setf(QTextStream::fixed);
187 o << s << " " << q << "Byte"; 187 o << s << " " << q << "Byte";
188 desc = body->Parts()[i]->Description(); 188 desc = body->Parts()[i]->Description();
189 parentItem = searchParent(body->Parts()[i]->Positionlist()); 189 parentItem = searchParent(body->Parts()[i]->Positionlist());
190 if (parentItem) 190 if (parentItem)
191 { 191 {
192 AttachItem*temp = lastChild(parentItem); 192 AttachItem*temp = lastChild(parentItem);
193 if (temp) curItem = temp; 193 if (temp) curItem = temp;
194 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 194 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
195 attachments->setRootIsDecorated(true); 195 attachments->setRootIsDecorated(true);
196 curItem = parentItem; 196 curItem = parentItem;
197 } 197 }
198 else 198 else
199 { 199 {
200 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 200 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
201 } 201 }
202 } 202 }
203} 203}
204 204
205 205
206void ViewMail::slotViewSource()
207{
208
209 if ( !sourceOn ) {
210 sourceOn = true;
211 viewSource->setText(i18n("View Body Text"));
212 encodedString*st = 0;
213 st = m_recMail->Wrapper()->fetchRawBody(m_recMail);
214 if ( st ) {
215 QString source = QString::fromUtf8( st->Content(), st->Length());
216 browser->setText( source );
217 delete st;
218 }
219 } else
220 setText();
221
222
223}
206void ViewMail::slotShowHtml( bool state ) 224void ViewMail::slotShowHtml( bool state )
207{ 225{
208 m_showHtml = state; 226 m_showHtml = state;
209 setText(); 227 setText();
210} 228}
211 229
212void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) 230void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
213{ 231{
214 if (!item ) 232 if (!item )
215 return; 233 return;
216 234
217 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 235 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
218 { 236 {
219 setText(); 237 setText();
220 return; 238 return;
221 } 239 }
222 QPopupMenu *menu = new QPopupMenu(); 240 QPopupMenu *menu = new QPopupMenu();
223 int ret=0; 241 int ret=0;
224 242
225 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 243 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
226 { 244 {
227 menu->insertItem( i18n( "Show Text" ), 1 ); 245 menu->insertItem( i18n( "Show Text" ), 1 );
228 } 246 }
229 if (item->text(0).left(6)=="image/") { 247 if (item->text(0).left(6)=="image/") {
230 menu->insertItem(i18n("Display image preview"),2); 248 menu->insertItem(i18n("Display image preview"),2);
231 } 249 }
232 menu->insertItem( i18n( "Save Attachment" ), 0 ); 250 menu->insertItem( i18n( "Save Attachment" ), 0 );
233 menu->insertSeparator(1); 251 menu->insertSeparator(1);
234 252
235 ret = menu->exec( point, 0 ); 253 ret = menu->exec( point, 0 );
236 254
237 switch(ret) 255 switch(ret)
238 { 256 {
239 case 0: 257 case 0:
240 { 258 {
241 //MimeTypes types; 259 //MimeTypes types;
242 //types.insert( "all", "*" ); 260 //types.insert( "all", "*" );
243 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); 261 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this );
244 262
245 if( !str.isEmpty() ) 263 if( !str.isEmpty() )
246 { 264 {
247 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 265 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
248 if (content) 266 if (content)
249 { 267 {
250 QFile output(str); 268 QFile output(str);
251 output.open(IO_WriteOnly); 269 output.open(IO_WriteOnly);
252 output.writeBlock(content->Content(),content->Length()); 270 output.writeBlock(content->Content(),content->Length());
253 output.close(); 271 output.close();
254 delete content; 272 delete content;
255 } 273 }
256 } 274 }
257 } 275 }
258 break ; 276 break ;
259 277
260 case 2: 278 case 2:
261 { 279 {
262#ifdef DESKTOP_VERSION 280#ifdef DESKTOP_VERSION
263 QString tmpfile = locateLocal( "tmp", "opiemail-image"); 281 QString tmpfile = locateLocal( "tmp", "opiemail-image");
264#else 282#else
265 QString tmpfile = "/tmp/opiemail-image"; 283 QString tmpfile = "/tmp/opiemail-image";
266#endif 284#endif
267 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 285 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
268 if (content) { 286 if (content) {
269 QFile output(tmpfile); 287 QFile output(tmpfile);
270 output.open(IO_WriteOnly); 288 output.open(IO_WriteOnly);
271 output.writeBlock(content->Content(),content->Length()); 289 output.writeBlock(content->Content(),content->Length());
272 output.close(); 290 output.close();
273 delete content; 291 delete content;
274 MailImageDlg iview(""); 292 MailImageDlg iview("");
275 iview.setName(tmpfile); 293 iview.setName(tmpfile);
276 KApplication::execDialog(&iview); 294 KApplication::execDialog(&iview);
277 output.remove(); 295 output.remove();
278 } 296 }
279 } 297 }
280 break; 298 break;
281 case 1: 299 case 1:
282 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 300 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
283 { 301 {
284 setText(); 302 setText();
285 } 303 }
286 else 304 else
287 { 305 {
288 if ( m_recMail->Wrapper() != 0l ) 306 if ( m_recMail->Wrapper() != 0l )
289 { // make sure that there is a wrapper , even after delete or simular actions 307 { // make sure that there is a wrapper , even after delete or simular actions
290 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 308 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
291 } 309 }
292 } 310 }
293 break; 311 break;
294 } 312 }
295 delete menu; 313 delete menu;
296} 314}
297 315
298 316
299void ViewMail::setMail(const RecMailP&mail ) 317void ViewMail::setMail(const RecMailP&mail )
300{ 318{
301 319
302 m_recMail = mail; 320 m_recMail = mail;
303 321
304 m_mail[0] = mail->getFrom(); 322 m_mail[0] = mail->getFrom();
305 m_mail[1] = mail->getSubject(); 323 m_mail[1] = mail->getSubject();
306 m_mail[3] = mail->getDate(); 324 m_mail[3] = mail->getDate();
307 m_mail[4] = mail->Msgid(); 325 m_mail[4] = mail->Msgid();
308 326
309 m_mail2[0] = mail->To(); 327 m_mail2[0] = mail->To();
310 m_mail2[1] = mail->CC(); 328 m_mail2[1] = mail->CC();
311 m_mail2[2] = mail->Bcc(); 329 m_mail2[2] = mail->Bcc();
312 330
313 setText(); 331 setText();
314} 332}
315 333
316 334
317 335
318ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 336ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
319 : ViewMailBase(parent, name, fl), _inLoop(false) 337 : ViewMailBase(parent, name, fl), _inLoop(false)
320{ 338{
321 m_gotBody = false; 339 m_gotBody = false;
322 deleted = false; 340 deleted = false;
323 341 sourceOn = false;
324 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 342 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
325 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 343 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
326 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 344 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
327 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 345 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
328 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 346 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
329 connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); 347 connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) );
348 connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) );
349 connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) );
330 350
331 attachments->setEnabled(m_gotBody); 351 attachments->setEnabled(m_gotBody);
332 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 352 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
333 353
334 readConfig(); 354 readConfig();
335 attachments->setSorting(-1); 355 attachments->setSorting(-1);
336} 356}
337 357
338void ViewMail::readConfig() 358void ViewMail::readConfig()
339{ 359{
340 360
341 setFont ( KOPrefs::instance()->mReadFont ); 361 setFont ( KOPrefs::instance()->mReadFont );
342 m_showHtml = KOPrefs::instance()->mViewAsHtml; 362 m_showHtml = KOPrefs::instance()->mViewAsHtml;
343 showHtml->setOn( m_showHtml ); 363 showHtml->setOn( m_showHtml );
344} 364}
345 365
346void ViewMail::setText() 366void ViewMail::setText()
347{ 367{
348 368
369 viewSource->setText(i18n("View Source"));
370 sourceOn = false;
349 QString toString; 371 QString toString;
350 QString ccString; 372 QString ccString;
351 QString bccString; 373 QString bccString;
352 374
353 375
354 toString = m_mail2[0].join(","); 376 toString = m_mail2[0].join(",");
355 ccString = m_mail2[1].join(","); 377 ccString = m_mail2[1].join(",");
356 bccString = m_mail2[2].join(","); 378 bccString = m_mail2[2].join(",");
357 379
358 380
359 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); 381 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) );
360 382
361 m_mailHtml = "<html><body>" 383 m_mailHtml = "<html><body>"
362 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 384 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
363 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 385 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
364 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 386 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
365 "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 387 "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
366 "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 388 "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
367 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 389 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
368 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + 390 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] +
369 "</td></tr></table><font>"; 391 "</td></tr></table><font>";
370 392
371 if ( !m_showHtml ) 393 if ( !m_showHtml )
372 { 394 {
373 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); 395 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
374 } 396 }
375 else 397 else
376 { 398 {
377 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); 399 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
378 } 400 }
379 // remove later in favor of a real handling 401 // remove later in favor of a real handling
380 m_gotBody = true; 402 m_gotBody = true;
381} 403}
382 404
383 405
384ViewMail::~ViewMail() 406ViewMail::~ViewMail()
385{ 407{
386 m_recMail->Wrapper()->cleanMimeCache(); 408 m_recMail->Wrapper()->cleanMimeCache();
387 hide(); 409 hide();
388} 410}
389 411
390void ViewMail::hide() 412void ViewMail::hide()
391{ 413{
392 QWidget::hide(); 414 QWidget::hide();
393 415
394 if (_inLoop) 416 if (_inLoop)
395 { 417 {
396 _inLoop = false; 418 _inLoop = false;
397 qApp->exit_loop(); 419 qApp->exit_loop();
398 420
399 } 421 }
400 422
401} 423}
402 424
403void ViewMail::exec() 425void ViewMail::exec()
404{ 426{
405 show(); 427 show();
406 428
407 if (!_inLoop) 429 if (!_inLoop)
408 { 430 {
409 _inLoop = true; 431 _inLoop = true;
410 qApp->enter_loop(); 432 qApp->enter_loop();
411 } 433 }
412 434
413} 435}
414 436
415QString ViewMail::deHtml(const QString &string) 437QString ViewMail::deHtml(const QString &string)
416{ 438{
417 QString string_ = string; 439 QString string_ = string;
418 string_.replace(QRegExp("&"), "&amp;"); 440 string_.replace(QRegExp("&"), "&amp;");
419 string_.replace(QRegExp("<"), "&lt;"); 441 string_.replace(QRegExp("<"), "&lt;");
420 string_.replace(QRegExp(">"), "&gt;"); 442 string_.replace(QRegExp(">"), "&gt;");
421 string_.replace(QRegExp("\\n"), "<br>"); 443 string_.replace(QRegExp("\\n"), "<br>");
422 return string_; 444 return string_;
423} 445}
424 446
425void ViewMail::slotReply() 447void ViewMail::slotReply()
426{ 448{
427 if (!m_gotBody) 449 if (!m_gotBody)
428 { 450 {
429 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); 451 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok"));
430 return; 452 return;
431 } 453 }
432 454
433 QString rtext; 455 QString rtext;
434 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 456 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
435 .arg( m_mail[0] ) 457 .arg( m_mail[0] )
436 .arg( m_mail[3] ); 458 .arg( m_mail[3] );
437 459
438 QString text = m_mail[2]; 460 QString text = m_mail[2];
439 QStringList lines = QStringList::split(QRegExp("\\n"), text); 461 QStringList lines = QStringList::split(QRegExp("\\n"), text);
440 QStringList::Iterator it; 462 QStringList::Iterator it;
441 for (it = lines.begin(); it != lines.end(); it++) 463 for (it = lines.begin(); it != lines.end(); it++)
442 { 464 {
443 rtext += "> " + *it + "\n"; 465 rtext += "> " + *it + "\n";
444 } 466 }
445 rtext += "\n"; 467 rtext += "\n";
446 468
447 QString prefix; 469 QString prefix;
448 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; 470 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
449 else prefix = "Re: "; // no i18n on purpose 471 else prefix = "Re: "; // no i18n on purpose
450 472
451 Settings *settings = new Settings(); 473 Settings *settings = new Settings();
452 ComposeMail composer( settings ,this, 0, true); 474 ComposeMail composer( settings ,this, 0, true);
453 if (m_recMail->Replyto().isEmpty()) { 475 if (m_recMail->Replyto().isEmpty()) {
454 composer.setTo(m_recMail->getFrom()); 476 composer.setTo(m_recMail->getFrom());
455 } else { 477 } else {
456 composer.setTo(m_recMail->Replyto()); 478 composer.setTo(m_recMail->Replyto());
457 } 479 }
458 composer.setSubject( prefix + m_mail[1] ); 480 composer.setSubject( prefix + m_mail[1] );
459 composer.setMessage( rtext ); 481 composer.setMessage( rtext );
460 composer.setInReplyTo(m_recMail->Msgid()); 482 composer.setInReplyTo(m_recMail->Msgid());
461 composer.setCharset( m_body->getCharset() ); 483 composer.setCharset( m_body->getCharset() );
462 484
463 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 485 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
464 { 486 {
465 m_recMail->Wrapper()->answeredMail(m_recMail); 487 m_recMail->Wrapper()->answeredMail(m_recMail);
466 } 488 }
467 delete settings; 489 delete settings;
468} 490}
469 491
470void ViewMail::slotForward() 492void ViewMail::slotForward()
471{ 493{
472 if (!m_gotBody) 494 if (!m_gotBody)
473 { 495 {
474 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); 496 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok"));
475 return; 497 return;
476 } 498 }
477 499
478 QString ftext; 500 QString ftext;
479 ftext += QString("\n----- Forwarded message from %1 -----\n\n") 501 ftext += QString("\n----- Forwarded message from %1 -----\n\n")
480 .arg( m_mail[0] ); 502 .arg( m_mail[0] );
481 if (!m_mail[3].isNull()) 503 if (!m_mail[3].isNull())
482 ftext += QString("Date: %1\n") 504 ftext += QString("Date: %1\n")
483 .arg( m_mail[3] ); 505 .arg( m_mail[3] );
484 if (!m_mail[0].isNull()) 506 if (!m_mail[0].isNull())
485 ftext += QString("From: %1\n") 507 ftext += QString("From: %1\n")
486 .arg( m_mail[0] ); 508 .arg( m_mail[0] );
487 if (!m_mail[1].isNull()) 509 if (!m_mail[1].isNull())
488 ftext += QString("Subject: %1\n") 510 ftext += QString("Subject: %1\n")
489 .arg( m_mail[1] ); 511 .arg( m_mail[1] );
490 512
491 ftext += QString("\n%1\n") 513 ftext += QString("\n%1\n")
492 .arg( m_mail[2]); 514 .arg( m_mail[2]);
493 515
494 ftext += QString("----- End forwarded message -----\n"); 516 ftext += QString("----- End forwarded message -----\n");
495 517
496 Settings *settings = new Settings(); 518 Settings *settings = new Settings();
497 ComposeMail composer( settings ,this, 0, true); 519 ComposeMail composer( settings ,this, 0, true);
498 composer.setSubject( "Fwd: " + m_mail[1] ); 520 composer.setSubject( "Fwd: " + m_mail[1] );
499 composer.setMessage( ftext ); 521 composer.setMessage( ftext );
500 if ( QDialog::Accepted == KApplication::execDialog( &composer )) 522 if ( QDialog::Accepted == KApplication::execDialog( &composer ))
501 { 523 {
502 } 524 }
503} 525}
504 526
505void ViewMail::slotDeleteMail( ) 527void ViewMail::slotDeleteMail( )
506{ 528{
507 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 529 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
508 { 530 {
509 emit deleteAndDisplayNextMail( this); 531 emit deleteAndDisplayNextMail( this);
510 //m_recMail->Wrapper()->deleteMail( m_recMail ); 532 //m_recMail->Wrapper()->deleteMail( m_recMail );
511 //hide(); 533 //hide();
512 deleted = true; 534 deleted = true;
513 } 535 }
514} 536}
515 537
516MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) 538MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
517 : QDialog(parent,name,modal) 539 : QDialog(parent,name,modal)
518{ 540{
519 QVBoxLayout*dlglayout = new QVBoxLayout(this); 541 QVBoxLayout*dlglayout = new QVBoxLayout(this);
520 dlglayout->setSpacing(2); 542 dlglayout->setSpacing(2);
521 dlglayout->setMargin(1); 543 dlglayout->setMargin(1);
522 //m_imageview = new Opie::MM::OImageScrollView(this); 544 //m_imageview = new Opie::MM::OImageScrollView(this);
523 //dlglayout->addWidget(m_imageview); 545 //dlglayout->addWidget(m_imageview);
524} 546}
525 547
526MailImageDlg::~MailImageDlg() 548MailImageDlg::~MailImageDlg()
527{ 549{
528} 550}
529 551
530void MailImageDlg::setName(const QString&fname) 552void MailImageDlg::setName(const QString&fname)
531{ 553{
532 qDebug("viewmail.cpp: MailImageDlg::setName Pending"); 554 qDebug("viewmail.cpp: MailImageDlg::setName Pending");
533 // m_imageview->setImage(fname); 555 // m_imageview->setImage(fname);
534} 556}
557
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h
index d85b8b2..561989e 100644
--- a/kmicromail/viewmail.h
+++ b/kmicromail/viewmail.h
@@ -1,89 +1,91 @@
1#ifndef VIEWMAIL_H 1#ifndef VIEWMAIL_H
2#define VIEWMAIL_H 2#define VIEWMAIL_H
3 3
4#include "viewmailbase.h" 4#include "viewmailbase.h"
5#include <libmailwrapper/mailtypes.h> 5#include <libmailwrapper/mailtypes.h>
6 6
7#include <qdialog.h> 7#include <qdialog.h>
8 8
9#include <qlistview.h> 9#include <qlistview.h>
10#include <qmap.h> 10#include <qmap.h>
11#include <qstringlist.h> 11#include <qstringlist.h>
12#include <qvaluelist.h> 12#include <qvaluelist.h>
13 13
14//namespace Opie { namespace MM { class OImageScrollView; } } 14//namespace Opie { namespace MM { class OImageScrollView; } }
15 15
16class AttachItem : public QListViewItem 16class AttachItem : public QListViewItem
17{ 17{
18public: 18public:
19 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 19 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
20 const QString&fsize,int num,const QValueList<int>&path); 20 const QString&fsize,int num,const QValueList<int>&path);
21 AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 21 AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
22 const QString&fsize,int num,const QValueList<int>&path); 22 const QString&fsize,int num,const QValueList<int>&path);
23 int Partnumber() { return _partNum; } 23 int Partnumber() { return _partNum; }
24 bool isParentof(const QValueList<int>&path); 24 bool isParentof(const QValueList<int>&path);
25 25
26private: 26private:
27 int _partNum; 27 int _partNum;
28 /* needed for a better display of attachments */ 28 /* needed for a better display of attachments */
29 QValueList<int> _path; 29 QValueList<int> _path;
30}; 30};
31 31
32class ViewMail : public ViewMailBase 32class ViewMail : public ViewMailBase
33{ 33{
34 Q_OBJECT 34 Q_OBJECT
35 35
36public: 36public:
37 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 37 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
38 ~ViewMail(); 38 ~ViewMail();
39 39
40 void hide(); 40 void hide();
41 void exec(); 41 void exec();
42 void setMail(const RecMailP&mail ); 42 void setMail(const RecMailP&mail );
43 void setBody(const RecBodyP&body); 43 void setBody(const RecBodyP&body);
44 bool deleted; 44 bool deleted;
45 signals: 45 signals:
46 void showNextMail(ViewMail*); 46 void showNextMail(ViewMail*);
47 void deleteAndDisplayNextMail(ViewMail *); 47 void deleteAndDisplayNextMail(ViewMail *);
48 void signalDownloadMail();
48protected: 49protected:
49 QString deHtml(const QString &string); 50 QString deHtml(const QString &string);
50 AttachItem* searchParent(const QValueList<int>&path); 51 AttachItem* searchParent(const QValueList<int>&path);
51 AttachItem* lastChild(AttachItem*parent); 52 AttachItem* lastChild(AttachItem*parent);
52 53
53protected slots: 54protected slots:
54 void slotNextMail() { emit showNextMail(this); }; 55 void slotNextMail() { emit showNextMail(this); };
55 void slotReply(); 56 void slotReply();
56 void slotForward(); 57 void slotForward();
57 void setText(); 58 void setText();
58 void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); 59 void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
59 void slotDeleteMail( ); 60 void slotDeleteMail( );
60 void slotShowHtml( bool ); 61 void slotShowHtml( bool );
62 void slotViewSource();
61 63
62private: 64private:
63 void readConfig(); 65 void readConfig();
64 66 bool sourceOn;;
65 bool _inLoop; 67 bool _inLoop;
66 QString m_mailHtml; 68 QString m_mailHtml;
67 bool m_gotBody; 69 bool m_gotBody;
68 RecBodyP m_body; 70 RecBodyP m_body;
69 RecMailP m_recMail; 71 RecMailP m_recMail;
70 bool m_showHtml; 72 bool m_showHtml;
71 73
72 // 0 from 1 subject 2 bodytext 3 date 74 // 0 from 1 subject 2 bodytext 3 date
73 QMap <int,QString> m_mail; 75 QMap <int,QString> m_mail;
74 // 0 to 1 cc 2 bcc 76 // 0 to 1 cc 2 bcc
75 QMap <int,QStringList> m_mail2; 77 QMap <int,QStringList> m_mail2;
76}; 78};
77 79
78class MailImageDlg:public QDialog 80class MailImageDlg:public QDialog
79{ 81{
80 Q_OBJECT 82 Q_OBJECT
81public: 83public:
82 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); 84 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0);
83 ~MailImageDlg(); 85 ~MailImageDlg();
84 void setName(const QString&); 86 void setName(const QString&);
85protected: 87protected:
86 //Opie::MM::OImageScrollView*m_imageview; 88 //Opie::MM::OImageScrollView*m_imageview;
87}; 89};
88 90
89#endif 91#endif
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp
index d21696a..9365c23 100644
--- a/kmicromail/viewmailbase.cpp
+++ b/kmicromail/viewmailbase.cpp
@@ -1,104 +1,112 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#include <qtextbrowser.h> 2#include <qtextbrowser.h>
3#include <qlistview.h> 3#include <qlistview.h>
4#include <qaction.h> 4#include <qaction.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qvbox.h> 6#include <qvbox.h>
7 7
8#include <qtoolbar.h> 8#include <qtoolbar.h>
9#include <qmenubar.h> 9#include <qmenubar.h>
10#include <kiconloader.h> 10#include <kiconloader.h>
11//#include <qpe/resource.h> 11//#include <qpe/resource.h>
12#include <klocale.h> 12#include <klocale.h>
13 13
14#include "viewmailbase.h" 14#include "viewmailbase.h"
15//#include "opendiag.h" 15//#include "opendiag.h"
16 16
17ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) 17ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
18 : QMainWindow(parent, name, fl) 18 : QMainWindow(parent, name, fl)
19{ 19{
20 20
21 setToolBarsMovable(false); 21 setToolBarsMovable(false);
22 22
23 toolbar = new QToolBar(this); 23 toolbar = new QToolBar(this);
24 menubar = new QMenuBar( toolbar ); 24 menubar = new QMenuBar( toolbar );
25 mailmenu = new QPopupMenu( menubar ); 25 mailmenu = new QPopupMenu( menubar );
26 menubar->insertItem( i18n( "Mail" ), mailmenu ); 26 menubar->insertItem( i18n( "Mail" ), mailmenu );
27 27
28 toolbar->setHorizontalStretchable(true); 28 toolbar->setHorizontalStretchable(true);
29 addToolBar(toolbar); 29 addToolBar(toolbar);
30 30
31 viewSource = new QAction(i18n("View Source"), 0, 0, this);
32 viewSource->addTo(mailmenu);
33
34 downloadMail= new QAction(i18n("Download Mail"),SmallIcon("add"), 0, 0, this);
35 downloadMail->addTo(toolbar);
36 downloadMail->addTo(mailmenu);
37
38
31 reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this); 39 reply = new QAction(i18n("Reply"),SmallIcon("reply"), 0, 0, this);
32 reply->addTo(toolbar); 40 reply->addTo(toolbar);
33 reply->addTo(mailmenu); 41 reply->addTo(mailmenu);
34 42
35 forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this); 43 forward = new QAction(i18n("Forward"),SmallIcon("forward"), 0, 0, this);
36 forward->addTo(toolbar); 44 forward->addTo(toolbar);
37 forward->addTo(mailmenu); 45 forward->addTo(mailmenu);
38 46
39 attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true); 47 attachbutton = new QAction(i18n("Attachments"),SmallIcon("attach"), 0, 0, this, 0, true);
40 attachbutton->addTo(toolbar); 48 attachbutton->addTo(toolbar);
41 attachbutton->addTo(mailmenu); 49 attachbutton->addTo(mailmenu);
42 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); 50 connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
43 51
44 52
45 showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); 53 showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true );
46 showHtml->addTo( toolbar ); 54 showHtml->addTo( toolbar );
47 showHtml->addTo( mailmenu ); 55 showHtml->addTo( mailmenu );
48 56
49 deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this); 57 deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this);
50 deleteMail->addTo(toolbar); 58 deleteMail->addTo(toolbar);
51 deleteMail->addTo(mailmenu); 59 deleteMail->addTo(mailmenu);
52 60
53 61
54 62
55 nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this); 63 nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this);
56 QLabel *spacer = new QLabel(toolbar); 64 QLabel *spacer = new QLabel(toolbar);
57 nextMail->addTo(toolbar); 65 nextMail->addTo(toolbar);
58 nextMail->addTo(mailmenu); 66 nextMail->addTo(mailmenu);
59 67
60 68
61 69
62 70
63 closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); 71 closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
64 //QLabel *spacer = new QLabel(toolbar); 72 //QLabel *spacer = new QLabel(toolbar);
65 spacer->setBackgroundMode(QWidget::PaletteButton); 73 spacer->setBackgroundMode(QWidget::PaletteButton);
66 toolbar->setStretchableWidget(spacer); 74 toolbar->setStretchableWidget(spacer);
67 closeMail->addTo(toolbar); 75 closeMail->addTo(toolbar);
68 closeMail->addTo(mailmenu); 76 closeMail->addTo(mailmenu);
69 QVBox *view = new QVBox(this); 77 QVBox *view = new QVBox(this);
70 setCentralWidget(view); 78 setCentralWidget(view);
71 79
72 attachments = new QListView(view); 80 attachments = new QListView(view);
73 attachments->setMinimumHeight(90); 81 attachments->setMinimumHeight(90);
74 attachments->setMaximumHeight(90); 82 attachments->setMaximumHeight(90);
75 attachments->setAllColumnsShowFocus(true); 83 attachments->setAllColumnsShowFocus(true);
76 attachments->addColumn("Mime Type", 60); 84 attachments->addColumn("Mime Type", 60);
77 attachments->addColumn(i18n("Description"), 100); 85 attachments->addColumn(i18n("Description"), 100);
78 attachments->addColumn(i18n("Filename"), 80); 86 attachments->addColumn(i18n("Filename"), 80);
79 attachments->addColumn(i18n("Size"), 80); 87 attachments->addColumn(i18n("Size"), 80);
80 attachments->setSorting(-1); 88 attachments->setSorting(-1);
81 attachments->hide(); 89 attachments->hide();
82 90
83 browser = new QTextBrowser(view); 91 browser = new QTextBrowser(view);
84 92
85 //openDiag = new OpenDiag(view); 93 //openDiag = new OpenDiag(view);
86 //openDiag->hide(); 94 //openDiag->hide();
87 95
88} 96}
89 97
90void ViewMailBase::slotChangeAttachview(bool state) 98void ViewMailBase::slotChangeAttachview(bool state)
91{ 99{
92 if (state) attachments->show(); 100 if (state) attachments->show();
93 else attachments->hide(); 101 else attachments->hide();
94} 102}
95 103
96void ViewMailBase::keyPressEvent ( QKeyEvent * e ) 104void ViewMailBase::keyPressEvent ( QKeyEvent * e )
97{ 105{
98 if( e->key()==Qt::Key_Escape ) { 106 if( e->key()==Qt::Key_Escape ) {
99 close(); 107 close();
100 e->accept(); 108 e->accept();
101 return; 109 return;
102 } 110 }
103 QWidget::keyPressEvent(e); 111 QWidget::keyPressEvent(e);
104} 112}
diff --git a/kmicromail/viewmailbase.h b/kmicromail/viewmailbase.h
index c97e9e3..7ad1eec 100644
--- a/kmicromail/viewmailbase.h
+++ b/kmicromail/viewmailbase.h
@@ -1,39 +1,39 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#ifndef VIEWMAILBASE_H 2#ifndef VIEWMAILBASE_H
3#define VIEWMAILBASE_H 3#define VIEWMAILBASE_H
4 4
5#include <qmainwindow.h> 5#include <qmainwindow.h>
6 6
7class QAction; 7class QAction;
8class OpenDiag; 8class OpenDiag;
9class QListView; 9class QListView;
10class QToolBar; 10class QToolBar;
11class QTextBrowser; 11class QTextBrowser;
12class QMenuBar; 12class QMenuBar;
13class QPopupMenu; 13class QPopupMenu;
14 14
15class ViewMailBase : public QMainWindow 15class ViewMailBase : public QMainWindow
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18 18
19public: 19public:
20 ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 20 ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
21 21
22protected: 22protected:
23 QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail; 23 QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail, *downloadMail, *viewSource;
24 QListView *attachments; 24 QListView *attachments;
25 QToolBar *toolbar; 25 QToolBar *toolbar;
26 QTextBrowser *browser; 26 QTextBrowser *browser;
27 OpenDiag *openDiag; 27 OpenDiag *openDiag;
28 QMenuBar *menubar; 28 QMenuBar *menubar;
29 QPopupMenu *mailmenu; 29 QPopupMenu *mailmenu;
30 30
31protected slots: 31protected slots:
32 void slotChangeAttachview(bool state); 32 void slotChangeAttachview(bool state);
33 virtual void keyPressEvent ( QKeyEvent * e ); 33 virtual void keyPressEvent ( QKeyEvent * e );
34 34
35 35
36}; 36};
37 37
38#endif 38#endif
39 39