summaryrefslogtreecommitdiffabout
path: root/kmicromail
authorzautrix <zautrix>2004-10-30 15:56:24 (UTC)
committer zautrix <zautrix>2004-10-30 15:56:24 (UTC)
commitc8662dc632987a317386b923e24acb9507859528 (patch) (unidiff)
tree97ca9b266d075c3c0f2689769829c453f8118cd8 /kmicromail
parent632b43950f1ac2980c281eb8901d797deb0ba971 (diff)
downloadkdepimpi-c8662dc632987a317386b923e24acb9507859528.zip
kdepimpi-c8662dc632987a317386b923e24acb9507859528.tar.gz
kdepimpi-c8662dc632987a317386b923e24acb9507859528.tar.bz2
ompi desktop compile hack
Diffstat (limited to 'kmicromail') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/composemail.cpp26
-rw-r--r--kmicromail/defines.h2
-rw-r--r--kmicromail/editaccounts.cpp3
-rw-r--r--kmicromail/kmicromail.pro3
-rw-r--r--kmicromail/koprefsdialog.cpp2
-rw-r--r--kmicromail/libmailwrapper/libmailwrapper.pro3
-rw-r--r--kmicromail/mainwindow.cpp2
-rw-r--r--kmicromail/nntpgroupsdlg.cpp2
-rw-r--r--kmicromail/opiemail.cpp9
-rw-r--r--kmicromail/qpe/qdialog.h35
-rw-r--r--kmicromail/qpe/qdialog_hacked.cpp30
-rw-r--r--kmicromail/viewmail.cpp27
-rw-r--r--kmicromail/viewmail.h4
13 files changed, 114 insertions, 34 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp
index 0cd0b23..5945b7f 100644
--- a/kmicromail/composemail.cpp
+++ b/kmicromail/composemail.cpp
@@ -1,497 +1,503 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3#include <kabc/addresseedialog.h>
4#include <kabc/stdaddressbook.h>
5#include <kabc/addressee.h>
6#ifdef DESKTOP_VERSION
7#include <qapplication.h>
8#include <kabc/addresseedialog.h>
9#endif //DESKTOP_VERSION
10#include <libkdepim/externalapphandler.h>
11
12#include "koprefs.h"
13
14#ifdef MINIKDE_KDIALOG_H
15#undef MINIKDE_KDIALOG_H
16#endif
17
18
3#include "composemail.h" 19#include "composemail.h"
4 20
5#include <libmailwrapper/smtpwrapper.h> 21#include <libmailwrapper/smtpwrapper.h>
6#include <libmailwrapper/storemail.h> 22#include <libmailwrapper/storemail.h>
7#include <libmailwrapper/abstractmail.h> 23#include <libmailwrapper/abstractmail.h>
8#include <libmailwrapper/mailtypes.h> 24#include <libmailwrapper/mailtypes.h>
9 25
10/* OPIE */ 26/* OPIE */
11//#include <opie2/ofiledialog.h> 27//#include <opie2/ofiledialog.h>
12//#include <opie2/odebug.h> 28//#include <opie2/odebug.h>
13#include <kfiledialog.h> 29#include <kfiledialog.h>
14//#include <qpe/resource.h> 30//#include <qpe/resource.h>
15#include <qpe/global.h> 31#include <qpe/global.h>
16//#include <qpe/contact.h> 32//#include <qpe/contact.h>
17 33
18 34
19#include <qcombobox.h> 35#include <qcombobox.h>
20#include <qcheckbox.h> 36#include <qcheckbox.h>
21#include <qiconset.h> 37#include <qiconset.h>
22#include <qtimer.h> 38#include <qtimer.h>
23#include <qmessagebox.h> 39#include <qmessagebox.h>
24#include <qpushbutton.h> 40#include <qpushbutton.h>
25#include <qmultilineedit.h> 41#include <qmultilineedit.h>
26#include <qlabel.h> 42#include <qlabel.h>
27#include <qtabwidget.h> 43#include <qtabwidget.h>
28#include <qlistview.h> 44#include <qlistview.h>
29#include <kabc/addresseedialog.h>
30#include <kabc/stdaddressbook.h>
31#include <kabc/addressee.h>
32#ifdef DESKTOP_VERSION
33#include <qapplication.h>
34#include <kabc/addresseedialog.h>
35#endif //DESKTOP_VERSION
36#include <libkdepim/externalapphandler.h>
37
38#include "koprefs.h"
39 45
40//using namespace Opie::Core; 46//using namespace Opie::Core;
41//using namespace Opie::Ui; 47//using namespace Opie::Ui;
42ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) 48ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal )
43 : ComposeMailUI( parent, name, modal ) 49 : ComposeMailUI( parent, name, modal )
44{ 50{
45 mPickLineEdit = 0; 51 mPickLineEdit = 0;
46 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 52 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
47 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 53 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
48 settings = s; 54 settings = s;
49 m_replyid = ""; 55 m_replyid = "";
50 if ( KOPrefs::instance()->mUseKapi) { 56 if ( KOPrefs::instance()->mUseKapi) {
51 KConfig config( locateLocal("config", "kabcrc") ); 57 KConfig config( locateLocal("config", "kabcrc") );
52 config.setGroup( "General" ); 58 config.setGroup( "General" );
53 QString whoami_uid = config.readEntry( "WhoAmI" ); 59 QString whoami_uid = config.readEntry( "WhoAmI" );
54 60
55 if ( whoami_uid.isEmpty() ) { 61 if ( whoami_uid.isEmpty() ) {
56 QMessageBox::information( 0, i18n( "Hint" ), 62 QMessageBox::information( 0, i18n( "Hint" ),
57 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 63 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
58 i18n( "Ok" ) ); 64 i18n( "Ok" ) );
59 65
60 66
61 fillSettings(); 67 fillSettings();
62 } else 68 } else
63 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); 69 ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid);
64 70
65 71
66#ifdef DESKTOP_VERSION 72#ifdef DESKTOP_VERSION
67 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); 73 KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( );
68 QStringList mails = con.emails(); 74 QStringList mails = con.emails();
69 QString defmail = con.preferredEmail(); 75 QString defmail = con.preferredEmail();
70 if ( mails.count() == 0) 76 if ( mails.count() == 0)
71 QMessageBox::information( 0, i18n( "Hint" ), 77 QMessageBox::information( 0, i18n( "Hint" ),
72 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 78 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
73 i18n( "Ok" ) ); 79 i18n( "Ok" ) );
74 if (defmail.length()!=0) { 80 if (defmail.length()!=0) {
75 fromBox->insertItem(defmail); 81 fromBox->insertItem(defmail);
76 } 82 }
77 QStringList::ConstIterator sit = mails.begin(); 83 QStringList::ConstIterator sit = mails.begin();
78 for (;sit!=mails.end();++sit) { 84 for (;sit!=mails.end();++sit) {
79 if ( (*sit)==defmail) 85 if ( (*sit)==defmail)
80 continue; 86 continue;
81 fromBox->insertItem((*sit)); 87 fromBox->insertItem((*sit));
82 } 88 }
83 senderNameEdit->setText(con.formattedName()); 89 senderNameEdit->setText(con.formattedName());
84#endif 90#endif
85 91
86 } else { 92 } else {
87 fillSettings(); 93 fillSettings();
88 } 94 }
89 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); 95 checkBoxLater->setChecked( KOPrefs::instance()->mSendLater );
90 96
91 attList->addColumn( i18n( "Name" ) ); 97 attList->addColumn( i18n( "Name" ) );
92 attList->addColumn( i18n( "Size" ) ); 98 attList->addColumn( i18n( "Size" ) );
93 QList<Account> accounts = settings->getAccounts(); 99 QList<Account> accounts = settings->getAccounts();
94 100
95 if ( QApplication::desktop()->width() < 320 ) 101 if ( QApplication::desktop()->width() < 320 )
96 smtpAccountBox->setMaximumWidth( 80 ); 102 smtpAccountBox->setMaximumWidth( 80 );
97 Account *it; 103 Account *it;
98 for ( it = accounts.first(); it; it = accounts.next() ) { 104 for ( it = accounts.first(); it; it = accounts.next() ) {
99 if ( it->getType()==MAILLIB::A_SMTP ) { 105 if ( it->getType()==MAILLIB::A_SMTP ) {
100 SMTPaccount *smtp = static_cast<SMTPaccount *>(it); 106 SMTPaccount *smtp = static_cast<SMTPaccount *>(it);
101 smtpAccountBox->insertItem( smtp->getAccountName() ); 107 smtpAccountBox->insertItem( smtp->getAccountName() );
102 smtpAccounts.append( smtp ); 108 smtpAccounts.append( smtp );
103 } 109 }
104 } 110 }
105 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); 111 connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) );
106 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); 112 connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) );
107 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); 113 connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) );
108 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); 114 connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) );
109 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); 115 connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) );
110 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); 116 connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) );
111 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); 117 connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) );
112 mMail = 0; 118 mMail = 0;
113 warnAttach = true; 119 warnAttach = true;
114 QIconSet icon; 120 QIconSet icon;
115 //icon = SmallIcon("fileexport"); 121 //icon = SmallIcon("fileexport");
116 icon = SmallIcon("filesave"); 122 icon = SmallIcon("filesave");
117 SaveButton->setIconSet (icon ) ; 123 SaveButton->setIconSet (icon ) ;
118 if ( QApplication::desktop()->width() < 320 ) { 124 if ( QApplication::desktop()->width() < 320 ) {
119 SaveButton->setText ("") ; 125 SaveButton->setText ("") ;
120 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ; 126 SaveButton->setMaximumSize ( SaveButton->sizeHint().height(),SaveButton->sizeHint().height()) ;
121 } 127 }
122 else 128 else
123 SaveButton->setText (i18n("Save")); 129 SaveButton->setText (i18n("Save"));
124#ifndef DESKTOP_VERSION 130#ifndef DESKTOP_VERSION
125 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold ); 131 QPEApplication::setStylusOperation( message, QPEApplication::RightOnHold );
126 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold ); 132 QPEApplication::setStylusOperation( senderNameEdit, QPEApplication::RightOnHold );
127 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold ); 133 QPEApplication::setStylusOperation( subjectLine, QPEApplication::RightOnHold );
128#endif 134#endif
129 message->setFont ( KOPrefs::instance()->mComposeFont ); 135 message->setFont ( KOPrefs::instance()->mComposeFont );
130 message->setWordWrap (QMultiLineEdit::WidgetWidth); 136 message->setWordWrap (QMultiLineEdit::WidgetWidth);
131 if ( smtpAccounts.count() > 0 ) { 137 if ( smtpAccounts.count() > 0 ) {
132 fillValues( smtpAccountBox->currentItem() ); 138 fillValues( smtpAccountBox->currentItem() );
133 } else { 139 } else {
134 QMessageBox::information( 0, i18n( "Problem" ), 140 QMessageBox::information( 0, i18n( "Problem" ),
135 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ), 141 i18n( "Please create an\nSMTP account first.\nThe SMTP is needed\nfor sending mail.\n" ),
136 i18n( "Ok" ) ); 142 i18n( "Ok" ) );
137 return; 143 return;
138 } 144 }
139 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); 145 connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) );
140 146
141 147
142} 148}
143 149
144void ComposeMail::fillSettings() 150void ComposeMail::fillSettings()
145{ 151{
146 if ( QApplication::desktop()->width() < 320 ) 152 if ( QApplication::desktop()->width() < 320 )
147 fromBox->setMaximumWidth( 100 ); 153 fromBox->setMaximumWidth( 100 );
148 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); 154 QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail);
149 QStringList::ConstIterator sit = mailList.begin(); 155 QStringList::ConstIterator sit = mailList.begin();
150 int pref = 0; 156 int pref = 0;
151 for (;sit!=mailList.end();++sit) { 157 for (;sit!=mailList.end();++sit) {
152 fromBox->insertItem((*sit)); 158 fromBox->insertItem((*sit));
153 } 159 }
154 senderNameEdit->setText(KOPrefs::instance()->mName); 160 senderNameEdit->setText(KOPrefs::instance()->mName);
155} 161}
156 162
157 163
158void ComposeMail::saveAsDraft() 164void ComposeMail::saveAsDraft()
159{ 165{
160 166
161 Opie::Core::OSmartPointer<Mail> mail= new Mail(); 167 Opie::Core::OSmartPointer<Mail> mail= new Mail();
162 mail->setMail(fromBox->currentText()); 168 mail->setMail(fromBox->currentText());
163 mail->setTo( toLine->text() ); 169 mail->setTo( toLine->text() );
164 mail->setName(senderNameEdit->text()); 170 mail->setName(senderNameEdit->text());
165 mail->setCC( ccLine->text() ); 171 mail->setCC( ccLine->text() );
166 mail->setBCC( bccLine->text() ); 172 mail->setBCC( bccLine->text() );
167 mail->setReply( replyLine->text() ); 173 mail->setReply( replyLine->text() );
168 mail->setSubject( subjectLine->text() ); 174 mail->setSubject( subjectLine->text() );
169 if (!m_replyid.isEmpty()) { 175 if (!m_replyid.isEmpty()) {
170 QStringList ids; 176 QStringList ids;
171 ids.append(m_replyid); 177 ids.append(m_replyid);
172 mail->setInreply(ids); 178 mail->setInreply(ids);
173 } 179 }
174 QString txt = message->text(); 180 QString txt = message->text();
175 if ( !sigMultiLine->text().isEmpty() ) { 181 if ( !sigMultiLine->text().isEmpty() ) {
176 txt.append( "\n--\n" ); 182 txt.append( "\n--\n" );
177 txt.append( sigMultiLine->text() ); 183 txt.append( sigMultiLine->text() );
178 } 184 }
179 mail->setMessage( txt ); 185 mail->setMessage( txt );
180 186
181 /* only use the default drafts folder name! */ 187 /* only use the default drafts folder name! */
182 Storemail wrapper(AbstractMail::draftFolder()); 188 Storemail wrapper(AbstractMail::draftFolder());
183 wrapper.storeMail(mail); 189 wrapper.storeMail(mail);
184 190
185 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 191 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
186 /* attachments we will ignore! */ 192 /* attachments we will ignore! */
187 if ( it != 0 ) { 193 if ( it != 0 ) {
188 if ( warnAttach ) 194 if ( warnAttach )
189 QMessageBox::warning(0,i18n("Store message"), 195 QMessageBox::warning(0,i18n("Store message"),
190 i18n("<center>Attachments will not be stored in \"Draft\" folder</center>")); 196 i18n("<center>Attachments will not be stored in \"Draft\" folder</center>"));
191 warnAttach = false; 197 warnAttach = false;
192 } 198 }
193 setStatus( i18n("Mail saved as draft!") ); 199 setStatus( i18n("Mail saved as draft!") );
194} 200}
195void ComposeMail::clearStatus() 201void ComposeMail::clearStatus()
196{ 202{
197 topLevelWidget()->setCaption( i18n("Compose mail") ); 203 topLevelWidget()->setCaption( i18n("Compose mail") );
198} 204}
199void ComposeMail::setStatus( QString status ) 205void ComposeMail::setStatus( QString status )
200{ 206{
201 topLevelWidget()->setCaption( status ); 207 topLevelWidget()->setCaption( status );
202 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; 208 QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ;
203} 209}
204void ComposeMail::pickAddress( ) 210void ComposeMail::pickAddress( )
205{ 211{
206 212
207 QLineEdit *line = mPickLineEdit; 213 QLineEdit *line = mPickLineEdit;
208 if ( line == 0 ) 214 if ( line == 0 )
209 return; 215 return;
210#ifdef DESKTOP_VERSION 216#ifdef DESKTOP_VERSION
211 //qDebug(" ComposeMail::pickAddress "); 217 //qDebug(" ComposeMail::pickAddress ");
212 QString names ;//= AddressPicker::getNames(); 218 QString names ;//= AddressPicker::getNames();
213 219
214 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 220 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
215 uint i=0; 221 uint i=0;
216 for (i=0; i < list.count(); i++) { 222 for (i=0; i < list.count(); i++) {
217 if ( !list[i].preferredEmail().isEmpty()) { 223 if ( !list[i].preferredEmail().isEmpty()) {
218 if ( ! names.isEmpty() ) 224 if ( ! names.isEmpty() )
219 names+= ","; 225 names+= ",";
220 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; 226 names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">";
221 227
222 } 228 }
223 } 229 }
224 230
225 231
226 if ( line->text().isEmpty() ) { 232 if ( line->text().isEmpty() ) {
227 line->setText( names ); 233 line->setText( names );
228 } else if ( !names.isEmpty() ) { 234 } else if ( !names.isEmpty() ) {
229 line->setText( line->text() + ", " + names ); 235 line->setText( line->text() + ", " + names );
230 } 236 }
231#else 237#else
232 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); 238 bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/);
233 // the result should now arrive through method insertAttendees 239 // the result should now arrive through method insertAttendees
234#endif 240#endif
235} 241}
236//the map includes name/email pairs, that comes from Ka/Pi 242//the map includes name/email pairs, that comes from Ka/Pi
237void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) 243void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList)
238{ 244{
239 //qDebug("ComposeMail::insertAttendees "); 245 //qDebug("ComposeMail::insertAttendees ");
240 raise(); 246 raise();
241 247
242 if ( mPickLineEdit == 0 ) { //whoami received 248 if ( mPickLineEdit == 0 ) { //whoami received
243 QString defmail = uidList[0]; 249 QString defmail = uidList[0];
244 if ( emailList.count() == 0 ) 250 if ( emailList.count() == 0 )
245 QMessageBox::information( 0, i18n( "Hint" ), 251 QMessageBox::information( 0, i18n( "Hint" ),
246 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), 252 i18n( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ),
247 i18n( "Ok" ) ); 253 i18n( "Ok" ) );
248 if (defmail.length()!=0) { 254 if (defmail.length()!=0) {
249 fromBox->insertItem(defmail); 255 fromBox->insertItem(defmail);
250 } 256 }
251 QStringList::ConstIterator sit = emailList.begin(); 257 QStringList::ConstIterator sit = emailList.begin();
252 int pref = 0; 258 int pref = 0;
253 for (;sit!=emailList.end();++sit) { 259 for (;sit!=emailList.end();++sit) {
254 if ( (*sit)==defmail) 260 if ( (*sit)==defmail)
255 continue; 261 continue;
256 fromBox->insertItem((*sit)); 262 fromBox->insertItem((*sit));
257 } 263 }
258 senderNameEdit->setText(nameList[0]); 264 senderNameEdit->setText(nameList[0]);
259 return; 265 return;
260 } 266 }
261 QString names ; 267 QString names ;
262 QLineEdit *line = mPickLineEdit; 268 QLineEdit *line = mPickLineEdit;
263 if (uid == this->name()) 269 if (uid == this->name())
264 { 270 {
265 for ( int i = 0; i < nameList.count(); i++) 271 for ( int i = 0; i < nameList.count(); i++)
266 { 272 {
267 QString _name = nameList[i]; 273 QString _name = nameList[i];
268 QString _email = emailList[i]; 274 QString _email = emailList[i];
269 QString _uid = uidList[i]; 275 QString _uid = uidList[i];
270 if ( ! _email.isEmpty() ) { 276 if ( ! _email.isEmpty() ) {
271 if ( ! names.isEmpty() ) 277 if ( ! names.isEmpty() )
272 names+= ","; 278 names+= ",";
273 names+= "\""+_name +"\"<" +_email +">"; 279 names+= "\""+_name +"\"<" +_email +">";
274 } 280 }
275 } 281 }
276 } 282 }
277 if ( line->text().isEmpty() ) { 283 if ( line->text().isEmpty() ) {
278 line->setText( names ); 284 line->setText( names );
279 } else if ( !names.isEmpty() ) { 285 } else if ( !names.isEmpty() ) {
280 line->setText( line->text() + ", " + names ); 286 line->setText( line->text() + ", " + names );
281 } 287 }
282} 288}
283 289
284void ComposeMail::setTo( const QString & to ) 290void ComposeMail::setTo( const QString & to )
285{ 291{
286 toLine->setText( to ); 292 toLine->setText( to );
287} 293}
288 294
289void ComposeMail::setSubject( const QString & subject ) 295void ComposeMail::setSubject( const QString & subject )
290{ 296{
291 subjectLine->setText( subject ); 297 subjectLine->setText( subject );
292} 298}
293 299
294void ComposeMail::setInReplyTo( const QString & messageId ) 300void ComposeMail::setInReplyTo( const QString & messageId )
295{ 301{
296 m_replyid = messageId; 302 m_replyid = messageId;
297} 303}
298 304
299void ComposeMail::setMessage( const QString & text ) 305void ComposeMail::setMessage( const QString & text )
300{ 306{
301 message->setText( text ); 307 message->setText( text );
302} 308}
303 309
304 310
305void ComposeMail::pickAddressTo() 311void ComposeMail::pickAddressTo()
306{ 312{
307 mPickLineEdit = toLine; 313 mPickLineEdit = toLine;
308 pickAddress( ); 314 pickAddress( );
309} 315}
310 316
311void ComposeMail::pickAddressCC() 317void ComposeMail::pickAddressCC()
312{ 318{
313 mPickLineEdit = ccLine; 319 mPickLineEdit = ccLine;
314 pickAddress( ); 320 pickAddress( );
315} 321}
316 322
317void ComposeMail::pickAddressBCC() 323void ComposeMail::pickAddressBCC()
318{ 324{
319 mPickLineEdit = bccLine; 325 mPickLineEdit = bccLine;
320 pickAddress( ); 326 pickAddress( );
321} 327}
322 328
323void ComposeMail::pickAddressReply() 329void ComposeMail::pickAddressReply()
324{ 330{
325 mPickLineEdit = replyLine; 331 mPickLineEdit = replyLine;
326 pickAddress( ); 332 pickAddress( );
327} 333}
328 334
329void ComposeMail::fillValues( int ) 335void ComposeMail::fillValues( int )
330{ 336{
331#if 0 337#if 0
332 SMTPaccount *smtp = smtpAccounts.at( current ); 338 SMTPaccount *smtp = smtpAccounts.at( current );
333 ccLine->clear(); 339 ccLine->clear();
334 if ( smtp->getUseCC() ) { 340 if ( smtp->getUseCC() ) {
335 ccLine->setText( smtp->getCC() ); 341 ccLine->setText( smtp->getCC() );
336 } 342 }
337 bccLine->clear(); 343 bccLine->clear();
338 if ( smtp->getUseBCC() ) { 344 if ( smtp->getUseBCC() ) {
339 bccLine->setText( smtp->getBCC() ); 345 bccLine->setText( smtp->getBCC() );
340 } 346 }
341 replyLine->clear(); 347 replyLine->clear();
342 if ( smtp->getUseReply() ) { 348 if ( smtp->getUseReply() ) {
343 replyLine->setText( smtp->getReply() ); 349 replyLine->setText( smtp->getReply() );
344 } 350 }
345 sigMultiLine->setText( smtp->getSignature() ); 351 sigMultiLine->setText( smtp->getSignature() );
346#endif 352#endif
347} 353}
348 354
349void ComposeMail::slotAdjustColumns() 355void ComposeMail::slotAdjustColumns()
350{ 356{
351 int currPage = tabWidget->currentPageIndex(); 357 int currPage = tabWidget->currentPageIndex();
352 358
353 tabWidget->showPage( attachTab ); 359 tabWidget->showPage( attachTab );
354 attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); 360 attList->setColumnWidth( 0, attList->visibleWidth() - 80 );
355 attList->setColumnWidth( 1, 80 ); 361 attList->setColumnWidth( 1, 80 );
356 362
357 tabWidget->setCurrentPage( currPage ); 363 tabWidget->setCurrentPage( currPage );
358} 364}
359 365
360void ComposeMail::addAttachment() 366void ComposeMail::addAttachment()
361{ 367{
362 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); 368 QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this );
363 if ( !lnk.isEmpty() ) { 369 if ( !lnk.isEmpty() ) {
364 Attachment *att = new Attachment( lnk ); 370 Attachment *att = new Attachment( lnk );
365 (void) new AttachViewItem( attList, att ); 371 (void) new AttachViewItem( attList, att );
366 } 372 }
367} 373}
368 374
369void ComposeMail::removeAttachment() 375void ComposeMail::removeAttachment()
370{ 376{
371 if ( !attList->currentItem() ) { 377 if ( !attList->currentItem() ) {
372 QMessageBox::information( this, i18n( "Error" ), 378 QMessageBox::information( this, i18n( "Error" ),
373 i18n( "<p>Please select a File.</p>" ), 379 i18n( "<p>Please select a File.</p>" ),
374 i18n( "Ok" ) ); 380 i18n( "Ok" ) );
375 } else { 381 } else {
376 attList->takeItem( attList->currentItem() ); 382 attList->takeItem( attList->currentItem() );
377 } 383 }
378} 384}
379 385
380void ComposeMail::accept() 386void ComposeMail::accept()
381{ 387{
382 if ( smtpAccountBox->count() == 0 ) { 388 if ( smtpAccountBox->count() == 0 ) {
383 389
384 reject(); 390 reject();
385 return; 391 return;
386 } 392 }
387 393
388 if (! checkBoxLater->isChecked() ) { 394 if (! checkBoxLater->isChecked() ) {
389 int yesno = QMessageBox::warning(0,i18n("Stop editing message"), 395 int yesno = QMessageBox::warning(0,i18n("Stop editing message"),
390 i18n("Send this message?"), 396 i18n("Send this message?"),
391 i18n("Yes"), 397 i18n("Yes"),
392 i18n("Cancel")); 398 i18n("Cancel"));
393 399
394 if (yesno == 1) { 400 if (yesno == 1) {
395 return; 401 return;
396 } 402 }
397 } 403 }
398#if 0 404#if 0
399 odebug << "Sending Mail with " 405 odebug << "Sending Mail with "
400 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; 406 << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl;
401#endif 407#endif
402 Opie::Core::OSmartPointer<Mail> mail=new Mail; 408 Opie::Core::OSmartPointer<Mail> mail=new Mail;
403 409
404 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); 410 SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() );
405 mail->setMail(fromBox->currentText()); 411 mail->setMail(fromBox->currentText());
406 412
407 if ( !toLine->text().isEmpty() ) { 413 if ( !toLine->text().isEmpty() ) {
408 mail->setTo( toLine->text() ); 414 mail->setTo( toLine->text() );
409 } else { 415 } else {
410 QMessageBox::warning(0,i18n("Sending mail"), 416 QMessageBox::warning(0,i18n("Sending mail"),
411 i18n("No Receiver spezified" ) ); 417 i18n("No Receiver spezified" ) );
412 return; 418 return;
413 } 419 }
414 420
415 mail->setName(senderNameEdit->text()); 421 mail->setName(senderNameEdit->text());
416 mail->setCC( ccLine->text() ); 422 mail->setCC( ccLine->text() );
417 mail->setBCC( bccLine->text() ); 423 mail->setBCC( bccLine->text() );
418 mail->setReply( replyLine->text() ); 424 mail->setReply( replyLine->text() );
419 mail->setSubject( subjectLine->text() ); 425 mail->setSubject( subjectLine->text() );
420 if (!m_replyid.isEmpty()) { 426 if (!m_replyid.isEmpty()) {
421 QStringList ids; 427 QStringList ids;
422 ids.append(m_replyid); 428 ids.append(m_replyid);
423 mail->setInreply(ids); 429 mail->setInreply(ids);
424 } 430 }
425 QString txt = message->text(); 431 QString txt = message->text();
426 if ( !sigMultiLine->text().isEmpty() ) { 432 if ( !sigMultiLine->text().isEmpty() ) {
427 txt.append( "\n--\n" ); 433 txt.append( "\n--\n" );
428 txt.append( sigMultiLine->text() ); 434 txt.append( sigMultiLine->text() );
429 } 435 }
430 mail->setMessage( txt ); 436 mail->setMessage( txt );
431 AttachViewItem *it = (AttachViewItem *) attList->firstChild(); 437 AttachViewItem *it = (AttachViewItem *) attList->firstChild();
432 while ( it != 0 ) { 438 while ( it != 0 ) {
433 mail->addAttachment( it->getAttachment() ); 439 mail->addAttachment( it->getAttachment() );
434 it = (AttachViewItem *) it->nextSibling(); 440 it = (AttachViewItem *) it->nextSibling();
435 } 441 }
436 442
437 SMTPwrapper wrapper( smtp ); 443 SMTPwrapper wrapper( smtp );
438 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) 444 if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) )
439 setStatus( tr ("Mail sent")); 445 setStatus( tr ("Mail sent"));
440 else { 446 else {
441 setStatus( tr ("Error: Something went wrong. Nothing sent")); 447 setStatus( tr ("Error: Something went wrong. Nothing sent"));
442 return; 448 return;
443 } 449 }
444 450
445 451
446 QDialog::accept(); 452 QDialog::accept();
447} 453}
448 454
449void ComposeMail::reject() 455void ComposeMail::reject()
450{ 456{
451 //qDebug("ComposeMail::reject() "); 457 //qDebug("ComposeMail::reject() ");
452 int yesno = QMessageBox::warning(0,i18n("Store message?"), 458 int yesno = QMessageBox::warning(0,i18n("Store message?"),
453 i18n("Store message into drafts?\n"), 459 i18n("Store message into drafts?\n"),
454 i18n("Yes"), 460 i18n("Yes"),
455 i18n("No")); 461 i18n("No"));
456 462
457 //qDebug("button %d ", yesno); 463 //qDebug("button %d ", yesno);
458 if (yesno == 0) { 464 if (yesno == 0) {
459 if ( toLine->text().isEmpty() ) { 465 if ( toLine->text().isEmpty() ) {
460 QMessageBox::warning(0,i18n("Sending mail"), 466 QMessageBox::warning(0,i18n("Sending mail"),
461 i18n("No Receiver spezified" ) ); 467 i18n("No Receiver spezified" ) );
462 return; 468 return;
463 } 469 }
464 saveAsDraft(); 470 saveAsDraft();
465 } 471 }
466 if (yesno == 2) { 472 if (yesno == 2) {
467 qDebug("return "); 473 qDebug("return ");
468 return; 474 return;
469 } 475 }
470 QDialog::reject(); 476 QDialog::reject();
471} 477}
472 478
473ComposeMail::~ComposeMail() 479ComposeMail::~ComposeMail()
474{ 480{
475} 481}
476 482
477void ComposeMail::reEditMail(const RecMailP&current) 483void ComposeMail::reEditMail(const RecMailP&current)
478{ 484{
479 RecMailP data = current; 485 RecMailP data = current;
480 message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); 486 message->setText(data->Wrapper()->fetchBody(current)->Bodytext());
481 subjectLine->setText( data->getSubject()); 487 subjectLine->setText( data->getSubject());
482 toLine->setText(data->To().join(",")); 488 toLine->setText(data->To().join(","));
483 ccLine->setText(data->CC().join(",")); 489 ccLine->setText(data->CC().join(","));
484 bccLine->setText(data->Bcc().join(",")); 490 bccLine->setText(data->Bcc().join(","));
485 replyLine->setText(data->Replyto()); 491 replyLine->setText(data->Replyto());
486} 492}
487 493
488AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) 494AttachViewItem::AttachViewItem( QListView *parent, Attachment *att )
489 : QListViewItem( parent ) 495 : QListViewItem( parent )
490{ 496{
491 attachment = att; 497 attachment = att;
492 if ( !attachment->getPixmap().isNull() ) 498 if ( !attachment->getPixmap().isNull() )
493 setPixmap( 0,attachment->getPixmap() ); 499 setPixmap( 0,attachment->getPixmap() );
494 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); 500 setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() );
495 setText( 1, QString::number( att->getSize() ) ); 501 setText( 1, QString::number( att->getSize() ) );
496} 502}
497 503
diff --git a/kmicromail/defines.h b/kmicromail/defines.h
index f2d7265..c890def 100644
--- a/kmicromail/defines.h
+++ b/kmicromail/defines.h
@@ -1,36 +1,36 @@
1#ifndef DEFINE_CONSTANTS_H 1#ifndef DEFINE_CONSTANTS_H
2#define DEFINE_CONSTANTS_H 2#define DEFINE_CONSTANTS_H
3 3
4 4
5 5
6#define USER_AGENT "KMicroMail v1.92" 6#define USER_AGENT "KOpieMail v1.9.11"
7 7
8#define PIXMAP_IMAPFOLDER SmallIcon ( "imapfolder" ) 8#define PIXMAP_IMAPFOLDER SmallIcon ( "imapfolder" )
9#define PIXMAP_POP3FOLDER SmallIcon ( "pop3folder" ) 9#define PIXMAP_POP3FOLDER SmallIcon ( "pop3folder" )
10#define PIXMAP_INBOXFOLDER SmallIcon ( "inbox" ) 10#define PIXMAP_INBOXFOLDER SmallIcon ( "inbox" )
11#define PIXMAP_MBOXFOLDER SmallIcon ( "mboxfolder" ) 11#define PIXMAP_MBOXFOLDER SmallIcon ( "mboxfolder" )
12#define PIXMAP_OUTBOXFOLDER SmallIcon ( "outbox" ) 12#define PIXMAP_OUTBOXFOLDER SmallIcon ( "outbox" )
13#define PIXMAP_LOCALFOLDER SmallIcon ( "localfolder" ) 13#define PIXMAP_LOCALFOLDER SmallIcon ( "localfolder" )
14#define PIXMAP_OFFLINE SmallIcon ( "notconnected" ) 14#define PIXMAP_OFFLINE SmallIcon ( "notconnected" )
15 15
16#define IMAP_PORT "143" 16#define IMAP_PORT "143"
17#define IMAP_SSL_PORT "993" 17#define IMAP_SSL_PORT "993"
18#define SMTP_PORT "25" 18#define SMTP_PORT "25"
19#define SMTP_SSL_PORT "465" 19#define SMTP_SSL_PORT "465"
20#define POP3_PORT "110" 20#define POP3_PORT "110"
21#define POP3_SSL_PORT "995" 21#define POP3_SSL_PORT "995"
22#define NNTP_PORT "119" 22#define NNTP_PORT "119"
23#define NNTP_SSL_PORT "563" 23#define NNTP_SSL_PORT "563"
24 24
25/* used for decoding imapfoldername */ 25/* used for decoding imapfoldername */
26#define UNDEFINED 64 26#define UNDEFINED 64
27#define MAXLINE 76 27#define MAXLINE 76
28#define UTF16MASK 0x03FFUL 28#define UTF16MASK 0x03FFUL
29#define UTF16SHIFT 10 29#define UTF16SHIFT 10
30#define UTF16BASE 0x10000UL 30#define UTF16BASE 0x10000UL
31#define UTF16HIGHSTART 0xD800UL 31#define UTF16HIGHSTART 0xD800UL
32#define UTF16HIGHEND 0xDBFFUL 32#define UTF16HIGHEND 0xDBFFUL
33#define UTF16LOSTART 0xDC00UL 33#define UTF16LOSTART 0xDC00UL
34#define UTF16LOEND 0xDFFFUL 34#define UTF16LOEND 0xDFFFUL
35 35
36#endif 36#endif
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp
index c931e45..0d30097 100644
--- a/kmicromail/editaccounts.cpp
+++ b/kmicromail/editaccounts.cpp
@@ -1,662 +1,663 @@
1 1
2#include <qdialog.h>
3#include "kapplication.h"
2#include "defines.h" 4#include "defines.h"
3#include "editaccounts.h" 5#include "editaccounts.h"
4#include "kapplication.h"
5/* OPIE */ 6/* OPIE */
6#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
7 8
8/* QT */ 9/* QT */
9#include <qstringlist.h> 10#include <qstringlist.h>
10 11
11#include <qcombobox.h> 12#include <qcombobox.h>
12#include <qcheckbox.h> 13#include <qcheckbox.h>
13#include <qmessagebox.h> 14#include <qmessagebox.h>
14#include <qpushbutton.h> 15#include <qpushbutton.h>
15#include <qlineedit.h> 16#include <qlineedit.h>
16#include <qlabel.h> 17#include <qlabel.h>
17#include <qtabwidget.h> 18#include <qtabwidget.h>
18#include <qlistview.h> 19#include <qlistview.h>
19#include <qspinbox.h> 20#include <qspinbox.h>
20#include <klocale.h> 21#include <klocale.h>
21 22
22#include <libmailwrapper/nntpwrapper.h> 23#include <libmailwrapper/nntpwrapper.h>
23 24
24using namespace Opie::Core; 25using namespace Opie::Core;
25 26
26AccountListItem::AccountListItem( QListView *parent, Account *a) 27AccountListItem::AccountListItem( QListView *parent, Account *a)
27 : QListViewItem( parent ) 28 : QListViewItem( parent )
28{ 29{
29 account = a; 30 account = a;
30 setText( 0, account->getAccountName() ); 31 setText( 0, account->getAccountName() );
31 QString ttext = ""; 32 QString ttext = "";
32 switch (account->getType()) { 33 switch (account->getType()) {
33 case MAILLIB::A_NNTP: 34 case MAILLIB::A_NNTP:
34 ttext="NNTP"; 35 ttext="NNTP";
35 break; 36 break;
36 case MAILLIB::A_POP3: 37 case MAILLIB::A_POP3:
37 ttext = "POP3"; 38 ttext = "POP3";
38 break; 39 break;
39 case MAILLIB::A_IMAP: 40 case MAILLIB::A_IMAP:
40 ttext = "IMAP"; 41 ttext = "IMAP";
41 break; 42 break;
42 case MAILLIB::A_SMTP: 43 case MAILLIB::A_SMTP:
43 ttext = "SMTP"; 44 ttext = "SMTP";
44 break; 45 break;
45 default: 46 default:
46 ttext = "UNKNOWN"; 47 ttext = "UNKNOWN";
47 break; 48 break;
48 } 49 }
49 setText( 1, ttext); 50 setText( 1, ttext);
50} 51}
51 52
52EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) 53EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags )
53 : EditAccountsUI( parent, name, modal, flags ) 54 : EditAccountsUI( parent, name, modal, flags )
54{ 55{
55 settings = s; 56 settings = s;
56 57
57 mailList->addColumn( i18n( "Account" ) ); 58 mailList->addColumn( i18n( "Account" ) );
58 mailList->addColumn( i18n( "Type" ) ); 59 mailList->addColumn( i18n( "Type" ) );
59 60
60 newsList->addColumn( i18n( "Account" ) ); 61 newsList->addColumn( i18n( "Account" ) );
61 62
62 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); 63 connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) );
63 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); 64 connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) );
64 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); 65 connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) );
65 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); 66 connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) );
66 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); 67 connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) );
67 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); 68 connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) );
68 69
69 slotFillLists(); 70 slotFillLists();
70} 71}
71 72
72void EditAccounts::slotFillLists() 73void EditAccounts::slotFillLists()
73{ 74{
74 mailList->clear(); 75 mailList->clear();
75 newsList->clear(); 76 newsList->clear();
76 77
77 QList<Account> accounts = settings->getAccounts(); 78 QList<Account> accounts = settings->getAccounts();
78 Account *it; 79 Account *it;
79 for ( it = accounts.first(); it; it = accounts.next() ) 80 for ( it = accounts.first(); it; it = accounts.next() )
80 { 81 {
81 if ( it->getType()==MAILLIB::A_NNTP ) 82 if ( it->getType()==MAILLIB::A_NNTP )
82 { 83 {
83 (void) new AccountListItem( newsList, it ); 84 (void) new AccountListItem( newsList, it );
84 } 85 }
85 else 86 else
86 { 87 {
87 (void) new AccountListItem( mailList, it ); 88 (void) new AccountListItem( mailList, it );
88 } 89 }
89 } 90 }
90} 91}
91 92
92void EditAccounts::slotNewMail() 93void EditAccounts::slotNewMail()
93{ 94{
94 QString *selection = new QString(); 95 QString *selection = new QString();
95 SelectMailType selType( selection, this, 0, true ); 96 SelectMailType selType( selection, this, 0, true );
96 selType.show(); 97 selType.show();
97 if ( QDialog::Accepted == selType.exec() ) 98 if ( QDialog::Accepted == selType.exec() )
98 { 99 {
99 slotNewAccount( *selection ); 100 slotNewAccount( *selection );
100 } 101 }
101} 102}
102 103
103void EditAccounts::slotNewAccount( const QString &type ) 104void EditAccounts::slotNewAccount( const QString &type )
104{ 105{
105 if ( type.compare( i18n("IMAP") ) == 0 ) 106 if ( type.compare( i18n("IMAP") ) == 0 )
106 { 107 {
107 IMAPaccount *account = new IMAPaccount(); 108 IMAPaccount *account = new IMAPaccount();
108 IMAPconfig imap( account, this, 0, true ); 109 IMAPconfig imap( account, this, 0, true );
109 imap.showMaximized(); 110 imap.showMaximized();
110 if ( QDialog::Accepted == imap.exec() ) 111 if ( QDialog::Accepted == imap.exec() )
111 { 112 {
112 settings->addAccount( account ); 113 settings->addAccount( account );
113 account->save(); 114 account->save();
114 slotFillLists(); 115 slotFillLists();
115 } 116 }
116 else 117 else
117 { 118 {
118 account->remove(); 119 account->remove();
119 } 120 }
120 } 121 }
121 else if ( type.compare( i18n("POP3") ) == 0 ) 122 else if ( type.compare( i18n("POP3") ) == 0 )
122 { 123 {
123 POP3account *account = new POP3account(); 124 POP3account *account = new POP3account();
124 POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); 125 POP3config pop3( account, this, 0, true, WStyle_ContextHelp );
125 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) 126 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) )
126 { 127 {
127 settings->addAccount( account ); 128 settings->addAccount( account );
128 account->save(); 129 account->save();
129 slotFillLists(); 130 slotFillLists();
130 } 131 }
131 else 132 else
132 { 133 {
133 account->remove(); 134 account->remove();
134 } 135 }
135 } 136 }
136 else if ( type.compare( i18n("SMTP") ) == 0 ) 137 else if ( type.compare( i18n("SMTP") ) == 0 )
137 { 138 {
138 SMTPaccount *account = new SMTPaccount(); 139 SMTPaccount *account = new SMTPaccount();
139 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); 140 SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp );
140 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) 141 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) )
141 { 142 {
142 settings->addAccount( account ); 143 settings->addAccount( account );
143 account->save(); 144 account->save();
144 slotFillLists(); 145 slotFillLists();
145 146
146 } 147 }
147 else 148 else
148 { 149 {
149 account->remove(); 150 account->remove();
150 } 151 }
151 } 152 }
152 else if ( type.compare( i18n("NNTP") ) == 0 ) 153 else if ( type.compare( i18n("NNTP") ) == 0 )
153 { 154 {
154 NNTPaccount *account = new NNTPaccount(); 155 NNTPaccount *account = new NNTPaccount();
155 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); 156 NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp );
156 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) 157 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) )
157 { 158 {
158 settings->addAccount( account ); 159 settings->addAccount( account );
159 account->save(); 160 account->save();
160 slotFillLists(); 161 slotFillLists();
161 } 162 }
162 else 163 else
163 { 164 {
164 account->remove(); 165 account->remove();
165 } 166 }
166 } 167 }
167} 168}
168 169
169void EditAccounts::slotEditAccount( Account *account ) 170void EditAccounts::slotEditAccount( Account *account )
170{ 171{
171 if ( account->getType() == MAILLIB::A_IMAP ) 172 if ( account->getType() == MAILLIB::A_IMAP )
172 { 173 {
173 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account); 174 IMAPaccount *imapAcc = static_cast<IMAPaccount *>(account);
174 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp ); 175 IMAPconfig imap( imapAcc, this, 0, true, WStyle_ContextHelp );
175 if ( QDialog::Accepted == KApplication::execDialog( &imap ) ) 176 if ( QDialog::Accepted == KApplication::execDialog( &imap ) )
176 { 177 {
177 slotFillLists(); 178 slotFillLists();
178 } 179 }
179 } 180 }
180 else if ( account->getType()==MAILLIB::A_POP3 ) 181 else if ( account->getType()==MAILLIB::A_POP3 )
181 { 182 {
182 POP3account *pop3Acc = static_cast<POP3account *>(account); 183 POP3account *pop3Acc = static_cast<POP3account *>(account);
183 POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp ); 184 POP3config pop3( pop3Acc, this, 0, true, WStyle_ContextHelp );
184 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) 185 if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) )
185 { 186 {
186 slotFillLists(); 187 slotFillLists();
187 } 188 }
188 } 189 }
189 else if ( account->getType()==MAILLIB::A_SMTP ) 190 else if ( account->getType()==MAILLIB::A_SMTP )
190 { 191 {
191 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account); 192 SMTPaccount *smtpAcc = static_cast<SMTPaccount *>(account);
192 SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp ); 193 SMTPconfig smtp( smtpAcc, this, 0, true, WStyle_ContextHelp );
193 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) 194 if ( QDialog::Accepted == KApplication::execDialog( &smtp ) )
194 { 195 {
195 slotFillLists(); 196 slotFillLists();
196 } 197 }
197 } 198 }
198 else if ( account->getType()==MAILLIB::A_NNTP) 199 else if ( account->getType()==MAILLIB::A_NNTP)
199 { 200 {
200 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account); 201 NNTPaccount *nntpAcc = static_cast<NNTPaccount *>(account);
201 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp ); 202 NNTPconfig nntp( nntpAcc, this, 0, true, WStyle_ContextHelp );
202 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) 203 if ( QDialog::Accepted == KApplication::execDialog( &nntp ) )
203 { 204 {
204 slotFillLists(); 205 slotFillLists();
205 } 206 }
206 } 207 }
207} 208}
208 209
209void EditAccounts::slotDeleteAccount( Account *account ) 210void EditAccounts::slotDeleteAccount( Account *account )
210{ 211{
211 if ( QMessageBox::information( this, i18n( "Question" ), 212 if ( QMessageBox::information( this, i18n( "Question" ),
212 i18n( "<p>Do you really want to delete the selected Account?</p>" ), 213 i18n( "<p>Do you really want to delete the selected Account?</p>" ),
213 i18n( "Yes" ), i18n( "No" ) ) == 0 ) 214 i18n( "Yes" ), i18n( "No" ) ) == 0 )
214 { 215 {
215 settings->delAccount( account ); 216 settings->delAccount( account );
216 slotFillLists(); 217 slotFillLists();
217 } 218 }
218} 219}
219 220
220void EditAccounts::slotEditMail() 221void EditAccounts::slotEditMail()
221{ 222{
222 if ( !mailList->currentItem() ) 223 if ( !mailList->currentItem() )
223 { 224 {
224 QMessageBox::information( this, i18n( "Error" ), 225 QMessageBox::information( this, i18n( "Error" ),
225 i18n( "<p>Please select an account.</p>" ), 226 i18n( "<p>Please select an account.</p>" ),
226 i18n( "Ok" ) ); 227 i18n( "Ok" ) );
227 return; 228 return;
228 } 229 }
229 230
230 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 231 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
231 slotEditAccount( a ); 232 slotEditAccount( a );
232} 233}
233 234
234void EditAccounts::slotDeleteMail() 235void EditAccounts::slotDeleteMail()
235{ 236{
236 if ( !mailList->currentItem() ) 237 if ( !mailList->currentItem() )
237 { 238 {
238 QMessageBox::information( this, i18n( "Error" ), 239 QMessageBox::information( this, i18n( "Error" ),
239 i18n( "<p>Please select an account.</p>" ), 240 i18n( "<p>Please select an account.</p>" ),
240 i18n( "Ok" ) ); 241 i18n( "Ok" ) );
241 return; 242 return;
242 } 243 }
243 244
244 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount(); 245 Account *a = ((AccountListItem *) mailList->currentItem())->getAccount();
245 slotDeleteAccount( a ); 246 slotDeleteAccount( a );
246} 247}
247 248
248void EditAccounts::slotNewNews() 249void EditAccounts::slotNewNews()
249{ 250{
250 slotNewAccount( "NNTP" ); 251 slotNewAccount( "NNTP" );
251} 252}
252 253
253void EditAccounts::slotEditNews() 254void EditAccounts::slotEditNews()
254{ 255{
255 if ( !newsList->currentItem() ) 256 if ( !newsList->currentItem() )
256 { 257 {
257 QMessageBox::information( this, i18n( "Error" ), 258 QMessageBox::information( this, i18n( "Error" ),
258 i18n( "<p>Please select an account.</p>" ), 259 i18n( "<p>Please select an account.</p>" ),
259 i18n( "Ok" ) ); 260 i18n( "Ok" ) );
260 return; 261 return;
261 } 262 }
262 263
263 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 264 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
264 slotEditAccount( a ); 265 slotEditAccount( a );
265} 266}
266 267
267void EditAccounts::slotDeleteNews() 268void EditAccounts::slotDeleteNews()
268{ 269{
269 if ( !newsList->currentItem() ) 270 if ( !newsList->currentItem() )
270 { 271 {
271 QMessageBox::information( this, i18n( "Error" ), 272 QMessageBox::information( this, i18n( "Error" ),
272 i18n( "<p>Please select an account.</p>" ), 273 i18n( "<p>Please select an account.</p>" ),
273 i18n( "Ok" ) ); 274 i18n( "Ok" ) );
274 return; 275 return;
275 } 276 }
276 277
277 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount(); 278 Account *a = ((AccountListItem *) newsList->currentItem())->getAccount();
278 slotDeleteAccount( a ); 279 slotDeleteAccount( a );
279} 280}
280 281
281void EditAccounts::slotAdjustColumns() 282void EditAccounts::slotAdjustColumns()
282{ 283{
283 int currPage = configTab->currentPageIndex(); 284 int currPage = configTab->currentPageIndex();
284 285
285 configTab->showPage( mailTab ); 286 configTab->showPage( mailTab );
286 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 ); 287 mailList->setColumnWidth( 0, mailList->visibleWidth() - 50 );
287 mailList->setColumnWidth( 1, 50 ); 288 mailList->setColumnWidth( 1, 50 );
288 289
289 configTab->showPage( newsTab ); 290 configTab->showPage( newsTab );
290 newsList->setColumnWidth( 0, newsList->visibleWidth() ); 291 newsList->setColumnWidth( 0, newsList->visibleWidth() );
291 292
292 configTab->setCurrentPage( currPage ); 293 configTab->setCurrentPage( currPage );
293} 294}
294 295
295void EditAccounts::accept() 296void EditAccounts::accept()
296{ 297{
297 settings->saveAccounts(); 298 settings->saveAccounts();
298 299
299 QDialog::accept(); 300 QDialog::accept();
300} 301}
301 302
302/** 303/**
303 * SelectMailType 304 * SelectMailType
304 */ 305 */
305 306
306SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags ) 307SelectMailType::SelectMailType( QString *selection, QWidget *parent, const char *name, bool modal, WFlags flags )
307 : SelectMailTypeUI( parent, name, modal, flags ) 308 : SelectMailTypeUI( parent, name, modal, flags )
308{ 309{
309 selected = selection; 310 selected = selection;
310 selected->replace( 0, selected->length(), typeBox->currentText() ); 311 selected->replace( 0, selected->length(), typeBox->currentText() );
311 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) ); 312 connect( typeBox, SIGNAL( activated(const QString&) ), SLOT( slotSelection(const QString&) ) );
312} 313}
313 314
314void SelectMailType::slotSelection( const QString &sel ) 315void SelectMailType::slotSelection( const QString &sel )
315{ 316{
316 selected->replace( 0, selected->length(), sel ); 317 selected->replace( 0, selected->length(), sel );
317} 318}
318 319
319/** 320/**
320 * IMAPconfig 321 * IMAPconfig
321 */ 322 */
322 323
323IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 324IMAPconfig::IMAPconfig( IMAPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
324 : IMAPconfigUI( parent, name, modal, flags ) 325 : IMAPconfigUI( parent, name, modal, flags )
325{ 326{
326 data = account; 327 data = account;
327 328
328 fillValues(); 329 fillValues();
329 330
330 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 331 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
331 ComboBox1->insertItem( "Only if available", 0 ); 332 ComboBox1->insertItem( "Only if available", 0 );
332 ComboBox1->insertItem( "Always, Negotiated", 1 ); 333 ComboBox1->insertItem( "Always, Negotiated", 1 );
333 ComboBox1->insertItem( "Connect on secure port", 2 ); 334 ComboBox1->insertItem( "Connect on secure port", 2 );
334 ComboBox1->insertItem( "Run command instead", 3 ); 335 ComboBox1->insertItem( "Run command instead", 3 );
335 CommandEdit->hide(); 336 CommandEdit->hide();
336 ComboBox1->setCurrentItem( data->ConnectionType() ); 337 ComboBox1->setCurrentItem( data->ConnectionType() );
337} 338}
338 339
339void IMAPconfig::slotConnectionToggle( int index ) 340void IMAPconfig::slotConnectionToggle( int index )
340{ 341{
341 if ( index == 2 ) 342 if ( index == 2 )
342 { 343 {
343 portLine->setText( IMAP_SSL_PORT ); 344 portLine->setText( IMAP_SSL_PORT );
344 } 345 }
345 else if ( index == 3 ) 346 else if ( index == 3 )
346 { 347 {
347 portLine->setText( IMAP_PORT ); 348 portLine->setText( IMAP_PORT );
348 CommandEdit->show(); 349 CommandEdit->show();
349 } 350 }
350 else 351 else
351 { 352 {
352 portLine->setText( IMAP_PORT ); 353 portLine->setText( IMAP_PORT );
353 } 354 }
354} 355}
355 356
356void IMAPconfig::fillValues() 357void IMAPconfig::fillValues()
357{ 358{
358 accountLine->setText( data->getAccountName() ); 359 accountLine->setText( data->getAccountName() );
359 serverLine->setText( data->getServer() ); 360 serverLine->setText( data->getServer() );
360 portLine->setText( data->getPort() ); 361 portLine->setText( data->getPort() );
361 ComboBox1->setCurrentItem( data->ConnectionType() ); 362 ComboBox1->setCurrentItem( data->ConnectionType() );
362 userLine->setText( data->getUser() ); 363 userLine->setText( data->getUser() );
363 passLine->setText( data->getPassword() ); 364 passLine->setText( data->getPassword() );
364 prefixLine->setText(data->getPrefix()); 365 prefixLine->setText(data->getPrefix());
365 localFolder->setText( data->getLocalFolder() ); 366 localFolder->setText( data->getLocalFolder() );
366 int max = data->getMaxMailSize() ; 367 int max = data->getMaxMailSize() ;
367 if ( max ) { 368 if ( max ) {
368 CheckBoxDown->setChecked( true ); 369 CheckBoxDown->setChecked( true );
369 SpinBoxDown->setValue ( max ); 370 SpinBoxDown->setValue ( max );
370 } else { 371 } else {
371 CheckBoxDown->setChecked( false ); 372 CheckBoxDown->setChecked( false );
372 SpinBoxDown->setValue ( 5 ); 373 SpinBoxDown->setValue ( 5 );
373 } 374 }
374 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 375 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
375} 376}
376 377
377void IMAPconfig::accept() 378void IMAPconfig::accept()
378{ 379{
379 data->setAccountName( accountLine->text() ); 380 data->setAccountName( accountLine->text() );
380 data->setServer( serverLine->text() ); 381 data->setServer( serverLine->text() );
381 data->setPort( portLine->text() ); 382 data->setPort( portLine->text() );
382 data->setConnectionType( ComboBox1->currentItem() ); 383 data->setConnectionType( ComboBox1->currentItem() );
383 data->setUser( userLine->text() ); 384 data->setUser( userLine->text() );
384 data->setPassword( passLine->text() ); 385 data->setPassword( passLine->text() );
385 data->setPrefix(prefixLine->text()); 386 data->setPrefix(prefixLine->text());
386 data->setLocalFolder( localFolder->text() ); 387 data->setLocalFolder( localFolder->text() );
387 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 388 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
388 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 389 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
389 390
390 QDialog::accept(); 391 QDialog::accept();
391} 392}
392 393
393/** 394/**
394 * POP3config 395 * POP3config
395 */ 396 */
396 397
397POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 398POP3config::POP3config( POP3account *account, QWidget *parent, const char *name, bool modal, WFlags flags )
398 : POP3configUI( parent, name, modal, flags ) 399 : POP3configUI( parent, name, modal, flags )
399{ 400{
400 data = account; 401 data = account;
401 fillValues(); 402 fillValues();
402 403
403 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 404 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
404 ComboBox1->insertItem( "Only if available", 0 ); 405 ComboBox1->insertItem( "Only if available", 0 );
405 ComboBox1->insertItem( "Always, Negotiated", 1 ); 406 ComboBox1->insertItem( "Always, Negotiated", 1 );
406 ComboBox1->insertItem( "Connect on secure port", 2 ); 407 ComboBox1->insertItem( "Connect on secure port", 2 );
407 ComboBox1->insertItem( "Run command instead", 3 ); 408 ComboBox1->insertItem( "Run command instead", 3 );
408 CommandEdit->hide(); 409 CommandEdit->hide();
409 ComboBox1->setCurrentItem( data->ConnectionType() ); 410 ComboBox1->setCurrentItem( data->ConnectionType() );
410} 411}
411 412
412void POP3config::slotConnectionToggle( int index ) 413void POP3config::slotConnectionToggle( int index )
413{ 414{
414 // 2 is ssl connection 415 // 2 is ssl connection
415 if ( index == 2 ) 416 if ( index == 2 )
416 { 417 {
417 portLine->setText( POP3_SSL_PORT ); 418 portLine->setText( POP3_SSL_PORT );
418 } 419 }
419 else if ( index == 3 ) 420 else if ( index == 3 )
420 { 421 {
421 portLine->setText( POP3_PORT ); 422 portLine->setText( POP3_PORT );
422 CommandEdit->show(); 423 CommandEdit->show();
423 } 424 }
424 else 425 else
425 { 426 {
426 portLine->setText( POP3_PORT ); 427 portLine->setText( POP3_PORT );
427 } 428 }
428} 429}
429 430
430void POP3config::fillValues() 431void POP3config::fillValues()
431{ 432{
432 accountLine->setText( data->getAccountName() ); 433 accountLine->setText( data->getAccountName() );
433 serverLine->setText( data->getServer() ); 434 serverLine->setText( data->getServer() );
434 portLine->setText( data->getPort() ); 435 portLine->setText( data->getPort() );
435 ComboBox1->setCurrentItem( data->ConnectionType() ); 436 ComboBox1->setCurrentItem( data->ConnectionType() );
436 userLine->setText( data->getUser() ); 437 userLine->setText( data->getUser() );
437 passLine->setText( data->getPassword() ); 438 passLine->setText( data->getPassword() );
438 localFolder->setText( data->getLocalFolder() ); 439 localFolder->setText( data->getLocalFolder() );
439 int max = data->getMaxMailSize() ; 440 int max = data->getMaxMailSize() ;
440 if ( max ) { 441 if ( max ) {
441 CheckBoxDown->setChecked( true ); 442 CheckBoxDown->setChecked( true );
442 SpinBoxDown->setValue ( max ); 443 SpinBoxDown->setValue ( max );
443 } else { 444 } else {
444 CheckBoxDown->setChecked( false ); 445 CheckBoxDown->setChecked( false );
445 SpinBoxDown->setValue ( 5 ); 446 SpinBoxDown->setValue ( 5 );
446 } 447 }
447 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() ); 448 CheckBoxLeaveOn->setChecked( data->getLeaveOnServer() );
448} 449}
449 450
450void POP3config::accept() 451void POP3config::accept()
451{ 452{
452 data->setAccountName( accountLine->text() ); 453 data->setAccountName( accountLine->text() );
453 data->setServer( serverLine->text() ); 454 data->setServer( serverLine->text() );
454 data->setPort( portLine->text() ); 455 data->setPort( portLine->text() );
455 data->setConnectionType( ComboBox1->currentItem() ); 456 data->setConnectionType( ComboBox1->currentItem() );
456 data->setUser( userLine->text() ); 457 data->setUser( userLine->text() );
457 data->setPassword( passLine->text() ); 458 data->setPassword( passLine->text() );
458 data->setLocalFolder( localFolder->text() ); 459 data->setLocalFolder( localFolder->text() );
459 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ; 460 data->setMaxMailSize( CheckBoxDown->isChecked()?SpinBoxDown->value():0 ) ;
460 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() ); 461 data->setLeaveOnServer( CheckBoxLeaveOn->isChecked() );
461 462
462 QDialog::accept(); 463 QDialog::accept();
463} 464}
464 465
465/** 466/**
466 * SMTPconfig 467 * SMTPconfig
467 */ 468 */
468 469
469SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 470SMTPconfig::SMTPconfig( SMTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
470 : SMTPconfigUI( parent, name, modal, flags ) 471 : SMTPconfigUI( parent, name, modal, flags )
471{ 472{
472 data = account; 473 data = account;
473 474
474 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 475 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
475 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 476 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
476 477
477 fillValues(); 478 fillValues();
478 479
479 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) ); 480 connect( ComboBox1, SIGNAL( activated(int) ), SLOT( slotConnectionToggle(int) ) );
480 ComboBox1->insertItem( "Only if available", 0 ); 481 ComboBox1->insertItem( "Only if available", 0 );
481 ComboBox1->insertItem( "Always, Negotiated", 1 ); 482 ComboBox1->insertItem( "Always, Negotiated", 1 );
482 ComboBox1->insertItem( "Connect on secure port", 2 ); 483 ComboBox1->insertItem( "Connect on secure port", 2 );
483 ComboBox1->insertItem( "Run command instead", 3 ); 484 ComboBox1->insertItem( "Run command instead", 3 );
484 CommandEdit->hide(); 485 CommandEdit->hide();
485 ComboBox1->setCurrentItem( data->ConnectionType() ); 486 ComboBox1->setCurrentItem( data->ConnectionType() );
486} 487}
487 488
488void SMTPconfig::slotConnectionToggle( int index ) 489void SMTPconfig::slotConnectionToggle( int index )
489{ 490{
490 // 2 is ssl connection 491 // 2 is ssl connection
491 if ( index == 2 ) 492 if ( index == 2 )
492 { 493 {
493 portLine->setText( SMTP_SSL_PORT ); 494 portLine->setText( SMTP_SSL_PORT );
494 } 495 }
495 else if ( index == 3 ) 496 else if ( index == 3 )
496 { 497 {
497 portLine->setText( SMTP_PORT ); 498 portLine->setText( SMTP_PORT );
498 CommandEdit->show(); 499 CommandEdit->show();
499 } 500 }
500 else 501 else
501 { 502 {
502 portLine->setText( SMTP_PORT ); 503 portLine->setText( SMTP_PORT );
503 } 504 }
504} 505}
505 506
506void SMTPconfig::fillValues() 507void SMTPconfig::fillValues()
507{ 508{
508 accountLine->setText( data->getAccountName() ); 509 accountLine->setText( data->getAccountName() );
509 serverLine->setText( data->getServer() ); 510 serverLine->setText( data->getServer() );
510 portLine->setText( data->getPort() ); 511 portLine->setText( data->getPort() );
511 ComboBox1->setCurrentItem( data->ConnectionType() ); 512 ComboBox1->setCurrentItem( data->ConnectionType() );
512 loginBox->setChecked( data->getLogin() ); 513 loginBox->setChecked( data->getLogin() );
513 userLine->setText( data->getUser() ); 514 userLine->setText( data->getUser() );
514 passLine->setText( data->getPassword() ); 515 passLine->setText( data->getPassword() );
515} 516}
516 517
517void SMTPconfig::accept() 518void SMTPconfig::accept()
518{ 519{
519 data->setAccountName( accountLine->text() ); 520 data->setAccountName( accountLine->text() );
520 data->setServer( serverLine->text() ); 521 data->setServer( serverLine->text() );
521 data->setPort( portLine->text() ); 522 data->setPort( portLine->text() );
522 data->setConnectionType( ComboBox1->currentItem() ); 523 data->setConnectionType( ComboBox1->currentItem() );
523 data->setLogin( loginBox->isChecked() ); 524 data->setLogin( loginBox->isChecked() );
524 data->setUser( userLine->text() ); 525 data->setUser( userLine->text() );
525 data->setPassword( passLine->text() ); 526 data->setPassword( passLine->text() );
526 527
527 QDialog::accept(); 528 QDialog::accept();
528} 529}
529 530
530/** 531/**
531 * NNTPconfig 532 * NNTPconfig
532 */ 533 */
533 534
534NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags ) 535NNTPconfig::NNTPconfig( NNTPaccount *account, QWidget *parent, const char *name, bool modal, WFlags flags )
535 : NNTPconfigUI( parent, name, modal, flags ) 536 : NNTPconfigUI( parent, name, modal, flags )
536{ 537{
537 data = account; 538 data = account;
538 539
539 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) ); 540 connect( loginBox, SIGNAL( toggled(bool) ), userLine, SLOT( setEnabled(bool) ) );
540 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) ); 541 connect( loginBox, SIGNAL( toggled(bool) ), passLine, SLOT( setEnabled(bool) ) );
541 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) ); 542 connect( GetNGButton, SIGNAL( clicked() ), this, SLOT( slotGetNG() ) );
542 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) ); 543 connect( ShowSubcribed, SIGNAL( clicked() ), this, SLOT( slotShowSub() ) );
543 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) ); 544 connect( FilterButton, SIGNAL( clicked() ), this, SLOT( slotShowFilter() ) );
544 fillValues(); 545 fillValues();
545 546
546 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) ); 547 connect( sslBox, SIGNAL( toggled(bool) ), SLOT( slotSSL(bool) ) );
547} 548}
548 549
549void NNTPconfig::slotShowSub() 550void NNTPconfig::slotShowSub()
550{ 551{
551 save(); 552 save();
552 data->save(); 553 data->save();
553 ListViewGroups->clear(); 554 ListViewGroups->clear();
554 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 555 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
555 QCheckListItem *item; 556 QCheckListItem *item;
556 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 557 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
557 item->setOn( true ); 558 item->setOn( true );
558 } 559 }
559 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count())); 560 topLevelWidget()->setCaption( i18n("%1 groups subscribed").arg( subscribedGroups.count()));
560} 561}
561void NNTPconfig::slotShowFilter() 562void NNTPconfig::slotShowFilter()
562{ 563{
563 save(); 564 save();
564 data->save(); 565 data->save();
565 ListViewGroups->clear(); 566 ListViewGroups->clear();
566 int count = 0; 567 int count = 0;
567 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 568 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
568 QCheckListItem *item; 569 QCheckListItem *item;
569 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) { 570 if ( GroupFilter->text().isEmpty() || (*it).find( GroupFilter->text() ) >= 0 ) {
570 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 571 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
571 ++count; 572 ++count;
572 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 573 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
573 item->setOn( true ); 574 item->setOn( true );
574 } 575 }
575 } 576 }
576 } 577 }
577 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count)); 578 topLevelWidget()->setCaption( i18n("Filter found %1 groups").arg( count));
578} 579}
579void NNTPconfig::slotGetNG() { 580void NNTPconfig::slotGetNG() {
580 save(); 581 save();
581 data->save(); 582 data->save();
582 topLevelWidget()->setCaption( i18n("Fetching group list...")); 583 topLevelWidget()->setCaption( i18n("Fetching group list..."));
583 qApp->processEvents(); 584 qApp->processEvents();
584 NNTPwrapper* tmp = new NNTPwrapper( data ); 585 NNTPwrapper* tmp = new NNTPwrapper( data );
585 allGroups = tmp->listAllNewsgroups(); 586 allGroups = tmp->listAllNewsgroups();
586 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count())); 587 topLevelWidget()->setCaption( i18n("Downloaded %1 group names").arg( allGroups.count()));
587 588
588 ListViewGroups->clear(); 589 ListViewGroups->clear();
589 590
590 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) { 591 for ( QStringList::Iterator it = allGroups.begin(); it != allGroups.end(); ++it ) {
591 QCheckListItem *item; 592 QCheckListItem *item;
592 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 593 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
593 if ( subscribedGroups.contains( (*it) ) >= 1 ) { 594 if ( subscribedGroups.contains( (*it) ) >= 1 ) {
594 item->setOn( true ); 595 item->setOn( true );
595 596
596 } 597 }
597 } 598 }
598 delete tmp; 599 delete tmp;
599} 600}
600 601
601void NNTPconfig::slotSSL( bool enabled ) 602void NNTPconfig::slotSSL( bool enabled )
602{ 603{
603 if ( enabled ) 604 if ( enabled )
604 { 605 {
605 portLine->setText( NNTP_SSL_PORT ); 606 portLine->setText( NNTP_SSL_PORT );
606 } 607 }
607 else 608 else
608 { 609 {
609 portLine->setText( NNTP_PORT ); 610 portLine->setText( NNTP_PORT );
610 } 611 }
611} 612}
612 613
613void NNTPconfig::fillValues() 614void NNTPconfig::fillValues()
614{ 615{
615 accountLine->setText( data->getAccountName() ); 616 accountLine->setText( data->getAccountName() );
616 serverLine->setText( data->getServer() ); 617 serverLine->setText( data->getServer() );
617 portLine->setText( data->getPort() ); 618 portLine->setText( data->getPort() );
618 sslBox->setChecked( data->getSSL() ); 619 sslBox->setChecked( data->getSSL() );
619 loginBox->setChecked( data->getLogin() ); 620 loginBox->setChecked( data->getLogin() );
620 userLine->setText( data->getUser() ); 621 userLine->setText( data->getUser() );
621 passLine->setText( data->getPassword() ); 622 passLine->setText( data->getPassword() );
622 subscribedGroups = data->getGroups(); 623 subscribedGroups = data->getGroups();
623 /* don't forget that - you will overwrite values if user clicks cancel! */ 624 /* don't forget that - you will overwrite values if user clicks cancel! */
624 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) { 625 for ( QStringList::Iterator it = subscribedGroups.begin(); it != subscribedGroups.end(); ++it ) {
625 QCheckListItem *item; 626 QCheckListItem *item;
626 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox ); 627 item = new QCheckListItem( ListViewGroups, (*it), QCheckListItem::CheckBox );
627 item->setOn( true ); 628 item->setOn( true );
628 } 629 }
629} 630}
630 631
631void NNTPconfig::save() 632void NNTPconfig::save()
632{ 633{
633 data->setAccountName( accountLine->text() ); 634 data->setAccountName( accountLine->text() );
634 data->setServer( serverLine->text() ); 635 data->setServer( serverLine->text() );
635 data->setPort( portLine->text() ); 636 data->setPort( portLine->text() );
636 data->setSSL( sslBox->isChecked() ); 637 data->setSSL( sslBox->isChecked() );
637 data->setLogin( loginBox->isChecked() ); 638 data->setLogin( loginBox->isChecked() );
638 data->setUser( userLine->text() ); 639 data->setUser( userLine->text() );
639 data->setPassword( passLine->text() ); 640 data->setPassword( passLine->text() );
640 641
641 QListViewItemIterator list_it( ListViewGroups ); 642 QListViewItemIterator list_it( ListViewGroups );
642 643
643 for ( ; list_it.current(); ++list_it ) { 644 for ( ; list_it.current(); ++list_it ) {
644 645
645 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) { 646 if ( ( (QCheckListItem*)list_it.current() )->isOn() ) {
646 if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 ) 647 if ( subscribedGroups.contains( list_it.current()->text(0) ) < 1 )
647 subscribedGroups.append( list_it.current()->text(0) ); 648 subscribedGroups.append( list_it.current()->text(0) );
648 } else { 649 } else {
649 if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 ) 650 if ( subscribedGroups.contains( list_it.current()->text(0) ) >= 1 )
650 subscribedGroups.remove( list_it.current()->text(0) ); 651 subscribedGroups.remove( list_it.current()->text(0) );
651 } 652 }
652 653
653 } 654 }
654 data->setGroups( subscribedGroups ); 655 data->setGroups( subscribedGroups );
655} 656}
656 657
657void NNTPconfig::accept() 658void NNTPconfig::accept()
658{ 659{
659 save(); 660 save();
660 QDialog::accept(); 661 QDialog::accept();
661} 662}
662 663
diff --git a/kmicromail/kmicromail.pro b/kmicromail/kmicromail.pro
index cd5a3c1..927dc8a 100644
--- a/kmicromail/kmicromail.pro
+++ b/kmicromail/kmicromail.pro
@@ -1,77 +1,78 @@
1CONFIG += qt warn_on 1CONFIG += qt warn_on
2 TEMPLATE= app 2 TEMPLATE= app
3HEADERS = defines.h \ 3HEADERS = defines.h \
4 editaccounts.h \ 4 editaccounts.h \
5 composemail.h \ 5 composemail.h \
6 accountview.h \ 6 accountview.h \
7 accountitem.h \ 7 accountitem.h \
8 mainwindow.h \ 8 mainwindow.h \
9 viewmail.h \ 9 viewmail.h \
10 viewmailbase.h \ 10 viewmailbase.h \
11 opiemail.h \ 11 opiemail.h \
12 mailistviewitem.h \ 12 mailistviewitem.h \
13 settingsdialog.h \ 13 settingsdialog.h \
14 statuswidget.h \ 14 statuswidget.h \
15 newmaildir.h \ 15 newmaildir.h \
16 selectstore.h \ 16 selectstore.h \
17 selectsmtp.h \ 17 selectsmtp.h \
18 ./qpe/qdialog.h \
18 nntpgroups.h \ 19 nntpgroups.h \
19 koprefs.h \ 20 koprefs.h \
20 koprefsdialog.h \ 21 koprefsdialog.h \
21 nntpgroupsdlg.h 22 nntpgroupsdlg.h
22 23
23SOURCES = main.cpp \ 24SOURCES = main.cpp \
24 opiemail.cpp \ 25 opiemail.cpp \
25 mainwindow.cpp \ 26 mainwindow.cpp \
26 accountview.cpp \ 27 accountview.cpp \
27 accountitem.cpp \ 28 accountitem.cpp \
28 composemail.cpp \ 29 composemail.cpp \
29 editaccounts.cpp \ 30 editaccounts.cpp \
30 viewmail.cpp \ 31 viewmail.cpp \
31 viewmailbase.cpp \ 32 viewmailbase.cpp \
32 mailistviewitem.cpp \ 33 mailistviewitem.cpp \
33 settingsdialog.cpp \ 34 settingsdialog.cpp \
34 statuswidget.cpp \ 35 statuswidget.cpp \
35 newmaildir.cpp \ 36 newmaildir.cpp \
36 selectstore.cpp \ 37 selectstore.cpp \
37 selectsmtp.cpp \ 38 selectsmtp.cpp \
38 nntpgroups.cpp \ 39 nntpgroups.cpp \
39 koprefs.cpp\ 40 koprefs.cpp\
40 koprefsdialog.cpp\ 41 koprefsdialog.cpp\
41 nntpgroupsdlg.cpp 42 nntpgroupsdlg.cpp
42 43
43INTERFACES = editaccountsui.ui \ 44INTERFACES = editaccountsui.ui \
44 selectmailtypeui.ui \ 45 selectmailtypeui.ui \
45 imapconfigui.ui \ 46 imapconfigui.ui \
46 pop3configui.ui \ 47 pop3configui.ui \
47 nntpconfigui.ui \ 48 nntpconfigui.ui \
48 smtpconfigui.ui \ 49 smtpconfigui.ui \
49 composemailui.ui \ 50 composemailui.ui \
50 settingsdialogui.ui \ 51 settingsdialogui.ui \
51 statuswidgetui.ui \ 52 statuswidgetui.ui \
52 newmaildirui.ui \ 53 newmaildirui.ui \
53 selectstoreui.ui \ 54 selectstoreui.ui \
54 nntpgroupsui.ui 55 nntpgroupsui.ui
55 56
56 57
57INCLUDEPATH += . .. ../libkdepim ../microkde ../microkde/kdecore libetpan/include ../microkde/kdeui 58INCLUDEPATH += ./qpe . .. ../libkdepim ../microkde ../microkde/kdecore libetpan/include ../microkde/kdeui
58LIBS += -L../bin -lmicromailwrapper -lmicrolibetpan -lmicrokde -lssl -lcrypto -lmicrokdepim -lmicrokabc 59LIBS += -L../bin -lmicromailwrapper -lmicrolibetpan -lmicrokde -lssl -lcrypto -lmicrokdepim -lmicrokabc
59 60
60DESTDIR= ../bin 61DESTDIR= ../bin
61TARGET = ompi 62TARGET = ompi
62 63
63DEFINES += DESKTOP_VERSION 64DEFINES += DESKTOP_VERSION
64unix : { 65unix : {
65OBJECTS_DIR = obj/unix 66OBJECTS_DIR = obj/unix
66MOC_DIR = moc/unix 67MOC_DIR = moc/unix
67} 68}
68win32: { 69win32: {
69DEFINES += _WIN32_ 70DEFINES += _WIN32_
70LIBS += mfc71u.lib 71LIBS += mfc71u.lib
71QMAKE_LINK += /NODEFAULTLIB:LIBC 72QMAKE_LINK += /NODEFAULTLIB:LIBC
72#QMAKE_LINK += /NODEFAULTLIB:MSVCRT 73#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
73#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib 74#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
74OBJECTS_DIR = obj/win 75OBJECTS_DIR = obj/win
75MOC_DIR = moc/win 76MOC_DIR = moc/win
76} 77}
77 78
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp
index 598d12f..c878fc9 100644
--- a/kmicromail/koprefsdialog.cpp
+++ b/kmicromail/koprefsdialog.cpp
@@ -1,1718 +1,1718 @@
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 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 150
151 151
152} 152}
153void KOPrefsDialog::setupFontsTab() 153void KOPrefsDialog::setupFontsTab()
154{ 154{
155 155
156 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 156 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
157 // DesktopIcon("fonts",KIcon::SizeMedium)); 157 // DesktopIcon("fonts",KIcon::SizeMedium));
158 158
159 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 159 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
160 topLayout->setSpacing(1); 160 topLayout->setSpacing(1);
161 topLayout->setMargin(3); 161 topLayout->setMargin(3);
162 KPrefsDialogWidFont * tVFont; 162 KPrefsDialogWidFont * tVFont;
163 int i = 0; 163 int i = 0;
164 KPrefsDialogWidFont *timeLabelsFont = 164 KPrefsDialogWidFont *timeLabelsFont =
165 addWidFont(i18n("OK"),i18n("Application(nr)"), 165 addWidFont(i18n("OK"),i18n("Application(nr)"),
166 &(KOPrefs::instance()->mAppFont),topFrame); 166 &(KOPrefs::instance()->mAppFont),topFrame);
167 topLayout->addWidget(timeLabelsFont->label(),i,0); 167 topLayout->addWidget(timeLabelsFont->label(),i,0);
168 topLayout->addWidget(timeLabelsFont->preview(),i,1); 168 topLayout->addWidget(timeLabelsFont->preview(),i,1);
169 topLayout->addWidget(timeLabelsFont->button(),i,2); 169 topLayout->addWidget(timeLabelsFont->button(),i,2);
170 ++i; 170 ++i;
171 171
172 172
173 timeLabelsFont = 173 timeLabelsFont =
174 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), 174 addWidFont(i18n("Dear Mr."),i18n("Compose mail:"),
175 &(KOPrefs::instance()->mComposeFont),topFrame); 175 &(KOPrefs::instance()->mComposeFont),topFrame);
176 topLayout->addWidget(timeLabelsFont->label(),i,0); 176 topLayout->addWidget(timeLabelsFont->label(),i,0);
177 topLayout->addWidget(timeLabelsFont->preview(),i,1); 177 topLayout->addWidget(timeLabelsFont->preview(),i,1);
178 topLayout->addWidget(timeLabelsFont->button(),i,2); 178 topLayout->addWidget(timeLabelsFont->button(),i,2);
179 ++i; 179 ++i;
180 180
181 KPrefsDialogWidFont *timeBarFont = 181 KPrefsDialogWidFont *timeBarFont =
182 addWidFont(i18n("Hello"),i18n("Read mail:"), 182 addWidFont(i18n("Hello"),i18n("Read mail:"),
183 &(KOPrefs::instance()->mReadFont),topFrame); 183 &(KOPrefs::instance()->mReadFont),topFrame);
184 topLayout->addWidget(timeBarFont->label(),i,0); 184 topLayout->addWidget(timeBarFont->label(),i,0);
185 topLayout->addWidget(timeBarFont->preview(),i,1); 185 topLayout->addWidget(timeBarFont->preview(),i,1);
186 topLayout->addWidget(timeBarFont->button(),i,2); 186 topLayout->addWidget(timeBarFont->button(),i,2);
187 ++i; 187 ++i;
188 188
189 topLayout->setColStretch(1,1); 189 topLayout->setColStretch(1,1);
190 topLayout->setRowStretch(4,1); 190 topLayout->setRowStretch(4,1);
191 191
192} 192}
193void KOPrefsDialog::usrReadConfig() 193void KOPrefsDialog::usrReadConfig()
194{ 194{
195 195
196 mNameEdit->setText(KOPrefs::instance()->mName); 196 mNameEdit->setText(KOPrefs::instance()->mName);
197 mEmailEdit->setText(KOPrefs::instance()->mEmail); 197 mEmailEdit->setText(KOPrefs::instance()->mEmail);
198 kdelibcfg->readConfig(); 198 kdelibcfg->readConfig();
199} 199}
200void KOPrefsDialog::usrWriteConfig() 200void KOPrefsDialog::usrWriteConfig()
201{ 201{
202 KOPrefs::instance()->mName = mNameEdit->text(); 202 KOPrefs::instance()->mName = mNameEdit->text();
203 KOPrefs::instance()->mEmail = mEmailEdit->text(); 203 KOPrefs::instance()->mEmail = mEmailEdit->text();
204 kdelibcfg->writeConfig(); 204 kdelibcfg->writeConfig();
205 205
206 206
207} 207}
208 208
209#if 0 209#if 0
210void KOPrefsDialog::setupLocaleDateTab() 210void KOPrefsDialog::setupLocaleDateTab()
211{ 211{
212QFrame *topFrame = addPage(i18n("Date Format"),0,0); 212QFrame *topFrame = addPage(i18n("Date Format"),0,0);
213 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 213 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
214 topLayout->setSpacing(spacingHint()); 214 topLayout->setSpacing(spacingHint());
215 topLayout->setMargin(marginHint()); 215 topLayout->setMargin(marginHint());
216 int iii = 0; 216 int iii = 0;
217 217
218 218
219 KPrefsWidRadios *syncPrefsGroup = 219 KPrefsWidRadios *syncPrefsGroup =
220 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 220 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
221 QString format; 221 QString format;
222 if ( QApplication::desktop()->width() < 480 ) 222 if ( QApplication::desktop()->width() < 480 )
223 format = "(%d.%m.%Y)"; 223 format = "(%d.%m.%Y)";
224 else 224 else
225 format = "(%d.%m.%Y|%A %d %B %Y)"; 225 format = "(%d.%m.%Y|%A %d %B %Y)";
226 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 226 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
227 if ( QApplication::desktop()->width() < 480 ) 227 if ( QApplication::desktop()->width() < 480 )
228 format = "(%m.%d.%Y)"; 228 format = "(%m.%d.%Y)";
229 else 229 else
230 format = "(%m.%d.%Y|%A %B %d %Y)"; 230 format = "(%m.%d.%Y|%A %B %d %Y)";
231 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 231 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
232 if ( QApplication::desktop()->width() < 480 ) 232 if ( QApplication::desktop()->width() < 480 )
233 format = "(%Y-%m-%d)"; 233 format = "(%Y-%m-%d)";
234 else 234 else
235 format = "(%Y-%m-%d|%A %Y %B %d)"; 235 format = "(%Y-%m-%d|%A %Y %B %d)";
236 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 236 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
237 syncPrefsGroup->addRadio(i18n("User defined")); 237 syncPrefsGroup->addRadio(i18n("User defined"));
238 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 238 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
239 ++iii; 239 ++iii;
240 ++iii; 240 ++iii;
241 QLabel * lab; 241 QLabel * lab;
242 mUserDateFormatLong = new QLineEdit(topFrame); 242 mUserDateFormatLong = new QLineEdit(topFrame);
243 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 243 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
244 topLayout->addWidget(lab ,iii,0); 244 topLayout->addWidget(lab ,iii,0);
245 topLayout->addWidget(mUserDateFormatLong,iii,1); 245 topLayout->addWidget(mUserDateFormatLong,iii,1);
246 ++iii; 246 ++iii;
247 mUserDateFormatShort = new QLineEdit(topFrame); 247 mUserDateFormatShort = new QLineEdit(topFrame);
248 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 248 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
249 topLayout->addWidget(lab ,iii,0); 249 topLayout->addWidget(lab ,iii,0);
250 topLayout->addWidget(mUserDateFormatShort,iii,1); 250 topLayout->addWidget(mUserDateFormatShort,iii,1);
251 ++iii; 251 ++iii;
252 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); 252 lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame);
253 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 253 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
254 ++iii; 254 ++iii;
255 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); 255 lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame);
256 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 256 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
257 ++iii; 257 ++iii;
258 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); 258 lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame);
259 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 259 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
260 ++iii; 260 ++iii;
261 261
262} 262}
263 263
264void KOPrefsDialog::setupLocaleTab() 264void KOPrefsDialog::setupLocaleTab()
265{ 265{
266 QFrame *topFrame = addPage(i18n("Locale"),0,0); 266 QFrame *topFrame = addPage(i18n("Locale"),0,0);
267 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 267 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
268 topLayout->setSpacing(spacingHint()); 268 topLayout->setSpacing(spacingHint());
269 topLayout->setMargin(marginHint()); 269 topLayout->setMargin(marginHint());
270 int iii = 0; 270 int iii = 0;
271 KPrefsWidRadios *syncPrefsGroup = 271 KPrefsWidRadios *syncPrefsGroup =
272 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 272 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
273 syncPrefsGroup->addRadio(i18n("English")); 273 syncPrefsGroup->addRadio(i18n("English"));
274 syncPrefsGroup->addRadio(i18n("German")); 274 syncPrefsGroup->addRadio(i18n("German"));
275 syncPrefsGroup->addRadio(i18n("French")); 275 syncPrefsGroup->addRadio(i18n("French"));
276 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 276 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
277 if ( QApplication::desktop()->width() < 300 ) 277 if ( QApplication::desktop()->width() < 300 )
278 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 278 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
279 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 279 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
280 ++iii; 280 ++iii;
281 281
282 syncPrefsGroup = 282 syncPrefsGroup =
283 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 283 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
284 if ( QApplication::desktop()->width() > 300 ) 284 if ( QApplication::desktop()->width() > 300 )
285 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 285 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
286 syncPrefsGroup->addRadio(i18n("24:00")); 286 syncPrefsGroup->addRadio(i18n("24:00"));
287 syncPrefsGroup->addRadio(i18n("12:00am")); 287 syncPrefsGroup->addRadio(i18n("12:00am"));
288 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 288 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
289 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 289 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
290 ++iii; 290 ++iii;
291 KPrefsDialogWidBool *sb; 291 KPrefsDialogWidBool *sb;
292 if ( QApplication::desktop()->width() < 300 ) { 292 if ( QApplication::desktop()->width() < 300 ) {
293 sb = 293 sb =
294 addWidBool(i18n("Week starts on Sunday"), 294 addWidBool(i18n("Week starts on Sunday"),
295 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 295 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
296 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 296 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
297 ++iii; 297 ++iii;
298 sb = 298 sb =
299 addWidBool(i18n("Use short date in (WN/E) view"), 299 addWidBool(i18n("Use short date in (WN/E) view"),
300 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 300 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
301 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 301 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
302 } 302 }
303 else { 303 else {
304 QWidget * hb = new QWidget( topFrame ); 304 QWidget * hb = new QWidget( topFrame );
305 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 305 QHBoxLayout *hbLayout = new QHBoxLayout(hb);
306 sb = 306 sb =
307 addWidBool(i18n("Week starts on Sunday"), 307 addWidBool(i18n("Week starts on Sunday"),
308 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 308 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
309 hbLayout->addWidget(sb->checkBox() ); 309 hbLayout->addWidget(sb->checkBox() );
310 sb = 310 sb =
311 addWidBool(i18n("Use short date in (WN/E) view"), 311 addWidBool(i18n("Use short date in (WN/E) view"),
312 &(KOPrefs::instance()->mShortDateInViewer),hb); 312 &(KOPrefs::instance()->mShortDateInViewer),hb);
313 hbLayout->addWidget(sb->checkBox() ); 313 hbLayout->addWidget(sb->checkBox() );
314 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 314 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
315 315
316 } 316 }
317 //#ifndef DESKTOP_VERSION 317 //#ifndef DESKTOP_VERSION
318#if 0 318#if 0
319 ++iii; 319 ++iii;
320 sb = 320 sb =
321 addWidBool(i18n("Quick load/save (w/o Unicode)"), 321 addWidBool(i18n("Quick load/save (w/o Unicode)"),
322 &(KOPrefs::instance()->mUseQuicksave),topFrame); 322 &(KOPrefs::instance()->mUseQuicksave),topFrame);
323 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 323 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
324#endif 324#endif
325} 325}
326void KOPrefsDialog::showSyncPage() 326void KOPrefsDialog::showSyncPage()
327{ 327{
328 showPage ( 2 ) ; 328 showPage ( 2 ) ;
329 329
330} 330}
331void KOPrefsDialog::setupSyncAlgTab() 331void KOPrefsDialog::setupSyncAlgTab()
332{ 332{
333#if 0 333#if 0
334 QLabel * lab; 334 QLabel * lab;
335 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); 335 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
336 mSetupSyncAlgTab = topFrame; 336 mSetupSyncAlgTab = topFrame;
337 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 337 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
338 topLayout->setSpacing(spacingHint()); 338 topLayout->setSpacing(spacingHint());
339 topLayout->setMargin(marginHint()); 339 topLayout->setMargin(marginHint());
340 int iii = 0; 340 int iii = 0;
341 341
342 KPrefsDialogWidBool *sb = 342 KPrefsDialogWidBool *sb =
343 addWidBool(i18n("Ask for preferences before syncing"), 343 addWidBool(i18n("Ask for preferences before syncing"),
344 &(KOPrefs::instance()->mAskForPreferences),topFrame); 344 &(KOPrefs::instance()->mAskForPreferences),topFrame);
345 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 345 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
346 346
347 ++iii; 347 ++iii;
348 348
349 KPrefsWidRadios *syncPrefsGroup = 349 KPrefsWidRadios *syncPrefsGroup =
350 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), 350 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
351 topFrame); 351 topFrame);
352 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 352 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
353 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 353 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
354 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 354 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
355 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 355 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
356 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 356 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
357 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 357 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
358 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 358 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
359 ++iii; 359 ++iii;
360 sb = 360 sb =
361 addWidBool(i18n("Show summary after syncing"), 361 addWidBool(i18n("Show summary after syncing"),
362 &(KOPrefs::instance()->mShowSyncSummary),topFrame); 362 &(KOPrefs::instance()->mShowSyncSummary),topFrame);
363 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 363 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
364 364
365 ++iii; 365 ++iii;
366#endif 366#endif
367 367
368 368
369 369
370} 370}
371 371
372 372
373void KOPrefsDialog::setupSyncTab() 373void KOPrefsDialog::setupSyncTab()
374{ 374{
375#if 0 375#if 0
376 QLabel * lab; 376 QLabel * lab;
377 QFrame *topFrame = addPage(i18n("Sync Network"),0,0); 377 QFrame *topFrame = addPage(i18n("Sync Network"),0,0);
378 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 378 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
379 topLayout->setSpacing(spacingHint()); 379 topLayout->setSpacing(spacingHint());
380 topLayout->setMargin(marginHint()); 380 topLayout->setMargin(marginHint());
381 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); 381 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame);
382 int iii = 0; 382 int iii = 0;
383 topLayout->addMultiCellWidget(lab , iii,iii,0,1); 383 topLayout->addMultiCellWidget(lab , iii,iii,0,1);
384 ++iii; 384 ++iii;
385 385
386 mRemoteIPEdit = new QLineEdit(topFrame); 386 mRemoteIPEdit = new QLineEdit(topFrame);
387 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); 387 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame);
388 topLayout->addWidget(lab ,iii,0); 388 topLayout->addWidget(lab ,iii,0);
389 topLayout->addWidget(mRemoteIPEdit,iii,1); 389 topLayout->addWidget(mRemoteIPEdit,iii,1);
390 ++iii; 390 ++iii;
391 mRemoteUser = new QLineEdit(topFrame); 391 mRemoteUser = new QLineEdit(topFrame);
392 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); 392 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame);
393 topLayout->addWidget(lab ,iii,0); 393 topLayout->addWidget(lab ,iii,0);
394 topLayout->addWidget(mRemoteUser, iii,1); 394 topLayout->addWidget(mRemoteUser, iii,1);
395 ++iii; 395 ++iii;
396 396
397 mRemoteFile = new QLineEdit(topFrame); 397 mRemoteFile = new QLineEdit(topFrame);
398 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); 398 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame);
399 topLayout->addWidget(lab ,iii,0); 399 topLayout->addWidget(lab ,iii,0);
400 topLayout->addWidget(mRemoteFile,iii,1); 400 topLayout->addWidget(mRemoteFile,iii,1);
401 ++iii; 401 ++iii;
402 402
403 mLocalTempFile = new QLineEdit(topFrame); 403 mLocalTempFile = new QLineEdit(topFrame);
404 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); 404 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame);
405 topLayout->addWidget(lab ,iii,0); 405 topLayout->addWidget(lab ,iii,0);
406 topLayout->addWidget(mLocalTempFile,iii,1); 406 topLayout->addWidget(mLocalTempFile,iii,1);
407 ++iii; 407 ++iii;
408 408
409 KPrefsDialogWidBool *wb = 409 KPrefsDialogWidBool *wb =
410 addWidBool(i18n("Write back synced file"), 410 addWidBool(i18n("Write back synced file"),
411 &(KOPrefs::instance()->mWriteBackFile),topFrame); 411 &(KOPrefs::instance()->mWriteBackFile),topFrame);
412 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 412 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
413 ++iii; 413 ++iii;
414 wb = 414 wb =
415 addWidBool(i18n("Write back existing entries only"), 415 addWidBool(i18n("Write back existing entries only"),
416 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); 416 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame);
417 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 417 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
418 ++iii; 418 ++iii;
419 419
420#endif 420#endif
421} 421}
422 422
423void KOPrefsDialog::setupMainTab() 423void KOPrefsDialog::setupMainTab()
424{ 424{
425 QFrame *topFrame = addPage(i18n("General"),0,0); 425 QFrame *topFrame = addPage(i18n("General"),0,0);
426 // DesktopIcon("identity",KIcon::SizeMedium)); 426 // DesktopIcon("identity",KIcon::SizeMedium));
427 427
428 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 428 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
429 topLayout->setSpacing(spacingHint()); 429 topLayout->setSpacing(spacingHint());
430 topLayout->setMargin(marginHint()); 430 topLayout->setMargin(marginHint());
431 431
432 // KPrefsDialogWidBool *emailControlCenter = 432 // KPrefsDialogWidBool *emailControlCenter =
433// addWidBool(i18n("&Use email settings from Control Center"), 433// addWidBool(i18n("&Use email settings from Control Center"),
434// &(KOPrefs::instance()->mEmailControlCenter),topFrame); 434// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
435// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); 435// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
436 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), 436 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
437 // SLOT(toggleEmailSettings(bool))); 437 // SLOT(toggleEmailSettings(bool)));
438 438
439 mNameEdit = new QLineEdit(topFrame); 439 mNameEdit = new QLineEdit(topFrame);
440 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 440 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
441 topLayout->addWidget(mNameLabel,0,0); 441 topLayout->addWidget(mNameLabel,0,0);
442 topLayout->addWidget(mNameEdit,0,1); 442 topLayout->addWidget(mNameEdit,0,1);
443 443
444 mEmailEdit = new QLineEdit(topFrame); 444 mEmailEdit = new QLineEdit(topFrame);
445 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 445 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
446 topLayout->addWidget(mEmailLabel,1,0); 446 topLayout->addWidget(mEmailLabel,1,0);
447 topLayout->addWidget(mEmailEdit,1,1); 447 topLayout->addWidget(mEmailEdit,1,1);
448 KPrefsDialogWidBool *wb; 448 KPrefsDialogWidBool *wb;
449 QHBox *dummy; 449 QHBox *dummy;
450 if ( QApplication::desktop()->width() > 480 ) { 450 if ( QApplication::desktop()->width() > 480 ) {
451 dummy = new QHBox(topFrame); 451 dummy = new QHBox(topFrame);
452 } else { 452 } else {
453 dummy = new QVBox(topFrame); 453 dummy = new QVBox(topFrame);
454 } 454 }
455 455
456 topLayout->addMultiCellWidget(dummy, 2,2,0,1); 456 topLayout->addMultiCellWidget(dummy, 2,2,0,1);
457 addWidBool(i18n("Full menu bar(nr)"), 457 addWidBool(i18n("Full menu bar(nr)"),
458 &(KOPrefs::instance()->mShowFullMenu),dummy); 458 &(KOPrefs::instance()->mShowFullMenu),dummy);
459 459
460 460
461 addWidBool(i18n("Mini icons in toolbar(nr)"), 461 addWidBool(i18n("Mini icons in toolbar(nr)"),
462 &(KOPrefs::instance()->mToolBarMiniIcons),dummy); 462 &(KOPrefs::instance()->mToolBarMiniIcons),dummy);
463 463
464 464
465 dummy = new QHBox(topFrame); 465 dummy = new QHBox(topFrame);
466 new QLabel(i18n("Days in What's Next:"),dummy); 466 new QLabel(i18n("Days in What's Next:"),dummy);
467 mWhatsNextSpin = new QSpinBox(1,14,1,dummy); 467 mWhatsNextSpin = new QSpinBox(1,14,1,dummy);
468 468
469 topLayout->addMultiCellWidget(dummy,3,3,0,1); 469 topLayout->addMultiCellWidget(dummy,3,3,0,1);
470 470
471 471
472 472
473 dummy = new QHBox(topFrame); 473 dummy = new QHBox(topFrame);
474 new QLabel(i18n("Days in Next-X-Days:"),dummy); 474 new QLabel(i18n("Days in Next-X-Days:"),dummy);
475 mNextXDaysSpin = new QSpinBox(2,14,1,dummy); 475 mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
476 476
477 topLayout->addMultiCellWidget(dummy,4,4,0,1); 477 topLayout->addMultiCellWidget(dummy,4,4,0,1);
478 478
479 QHBox *prioBox = new QHBox(topFrame); 479 QHBox *prioBox = new QHBox(topFrame);
480 // intervalBox->setSpacing(spacingHint()); 480 // intervalBox->setSpacing(spacingHint());
481 topLayout->addMultiCellWidget(prioBox,5,5,0,1); 481 topLayout->addMultiCellWidget(prioBox,5,5,0,1);
482 QString messa = i18n("Show topmost todo prios in What's Next:"); 482 QString messa = i18n("Show topmost todo prios in What's Next:");
483 483
484 if ( QApplication::desktop()->width() < 300 ) 484 if ( QApplication::desktop()->width() < 300 )
485 messa = i18n("Show topmost todo prios in What's N.:"); 485 messa = i18n("Show topmost todo prios in What's N.:");
486 QLabel *prioLabel = new QLabel(messa, prioBox); 486 QLabel *prioLabel = new QLabel(messa, prioBox);
487 mPrioSpin = new QSpinBox(0,5,1,prioBox); 487 mPrioSpin = new QSpinBox(0,5,1,prioBox);
488 if ( QApplication::desktop()->width() < 300 ) 488 if ( QApplication::desktop()->width() < 300 )
489 mPrioSpin->setFixedWidth( 40 ); 489 mPrioSpin->setFixedWidth( 40 );
490 490
491 // KPrefsDialogWidBool *bcc = 491 // KPrefsDialogWidBool *bcc =
492// addWidBool(i18n("Send copy to owner when mailing events"), 492// addWidBool(i18n("Send copy to owner when mailing events"),
493// &(KOPrefs::instance()->mBcc),topFrame); 493// &(KOPrefs::instance()->mBcc),topFrame);
494// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); 494// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
495 495
496 496
497 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); 497 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
498 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); 498 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
499 499
500 // addWidBool(i18n("Enable automatic saving of calendar"), 500 // addWidBool(i18n("Enable automatic saving of calendar"),
501 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); 501 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
502 502
503 QHBox *intervalBox = new QHBox(topFrame); 503 QHBox *intervalBox = new QHBox(topFrame);
504 // intervalBox->setSpacing(spacingHint()); 504 // intervalBox->setSpacing(spacingHint());
505 topLayout->addMultiCellWidget(intervalBox,6,6,0,1); 505 topLayout->addMultiCellWidget(intervalBox,6,6,0,1);
506 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); 506 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
507 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); 507 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
508 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); 508 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
509 /* 509 /*
510 QHBox * agendasize = new QHBox ( topFrame ); 510 QHBox * agendasize = new QHBox ( topFrame );
511 511
512 new QLabel (i18n("AllDayAgenda Height:"), agendasize ); 512 new QLabel (i18n("AllDayAgenda Height:"), agendasize );
513 513
514 514
515 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); 515 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
516 topLayout->addMultiCellWidget(agendasize,7,7,0,1); 516 topLayout->addMultiCellWidget(agendasize,7,7,0,1);
517 */ 517 */
518 KPrefsDialogWidBool *verticalScreen = 518 KPrefsDialogWidBool *verticalScreen =
519 addWidBool(i18n("Show vertical screen (Needs restart)"), 519 addWidBool(i18n("Show vertical screen (Needs restart)"),
520 &(KOPrefs::instance()->mVerticalScreen),topFrame); 520 &(KOPrefs::instance()->mVerticalScreen),topFrame);
521 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); 521 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
522 topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); 522 topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1);
523 523
524 KPrefsDialogWidBool *ask = 524 KPrefsDialogWidBool *ask =
525 addWidBool(i18n("Ask for quit when closing KO/Pi"), 525 addWidBool(i18n("Ask for quit when closing KO/Pi"),
526 &(KOPrefs::instance()->mAskForQuit),topFrame); 526 &(KOPrefs::instance()->mAskForQuit),topFrame);
527 topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); 527 topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1);
528 528
529 529
530 /* 530 /*
531 KPrefsDialogWidBool *confirmCheck = 531 KPrefsDialogWidBool *confirmCheck =
532 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), 532 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm),
533 topFrame); 533 topFrame);
534 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); 534 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1);
535 535
536 536
537 mEnableGroupScheduling = 537 mEnableGroupScheduling =
538 addWidBool(i18n("Enable group scheduling"), 538 addWidBool(i18n("Enable group scheduling"),
539 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); 539 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame);
540 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); 540 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0);
541 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), 541 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()),
542 SLOT(warningGroupScheduling())); 542 SLOT(warningGroupScheduling()));
543 543
544 mEnableProjectView = 544 mEnableProjectView =
545 addWidBool(i18n("Enable project view"), 545 addWidBool(i18n("Enable project view"),
546 &(KOPrefs::instance()->mEnableProjectView),topFrame); 546 &(KOPrefs::instance()->mEnableProjectView),topFrame);
547 topLayout->addWidget(mEnableProjectView->checkBox(),9,0); 547 topLayout->addWidget(mEnableProjectView->checkBox(),9,0);
548 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), 548 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()),
549 SLOT(warningProjectView())); 549 SLOT(warningProjectView()));
550 550
551 // Can't be disabled anymore 551 // Can't be disabled anymore
552 mEnableGroupScheduling->checkBox()->hide(); 552 mEnableGroupScheduling->checkBox()->hide();
553 553
554 // Disable setting, because this feature now becomes stable 554 // Disable setting, because this feature now becomes stable
555 mEnableProjectView->checkBox()->hide(); 555 mEnableProjectView->checkBox()->hide();
556 556
557 KPrefsWidRadios *defaultFormatGroup = 557 KPrefsWidRadios *defaultFormatGroup =
558 addWidRadios(i18n("Default Calendar Format"), 558 addWidRadios(i18n("Default Calendar Format"),
559 &(KOPrefs::instance()->mDefaultFormat),topFrame); 559 &(KOPrefs::instance()->mDefaultFormat),topFrame);
560 defaultFormatGroup->addRadio(i18n("vCalendar")); 560 defaultFormatGroup->addRadio(i18n("vCalendar"));
561 defaultFormatGroup->addRadio(i18n("iCalendar")); 561 defaultFormatGroup->addRadio(i18n("iCalendar"));
562 562
563 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); 563 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1);
564 564
565 // Default format unconditionally is iCalendar 565 // Default format unconditionally is iCalendar
566 defaultFormatGroup->groupBox()->hide(); 566 defaultFormatGroup->groupBox()->hide();
567 567
568 KPrefsWidRadios *mailClientGroup = 568 KPrefsWidRadios *mailClientGroup =
569 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), 569 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient),
570 topFrame); 570 topFrame);
571 mailClientGroup->addRadio(i18n("KMail")); 571 mailClientGroup->addRadio(i18n("KMail"));
572 mailClientGroup->addRadio(i18n("Sendmail")); 572 mailClientGroup->addRadio(i18n("Sendmail"));
573 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); 573 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1);
574 574
575 KPrefsDialogWidBool *htmlsave = 575 KPrefsDialogWidBool *htmlsave =
576 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), 576 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave),
577 topFrame); 577 topFrame);
578 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); 578 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
579 579
580 KPrefsWidRadios *destinationGroup = 580 KPrefsWidRadios *destinationGroup =
581 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), 581 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
582 topFrame); 582 topFrame);
583 destinationGroup->addRadio(i18n("be added to the standard resource")); 583 destinationGroup->addRadio(i18n("be added to the standard resource"));
584 destinationGroup->addRadio(i18n("be asked which resource to use")); 584 destinationGroup->addRadio(i18n("be asked which resource to use"));
585 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); 585 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
586 586
587 topLayout->setRowStretch(14,1); 587 topLayout->setRowStretch(14,1);
588 */ 588 */
589} 589}
590 590
591 591
592void KOPrefsDialog::setupTimeTab() 592void KOPrefsDialog::setupTimeTab()
593{ 593{
594 QFrame *topFrame = addPage(i18n("Time"),0,0); 594 QFrame *topFrame = addPage(i18n("Time"),0,0);
595 // DesktopIcon("clock",KIcon::SizeMedium)); 595 // DesktopIcon("clock",KIcon::SizeMedium));
596 596
597 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 597 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
598 topLayout->setSpacing(spacingHint()); 598 topLayout->setSpacing(spacingHint());
599 topLayout->setMargin(marginHint()); 599 topLayout->setMargin(marginHint());
600 600
601 QHBox *dummy = new QHBox(topFrame); 601 QHBox *dummy = new QHBox(topFrame);
602 KPrefsWidTime *dayBegins = 602 KPrefsWidTime *dayBegins =
603 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 603 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
604 dummy); 604 dummy);
605 //topLayout->addWidget(dayBegins->label(),2,0); 605 //topLayout->addWidget(dayBegins->label(),2,0);
606 606
607 //topLayout->addWidget(dayBegins->spinBox(),2,1); 607 //topLayout->addWidget(dayBegins->spinBox(),2,1);
608 topLayout->addMultiCellWidget(dummy,0,0,0,1); 608 topLayout->addMultiCellWidget(dummy,0,0,0,1);
609 609
610 topLayout->addWidget(new QLabel(i18n("Default appointment time:"), 610 topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
611 topFrame),1,0); 611 topFrame),1,0);
612 mStartTimeSpin = new QSpinBox(0,23,1,topFrame); 612 mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
613 mStartTimeSpin->setSuffix(":00"); 613 mStartTimeSpin->setSuffix(":00");
614 topLayout->addWidget(mStartTimeSpin,1,1); 614 topLayout->addWidget(mStartTimeSpin,1,1);
615 615
616 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 616 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
617 topFrame),2,0); 617 topFrame),2,0);
618 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 618 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
619 mDefaultDurationSpin->setSuffix(":00"); 619 mDefaultDurationSpin->setSuffix(":00");
620 topLayout->addWidget(mDefaultDurationSpin,2,1); 620 topLayout->addWidget(mDefaultDurationSpin,2,1);
621 621
622 QStringList alarmList; 622 QStringList alarmList;
623 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 623 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
624 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 624 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
625 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 625 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
626 3,0); 626 3,0);
627 mAlarmTimeCombo = new QComboBox(topFrame); 627 mAlarmTimeCombo = new QComboBox(topFrame);
628 mAlarmTimeCombo->insertStringList(alarmList); 628 mAlarmTimeCombo->insertStringList(alarmList);
629 topLayout->addWidget(mAlarmTimeCombo,3,1); 629 topLayout->addWidget(mAlarmTimeCombo,3,1);
630 630
631 631
632 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 632 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
633 i18n("Working Hours"), 633 i18n("Working Hours"),
634 topFrame); 634 topFrame);
635 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); 635 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1);
636 workingHoursGroup->layout()->setSpacing( 0 ); 636 workingHoursGroup->layout()->setSpacing( 0 );
637 workingHoursGroup->layout()->setMargin( 4 ); 637 workingHoursGroup->layout()->setMargin( 4 );
638 QHBox *workStartBox = new QHBox(workingHoursGroup); 638 QHBox *workStartBox = new QHBox(workingHoursGroup);
639 // workStartBox->setMargin( 0 ); 639 // workStartBox->setMargin( 0 );
640 addWidTime(i18n("Daily starting hour:"), 640 addWidTime(i18n("Daily starting hour:"),
641 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 641 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
642 642
643 QHBox *workEndBox = new QHBox(workingHoursGroup); 643 QHBox *workEndBox = new QHBox(workingHoursGroup);
644 //workEndBox->setMargin( 0 ); 644 //workEndBox->setMargin( 0 );
645 addWidTime(i18n("Daily ending hour:"), 645 addWidTime(i18n("Daily ending hour:"),
646 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 646 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
647 QVBox *excludeBox = new QVBox(workingHoursGroup); 647 QVBox *excludeBox = new QVBox(workingHoursGroup);
648 //excludeBox->setMargin( 0 ); 648 //excludeBox->setMargin( 0 );
649 addWidBool(i18n("Exclude holidays"), 649 addWidBool(i18n("Exclude holidays"),
650 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 650 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
651 651
652 addWidBool(i18n("Exclude Saturdays"), 652 addWidBool(i18n("Exclude Saturdays"),
653 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 653 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
654 654
655// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 655// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
656 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 656 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
657 // topFrame); 657 // topFrame);
658// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 658// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
659 659
660 // topLayout->setRowStretch(6,1); 660 // topLayout->setRowStretch(6,1);
661} 661}
662 662
663 663
664void KOPrefsDialog::setupViewsTab() 664void KOPrefsDialog::setupViewsTab()
665{ 665{
666 666
667 QFrame *topFrame = addPage(i18n("Views"),0,0); 667 QFrame *topFrame = addPage(i18n("Views"),0,0);
668 // DesktopIcon("viewmag",KIcon::SizeMedium)); 668 // DesktopIcon("viewmag",KIcon::SizeMedium));
669 669
670 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 670 QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
671 topLayout->setSpacing(spacingHint()); 671 topLayout->setSpacing(spacingHint());
672 topLayout->setMargin(marginHint()); 672 topLayout->setMargin(marginHint());
673 673
674// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 674// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
675// topLayout->addLayout(dayBeginsLayout,0,0); 675// topLayout->addLayout(dayBeginsLayout,0,0);
676 676
677// KPrefsWidTime *dayBegins = 677// KPrefsWidTime *dayBegins =
678// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 678// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
679// topFrame); 679// topFrame);
680// dayBeginsLayout->addWidget(dayBegins->label()); 680// dayBeginsLayout->addWidget(dayBegins->label());
681// dayBeginsLayout->addStretch(1); 681// dayBeginsLayout->addStretch(1);
682// dayBeginsLayout->addWidget(dayBegins->spinBox()); 682// dayBeginsLayout->addWidget(dayBegins->spinBox());
683 683
684// QBoxLayout *nextDaysLayout = new QHBoxLayout; 684// QBoxLayout *nextDaysLayout = new QHBoxLayout;
685// topLayout->addLayout(nextDaysLayout,1,0); 685// topLayout->addLayout(nextDaysLayout,1,0);
686// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 686// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
687// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); 687// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
688// nextDaysLayout->addStretch(1); 688// nextDaysLayout->addStretch(1);
689// nextDaysLayout->addWidget(mNextXDaysSpin); 689// nextDaysLayout->addWidget(mNextXDaysSpin);
690 690
691 691
692 int ii = 0; 692 int ii = 0;
693 KPrefsDialogWidBool *dummy = 693 KPrefsDialogWidBool *dummy =
694 addWidBool(i18n("Edit item on doubleclick (if not, show)"), 694 addWidBool(i18n("Edit item on doubleclick (if not, show)"),
695 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); 695 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
696 topLayout->addWidget(dummy->checkBox(),ii++,0); 696 topLayout->addWidget(dummy->checkBox(),ii++,0);
697 697
698 dummy = 698 dummy =
699 addWidBool(i18n("Highlight current day in agenda"), 699 addWidBool(i18n("Highlight current day in agenda"),
700 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 700 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
701 topLayout->addWidget(dummy->checkBox(),ii++,0); 701 topLayout->addWidget(dummy->checkBox(),ii++,0);
702 702
703 dummy = 703 dummy =
704 addWidBool(i18n("Use light color for highlight current day"), 704 addWidBool(i18n("Use light color for highlight current day"),
705 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 705 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
706 topLayout->addWidget(dummy->checkBox(),ii++,0); 706 topLayout->addWidget(dummy->checkBox(),ii++,0);
707 707
708 KPrefsDialogWidBool *dailyRecur = 708 KPrefsDialogWidBool *dailyRecur =
709 addWidBool(i18n("Show events that recur daily in date nav."), 709 addWidBool(i18n("Show events that recur daily in date nav."),
710 &(KOPrefs::instance()->mDailyRecur),topFrame); 710 &(KOPrefs::instance()->mDailyRecur),topFrame);
711 topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 711 topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
712 712
713 KPrefsDialogWidBool *weeklyRecur = 713 KPrefsDialogWidBool *weeklyRecur =
714 addWidBool(i18n("Show ev. that recur weekly in date nav."), 714 addWidBool(i18n("Show ev. that recur weekly in date nav."),
715 &(KOPrefs::instance()->mWeeklyRecur),topFrame); 715 &(KOPrefs::instance()->mWeeklyRecur),topFrame);
716 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 716 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
717 if ( QApplication::desktop()->width() > 640 ) { 717 if ( QApplication::desktop()->width() > 640 ) {
718 718
719 KPrefsDialogWidBool *enableToolTips = 719 KPrefsDialogWidBool *enableToolTips =
720 addWidBool(i18n("Enable tooltips displaying summary of ev."), 720 addWidBool(i18n("Enable tooltips displaying summary of ev."),
721 &(KOPrefs::instance()->mEnableToolTips),topFrame); 721 &(KOPrefs::instance()->mEnableToolTips),topFrame);
722 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 722 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
723 723
724 } 724 }
725 KPrefsDialogWidBool *passwdk = 725 KPrefsDialogWidBool *passwdk =
726 addWidBool(i18n("Show parent To-Do's in What's Next view"), 726 addWidBool(i18n("Show parent To-Do's in What's Next view"),
727 &(KOPrefs::instance()->mWNViewShowsParents),topFrame); 727 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
728 topLayout->addWidget(passwdk->checkBox(), ii++,0); 728 topLayout->addWidget(passwdk->checkBox(), ii++,0);
729 729
730 passwdk = 730 passwdk =
731 addWidBool(i18n("Show location in What's Next view"), 731 addWidBool(i18n("Show location in What's Next view"),
732 &(KOPrefs::instance()->mWNViewShowLocation),topFrame); 732 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
733 topLayout->addWidget(passwdk->checkBox(), ii++,0); 733 topLayout->addWidget(passwdk->checkBox(), ii++,0);
734 734
735 passwdk = 735 passwdk =
736 addWidBool(i18n("Show Sync Events in WN/Agenda view"), 736 addWidBool(i18n("Show Sync Events in WN/Agenda view"),
737 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 737 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
738 topLayout->addWidget(passwdk->checkBox(), ii++,0); 738 topLayout->addWidget(passwdk->checkBox(), ii++,0);
739 739
740 740
741 KPrefsDialogWidBool *marcusBainsEnabled = 741 KPrefsDialogWidBool *marcusBainsEnabled =
742 addWidBool(i18n("Show Marcus Bains line"), 742 addWidBool(i18n("Show Marcus Bains line"),
743 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 743 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
744 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 744 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
745 745
746 746
747 // topLayout->addWidget(hourSizeGroup,ii++,0); 747 // topLayout->addWidget(hourSizeGroup,ii++,0);
748 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 748 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
749 //topLayout->setRowStretch(11,1); 749 //topLayout->setRowStretch(11,1);
750 750
751 751
752 752
753 753
754 754
755 755
756 topFrame = addPage(i18n("ViewChange"),0,0); 756 topFrame = addPage(i18n("ViewChange"),0,0);
757 // DesktopIcon("viewmag",KIcon::SizeMedium)); 757 // DesktopIcon("viewmag",KIcon::SizeMedium));
758 758
759 topLayout = new QGridLayout(topFrame,6,1); 759 topLayout = new QGridLayout(topFrame,6,1);
760 topLayout->setSpacing(spacingHint()); 760 topLayout->setSpacing(spacingHint());
761 topLayout->setMargin(marginHint()); 761 topLayout->setMargin(marginHint());
762 ii = 0; 762 ii = 0;
763 763
764 764
765 dummy = 765 dummy =
766 addWidBool(i18n("Hold fullscreen on view change"), 766 addWidBool(i18n("Hold fullscreen on view change"),
767 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 767 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
768 topLayout->addWidget(dummy->checkBox(),ii++,0); 768 topLayout->addWidget(dummy->checkBox(),ii++,0);
769 769
770 dummy = 770 dummy =
771 addWidBool(i18n("Hold non-fullscreen on view change"), 771 addWidBool(i18n("Hold non-fullscreen on view change"),
772 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 772 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
773 topLayout->addWidget(dummy->checkBox(),ii++,0); 773 topLayout->addWidget(dummy->checkBox(),ii++,0);
774 774
775 775
776 KPrefsDialogWidBool *fullViewTodo = 776 KPrefsDialogWidBool *fullViewTodo =
777 addWidBool(i18n("Event list view uses full window"), 777 addWidBool(i18n("Event list view uses full window"),
778 &(KOPrefs::instance()->mFullViewTodo),topFrame); 778 &(KOPrefs::instance()->mFullViewTodo),topFrame);
779 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); 779 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
780 780
781 KPrefsDialogWidBool *fullViewMonth = 781 KPrefsDialogWidBool *fullViewMonth =
782 addWidBool(i18n("Next days view uses full window"), 782 addWidBool(i18n("Next days view uses full window"),
783 &(KOPrefs::instance()->mFullViewMonth),topFrame); 783 &(KOPrefs::instance()->mFullViewMonth),topFrame);
784 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); 784 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
785 785
786 dummy = 786 dummy =
787 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 787 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
788 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 788 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
789 topLayout->addWidget(dummy->checkBox(),ii++,0); 789 topLayout->addWidget(dummy->checkBox(),ii++,0);
790 790
791 dummy = 791 dummy =
792 addWidBool(i18n("Set agenda to current time on change"), 792 addWidBool(i18n("Set agenda to current time on change"),
793 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 793 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
794 topLayout->addWidget(dummy->checkBox(),ii++,0); 794 topLayout->addWidget(dummy->checkBox(),ii++,0);
795 795
796 dummy = 796 dummy =
797 addWidBool(i18n("Listview uses monthly timespan"), 797 addWidBool(i18n("Listview uses monthly timespan"),
798 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); 798 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
799 topLayout->addWidget(dummy->checkBox(),ii++,0); 799 topLayout->addWidget(dummy->checkBox(),ii++,0);
800 dummy = 800 dummy =
801 addWidBool(i18n("Highlight selection in Time Edit"), 801 addWidBool(i18n("Highlight selection in Time Edit"),
802 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); 802 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
803 topLayout->addWidget( dummy->checkBox(), ii++,0); 803 topLayout->addWidget( dummy->checkBox(), ii++,0);
804 804
805 805
806 806
807 807
808 808
809 topFrame = addPage(i18n("Month View"),0,0); 809 topFrame = addPage(i18n("Month View"),0,0);
810 // DesktopIcon("viewmag",KIcon::SizeMedium)); 810 // DesktopIcon("viewmag",KIcon::SizeMedium));
811 811
812 topLayout = new QGridLayout(topFrame,5,1); 812 topLayout = new QGridLayout(topFrame,5,1);
813 topLayout->setSpacing(spacingHint()); 813 topLayout->setSpacing(spacingHint());
814 topLayout->setMargin(marginHint()); 814 topLayout->setMargin(marginHint());
815 ii = 0; 815 ii = 0;
816 QLabel *lab; 816 QLabel *lab;
817 QHBox *habo = new QHBox( topFrame ); 817 QHBox *habo = new QHBox( topFrame );
818 if ( QApplication::desktop()->width() < 320 ) { 818 if ( QApplication::desktop()->width() < 320 ) {
819 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 819 lab = new QLabel ( i18n("Show events that recur "), topFrame );
820 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 820 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
821 ii++; 821 ii++;
822 822
823 } else { 823 } else {
824 new QLabel ( i18n("Show events that recur "), habo ); 824 new QLabel ( i18n("Show events that recur "), habo );
825 825
826 } 826 }
827 dailyRecur = 827 dailyRecur =
828 addWidBool(i18n("daily"), 828 addWidBool(i18n("daily"),
829 &(KOPrefs::instance()->mMonthDailyRecur),habo); 829 &(KOPrefs::instance()->mMonthDailyRecur),habo);
830 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 830 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
831 831
832 weeklyRecur = 832 weeklyRecur =
833 addWidBool(i18n("weekly"), 833 addWidBool(i18n("weekly"),
834 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 834 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
835 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 835 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
836 ii++; 836 ii++;
837 837
838 838
839 habo = new QHBox( topFrame ); 839 habo = new QHBox( topFrame );
840 if ( QApplication::desktop()->width() < 320 ) { 840 if ( QApplication::desktop()->width() < 320 ) {
841 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 841 lab = new QLabel (i18n("Show in every cell ") , topFrame );
842 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 842 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
843 ii++; 843 ii++;
844 844
845 } else { 845 } else {
846 new QLabel ( i18n("Show in every cell "), habo ); 846 new QLabel ( i18n("Show in every cell "), habo );
847 } 847 }
848 weeklyRecur = 848 weeklyRecur =
849 addWidBool(i18n("short month"), 849 addWidBool(i18n("short month"),
850 &(KOPrefs::instance()->mMonthShowShort),habo); 850 &(KOPrefs::instance()->mMonthShowShort),habo);
851 weeklyRecur = 851 weeklyRecur =
852 addWidBool(i18n("icons"), 852 addWidBool(i18n("icons"),
853 &(KOPrefs::instance()->mMonthShowIcons),habo); 853 &(KOPrefs::instance()->mMonthShowIcons),habo);
854 854
855 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 855 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
856 ii++; 856 ii++;
857#ifdef DESKTOP_VERSION 857#ifdef DESKTOP_VERSION
858 KPrefsDialogWidBool *enableMonthScroll = 858 KPrefsDialogWidBool *enableMonthScroll =
859 addWidBool(i18n("Enable scrollbars in month view cells"), 859 addWidBool(i18n("Enable scrollbars in month view cells"),
860 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 860 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
861 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 861 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
862#endif 862#endif
863 863
864 dummy = 864 dummy =
865 addWidBool(i18n("Show Sat/Sun together"), 865 addWidBool(i18n("Show Sat/Sun together"),
866 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 866 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
867 topLayout->addWidget(dummy->checkBox(),ii++,0); 867 topLayout->addWidget(dummy->checkBox(),ii++,0);
868 868
869 KPrefsDialogWidBool *coloredCategoriesInMonthView = 869 KPrefsDialogWidBool *coloredCategoriesInMonthView =
870 addWidBool(i18n("Month view uses category colors"), 870 addWidBool(i18n("Month view uses category colors"),
871 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 871 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
872 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 872 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
873 873
874 dummy = 874 dummy =
875 addWidBool(i18n("Categorie colors are applied to text"), 875 addWidBool(i18n("Categorie colors are applied to text"),
876 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 876 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
877 topLayout->addWidget(dummy->checkBox(),ii++,0); 877 topLayout->addWidget(dummy->checkBox(),ii++,0);
878 coloredCategoriesInMonthView = 878 coloredCategoriesInMonthView =
879 addWidBool(i18n("Month view uses day colors"), 879 addWidBool(i18n("Month view uses day colors"),
880 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 880 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
881 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 881 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
882 882
883 KPrefsWidColor *holidayColor = 883 KPrefsWidColor *holidayColor =
884 addWidColor(i18n("Day color odd months"), 884 addWidColor(i18n("Day color odd months"),
885 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 885 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
886 topLayout->addWidget(holidayColor->label(),ii,0); 886 topLayout->addWidget(holidayColor->label(),ii,0);
887 topLayout->addWidget(holidayColor->button(),ii++,1); 887 topLayout->addWidget(holidayColor->button(),ii++,1);
888 888
889 holidayColor = 889 holidayColor =
890 addWidColor(i18n("Day color even months"), 890 addWidColor(i18n("Day color even months"),
891 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 891 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
892 topLayout->addWidget(holidayColor->label(),ii,0); 892 topLayout->addWidget(holidayColor->label(),ii,0);
893 topLayout->addWidget(holidayColor->button(),ii++,1); 893 topLayout->addWidget(holidayColor->button(),ii++,1);
894 894
895 895
896 holidayColor = 896 holidayColor =
897 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 897 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
898 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 898 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
899 topLayout->addWidget(holidayColor->label(),ii,0); 899 topLayout->addWidget(holidayColor->label(),ii,0);
900 topLayout->addWidget(holidayColor->button(),ii++,1); 900 topLayout->addWidget(holidayColor->button(),ii++,1);
901 901
902 // *********************** Todo View 902 // *********************** Todo View
903 903
904 topFrame = addPage(i18n("Todo View"),0,0); 904 topFrame = addPage(i18n("Todo View"),0,0);
905 // DesktopIcon("viewmag",KIcon::SizeMedium)); 905 // DesktopIcon("viewmag",KIcon::SizeMedium));
906 906
907 topLayout = new QGridLayout(topFrame,4,1); 907 topLayout = new QGridLayout(topFrame,4,1);
908 topLayout->setSpacing(spacingHint()); 908 topLayout->setSpacing(spacingHint());
909 topLayout->setMargin(marginHint()); 909 topLayout->setMargin(marginHint());
910 ii = 0; 910 ii = 0;
911 911
912 KPrefsDialogWidBool *showCompletedTodo = 912 KPrefsDialogWidBool *showCompletedTodo =
913 addWidBool(i18n("To-do view shows completed Todos"), 913 addWidBool(i18n("To-do view shows completed Todos"),
914 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 914 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
915 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 915 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
916 dummy = 916 dummy =
917 addWidBool(i18n("To-do view shows complete as 'xx %'"), 917 addWidBool(i18n("To-do view shows complete as 'xx %'"),
918 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 918 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
919 topLayout->addWidget(dummy->checkBox(),ii++,0); 919 topLayout->addWidget(dummy->checkBox(),ii++,0);
920 920
921 dummy = 921 dummy =
922 addWidBool(i18n("Small To-do view uses smaller font"), 922 addWidBool(i18n("Small To-do view uses smaller font"),
923 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 923 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
924 topLayout->addWidget(dummy->checkBox(),ii++,0); 924 topLayout->addWidget(dummy->checkBox(),ii++,0);
925 925
926 926
927 927
928 dummy = 928 dummy =
929 addWidBool(i18n("Todo view uses category colors"), 929 addWidBool(i18n("Todo view uses category colors"),
930 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 930 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
931 topLayout->addWidget(dummy->checkBox(),ii++,0); 931 topLayout->addWidget(dummy->checkBox(),ii++,0);
932 932
933 933
934 QWidget* wid = new QWidget( topFrame ); 934 QWidget* wid = new QWidget( topFrame );
935 // Todo due today color 935 // Todo due today color
936 KPrefsWidColor *todoDueTodayColor = 936 KPrefsWidColor *todoDueTodayColor =
937 addWidColor(i18n("Todo due today color:"), 937 addWidColor(i18n("Todo due today color:"),
938 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 938 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
939 QHBoxLayout *widLayout = new QHBoxLayout(wid); 939 QHBoxLayout *widLayout = new QHBoxLayout(wid);
940 widLayout->addWidget( todoDueTodayColor->label() ); 940 widLayout->addWidget( todoDueTodayColor->label() );
941 widLayout->addWidget( todoDueTodayColor->button() ); 941 widLayout->addWidget( todoDueTodayColor->button() );
942 topLayout->addWidget(wid,ii++,0); 942 topLayout->addWidget(wid,ii++,0);
943 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 943 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
944 944
945 // Todo overdue color 945 // Todo overdue color
946 wid = new QWidget( topFrame ); 946 wid = new QWidget( topFrame );
947 widLayout = new QHBoxLayout(wid); 947 widLayout = new QHBoxLayout(wid);
948 KPrefsWidColor *todoOverdueColor = 948 KPrefsWidColor *todoOverdueColor =
949 addWidColor(i18n("Todo overdue color:"), 949 addWidColor(i18n("Todo overdue color:"),
950 &(KOPrefs::instance()->mTodoOverdueColor),wid); 950 &(KOPrefs::instance()->mTodoOverdueColor),wid);
951 widLayout->addWidget(todoOverdueColor->label()); 951 widLayout->addWidget(todoOverdueColor->label());
952 widLayout->addWidget(todoOverdueColor->button()); 952 widLayout->addWidget(todoOverdueColor->button());
953 topLayout->addWidget(wid,ii++,0); 953 topLayout->addWidget(wid,ii++,0);
954 954
955 dummy = 955 dummy =
956 addWidBool(i18n("Colors are applied to text"), 956 addWidBool(i18n("Colors are applied to text"),
957 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 957 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
958 topLayout->addWidget(dummy->checkBox(),ii++,0); 958 topLayout->addWidget(dummy->checkBox(),ii++,0);
959 959
960 dummy = 960 dummy =
961 addWidBool(i18n("Allday Agenda view shows todos"), 961 addWidBool(i18n("Allday Agenda view shows todos"),
962 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); 962 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
963 topLayout->addWidget(dummy->checkBox(),ii++,0); 963 topLayout->addWidget(dummy->checkBox(),ii++,0);
964 964
965 965
966 966
967 967
968 topFrame = addPage(i18n("Alarm"),0,0); 968 topFrame = addPage(i18n("Alarm"),0,0);
969 // DesktopIcon("viewmag",KIcon::SizeMedium)); 969 // DesktopIcon("viewmag",KIcon::SizeMedium));
970 970
971 topLayout = new QGridLayout(topFrame,2,1); 971 topLayout = new QGridLayout(topFrame,2,1);
972 topLayout->setSpacing(spacingHint()); 972 topLayout->setSpacing(spacingHint());
973 topLayout->setMargin(marginHint()); 973 topLayout->setMargin(marginHint());
974 int iii = 0; 974 int iii = 0;
975 975
976 dummy = 976 dummy =
977 addWidBool(i18n("Use internal alarm notification"), 977 addWidBool(i18n("Use internal alarm notification"),
978 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 978 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
979 topLayout->addWidget(dummy->checkBox(),iii++,0); 979 topLayout->addWidget(dummy->checkBox(),iii++,0);
980 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); 980 lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame);
981 981
982 topLayout->addWidget(lab ,iii++,0); 982 topLayout->addWidget(lab ,iii++,0);
983#ifndef DESKTOP_VERSION 983#ifndef DESKTOP_VERSION
984 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 984 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
985#else 985#else
986 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 986 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
987 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 987 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
988#endif 988#endif
989 989
990 QHBox* dummyBox = new QHBox(topFrame); 990 QHBox* dummyBox = new QHBox(topFrame);
991 new QLabel(i18n("Play beeps count:"),dummyBox); 991 new QLabel(i18n("Play beeps count:"),dummyBox);
992 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 992 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
993 topLayout->addWidget(dummyBox,iii++,0); 993 topLayout->addWidget(dummyBox,iii++,0);
994 994
995 dummyBox = new QHBox(topFrame); 995 dummyBox = new QHBox(topFrame);
996 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 996 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
997 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 997 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
998 topLayout->addWidget(dummyBox,iii++,0); 998 topLayout->addWidget(dummyBox,iii++,0);
999 999
1000 dummyBox = new QHBox(topFrame); 1000 dummyBox = new QHBox(topFrame);
1001 new QLabel(i18n("Default suspend time in min:"),dummyBox); 1001 new QLabel(i18n("Default suspend time in min:"),dummyBox);
1002 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 1002 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
1003 topLayout->addWidget(dummyBox,iii++,0); 1003 topLayout->addWidget(dummyBox,iii++,0);
1004 1004
1005 dummyBox = new QHBox(topFrame); 1005 dummyBox = new QHBox(topFrame);
1006 new QLabel(i18n("Auto suspend count:"),dummyBox); 1006 new QLabel(i18n("Auto suspend count:"),dummyBox);
1007 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 1007 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
1008 topLayout->addWidget(dummyBox,iii++,0); 1008 topLayout->addWidget(dummyBox,iii++,0);
1009 1009
1010 1010
1011 1011
1012 1012
1013 1013
1014 1014
1015 1015
1016 QHBox* hbo = new QHBox ( topFrame ); 1016 QHBox* hbo = new QHBox ( topFrame );
1017 mDefaultAlarmFile = new QLineEdit(hbo); 1017 mDefaultAlarmFile = new QLineEdit(hbo);
1018 QPushButton * loadTemplate = new QPushButton(hbo); 1018 QPushButton * loadTemplate = new QPushButton(hbo);
1019 QPixmap icon; 1019 QPixmap icon;
1020 if ( QApplication::desktop()->width() < 321 ) 1020 if ( QApplication::desktop()->width() < 321 )
1021 icon = SmallIcon("fileimport16"); 1021 icon = SmallIcon("fileimport16");
1022 else 1022 else
1023 icon = SmallIcon("fileimport"); 1023 icon = SmallIcon("fileimport");
1024 loadTemplate->setIconSet (icon ) ; 1024 loadTemplate->setIconSet (icon ) ;
1025 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 1025 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
1026 int size = loadTemplate->sizeHint().height(); 1026 int size = loadTemplate->sizeHint().height();
1027 loadTemplate->setFixedSize( size, size ); 1027 loadTemplate->setFixedSize( size, size );
1028 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 1028 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
1029 // topLayout->addWidget(lab ,iii++,0); 1029 // topLayout->addWidget(lab ,iii++,0);
1030 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 1030 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
1031 topLayout->addWidget(lab ,iii++,0); 1031 topLayout->addWidget(lab ,iii++,0);
1032 topLayout->addWidget(hbo,iii++,0); 1032 topLayout->addWidget(hbo,iii++,0);
1033 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); 1033 // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame);
1034 1034
1035// topLayout->addWidget(lab ,iii++,0); 1035// topLayout->addWidget(lab ,iii++,0);
1036// #ifndef DESKTOP_VERSION 1036// #ifndef DESKTOP_VERSION
1037// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 1037// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
1038// #else 1038// #else
1039// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 1039// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
1040// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 1040// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
1041// #endif 1041// #endif
1042 1042
1043 1043
1044} 1044}
1045 1045
1046void KOPrefsDialog::selectSoundFile() 1046void KOPrefsDialog::selectSoundFile()
1047{ 1047{
1048 QString fileName = mDefaultAlarmFile->text(); 1048 QString fileName = mDefaultAlarmFile->text();
1049 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 1049 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
1050 if ( fileName.length() > 0 ) 1050 if ( fileName.length() > 0 )
1051 mDefaultAlarmFile->setText( fileName ); 1051 mDefaultAlarmFile->setText( fileName );
1052} 1052}
1053void KOPrefsDialog::setupFontsTab() 1053void KOPrefsDialog::setupFontsTab()
1054{ 1054{
1055 1055
1056 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 1056 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
1057 // DesktopIcon("fonts",KIcon::SizeMedium)); 1057 // DesktopIcon("fonts",KIcon::SizeMedium));
1058 1058
1059 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 1059 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
1060 topLayout->setSpacing(1); 1060 topLayout->setSpacing(1);
1061 topLayout->setMargin(3); 1061 topLayout->setMargin(3);
1062 KPrefsDialogWidFont * tVFont; 1062 KPrefsDialogWidFont * tVFont;
1063 int i = 0; 1063 int i = 0;
1064 KPrefsDialogWidFont *timeLabelsFont = 1064 KPrefsDialogWidFont *timeLabelsFont =
1065 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1065 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
1066 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1066 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
1067 topLayout->addWidget(timeLabelsFont->label(),i,0); 1067 topLayout->addWidget(timeLabelsFont->label(),i,0);
1068 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1068 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1069 topLayout->addWidget(timeLabelsFont->button(),i,2); 1069 topLayout->addWidget(timeLabelsFont->button(),i,2);
1070 ++i; 1070 ++i;
1071 1071
1072 1072
1073 timeLabelsFont = 1073 timeLabelsFont =
1074 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1074 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1075 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1075 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
1076 topLayout->addWidget(timeLabelsFont->label(),i,0); 1076 topLayout->addWidget(timeLabelsFont->label(),i,0);
1077 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1077 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1078 topLayout->addWidget(timeLabelsFont->button(),i,2); 1078 topLayout->addWidget(timeLabelsFont->button(),i,2);
1079 ++i; 1079 ++i;
1080 1080
1081 KPrefsDialogWidFont *timeBarFont = 1081 KPrefsDialogWidFont *timeBarFont =
1082 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 1082 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
1083 &(KOPrefs::instance()->mTimeBarFont),topFrame); 1083 &(KOPrefs::instance()->mTimeBarFont),topFrame);
1084 topLayout->addWidget(timeBarFont->label(),i,0); 1084 topLayout->addWidget(timeBarFont->label(),i,0);
1085 topLayout->addWidget(timeBarFont->preview(),i,1); 1085 topLayout->addWidget(timeBarFont->preview(),i,1);
1086 topLayout->addWidget(timeBarFont->button(),i,2); 1086 topLayout->addWidget(timeBarFont->button(),i,2);
1087 ++i; 1087 ++i;
1088 1088
1089 1089
1090 KPrefsDialogWidFont *marcusBainsFont = 1090 KPrefsDialogWidFont *marcusBainsFont =
1091 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1091 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
1092 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1092 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
1093 topLayout->addWidget(marcusBainsFont->label(),i,0); 1093 topLayout->addWidget(marcusBainsFont->label(),i,0);
1094 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1094 topLayout->addWidget(marcusBainsFont->preview(),i,1);
1095 topLayout->addWidget(marcusBainsFont->button(),i,2); 1095 topLayout->addWidget(marcusBainsFont->button(),i,2);
1096 ++i; 1096 ++i;
1097 1097
1098 tVFont = 1098 tVFont =
1099 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1099 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1100 &(KOPrefs::instance()->mEventViewFont),topFrame); 1100 &(KOPrefs::instance()->mEventViewFont),topFrame);
1101 topLayout->addWidget(tVFont->label(),i,0); 1101 topLayout->addWidget(tVFont->label(),i,0);
1102 topLayout->addWidget(tVFont->preview(),i,1); 1102 topLayout->addWidget(tVFont->preview(),i,1);
1103 topLayout->addWidget(tVFont->button(),i,2); 1103 topLayout->addWidget(tVFont->button(),i,2);
1104 ++i; 1104 ++i;
1105 1105
1106 1106
1107 1107
1108 tVFont = 1108 tVFont =
1109 addWidFont(i18n("Details"),i18n("EditorBox:"), 1109 addWidFont(i18n("Details"),i18n("EditorBox:"),
1110 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1110 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1111 topLayout->addWidget(tVFont->label(),i,0); 1111 topLayout->addWidget(tVFont->label(),i,0);
1112 topLayout->addWidget(tVFont->preview(),i,1); 1112 topLayout->addWidget(tVFont->preview(),i,1);
1113 topLayout->addWidget(tVFont->button(),i,2); 1113 topLayout->addWidget(tVFont->button(),i,2);
1114 ++i; 1114 ++i;
1115 1115
1116 1116
1117 1117
1118 topLayout->setColStretch(1,1); 1118 topLayout->setColStretch(1,1);
1119 topLayout->setRowStretch(4,1); 1119 topLayout->setRowStretch(4,1);
1120 1120
1121 1121
1122 i = 0; 1122 i = 0;
1123 topFrame = addPage(i18n("View Fonts"),0, 1123 topFrame = addPage(i18n("View Fonts"),0,
1124 DesktopIcon("fonts",KIcon::SizeMedium)); 1124 DesktopIcon("fonts",KIcon::SizeMedium));
1125 1125
1126 topLayout = new QGridLayout(topFrame,7,3); 1126 topLayout = new QGridLayout(topFrame,7,3);
1127 topLayout->setSpacing(1); 1127 topLayout->setSpacing(1);
1128 topLayout->setMargin(3); 1128 topLayout->setMargin(3);
1129 1129
1130 tVFont = 1130 tVFont =
1131 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1131 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1132 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1132 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1133 topLayout->addWidget(tVFont->label(),i,0); 1133 topLayout->addWidget(tVFont->label(),i,0);
1134 topLayout->addWidget(tVFont->preview(),i,1); 1134 topLayout->addWidget(tVFont->preview(),i,1);
1135 topLayout->addWidget(tVFont->button(),i,2); 1135 topLayout->addWidget(tVFont->button(),i,2);
1136 ++i; 1136 ++i;
1137 KPrefsDialogWidFont *agendaViewFont = 1137 KPrefsDialogWidFont *agendaViewFont =
1138 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1138 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1139 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1139 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1140 topLayout->addWidget(agendaViewFont->label(),i,0); 1140 topLayout->addWidget(agendaViewFont->label(),i,0);
1141 topLayout->addWidget(agendaViewFont->preview(),i,1); 1141 topLayout->addWidget(agendaViewFont->preview(),i,1);
1142 topLayout->addWidget(agendaViewFont->button(),i,2); 1142 topLayout->addWidget(agendaViewFont->button(),i,2);
1143 ++i; 1143 ++i;
1144 1144
1145 1145
1146 KPrefsDialogWidFont *monthViewFont = 1146 KPrefsDialogWidFont *monthViewFont =
1147 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1147 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1148 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1148 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1149 topLayout->addWidget(monthViewFont->label(),i,0); 1149 topLayout->addWidget(monthViewFont->label(),i,0);
1150 topLayout->addWidget(monthViewFont->preview(),i,1); 1150 topLayout->addWidget(monthViewFont->preview(),i,1);
1151 topLayout->addWidget(monthViewFont->button(),i,2); 1151 topLayout->addWidget(monthViewFont->button(),i,2);
1152 ++i; 1152 ++i;
1153 1153
1154 1154
1155 KPrefsDialogWidFont *lVFont = 1155 KPrefsDialogWidFont *lVFont =
1156 addWidFont(i18n("Event"),i18n("List View:"), 1156 addWidFont(i18n("Event"),i18n("List View:"),
1157 &(KOPrefs::instance()->mListViewFont),topFrame); 1157 &(KOPrefs::instance()->mListViewFont),topFrame);
1158 topLayout->addWidget(lVFont->label(),i,0); 1158 topLayout->addWidget(lVFont->label(),i,0);
1159 topLayout->addWidget(lVFont->preview(),i,1); 1159 topLayout->addWidget(lVFont->preview(),i,1);
1160 topLayout->addWidget(lVFont->button(),i,2); 1160 topLayout->addWidget(lVFont->button(),i,2);
1161 ++i; 1161 ++i;
1162 1162
1163 1163
1164 tVFont = 1164 tVFont =
1165 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1165 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1166 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1166 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1167 topLayout->addWidget(tVFont->label(),i,0); 1167 topLayout->addWidget(tVFont->label(),i,0);
1168 topLayout->addWidget(tVFont->preview(),i,1); 1168 topLayout->addWidget(tVFont->preview(),i,1);
1169 topLayout->addWidget(tVFont->button(),i,2); 1169 topLayout->addWidget(tVFont->button(),i,2);
1170 ++i; 1170 ++i;
1171 1171
1172 1172
1173 tVFont = 1173 tVFont =
1174 addWidFont(i18n("Today"),i18n("JournalView:"), 1174 addWidFont(i18n("Today"),i18n("JournalView:"),
1175 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1175 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1176 topLayout->addWidget(tVFont->label(),i,0); 1176 topLayout->addWidget(tVFont->label(),i,0);
1177 topLayout->addWidget(tVFont->preview(),i,1); 1177 topLayout->addWidget(tVFont->preview(),i,1);
1178 topLayout->addWidget(tVFont->button(),i,2); 1178 topLayout->addWidget(tVFont->button(),i,2);
1179 ++i; 1179 ++i;
1180 1180
1181 1181
1182 1182
1183 1183
1184 topLayout->setColStretch(1,1); 1184 topLayout->setColStretch(1,1);
1185 topLayout->setRowStretch(4,1); 1185 topLayout->setRowStretch(4,1);
1186 1186
1187 1187
1188 1188
1189 1189
1190} 1190}
1191 1191
1192void KOPrefsDialog::setupColorsTab() 1192void KOPrefsDialog::setupColorsTab()
1193{ 1193{
1194 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1194 QFrame *topFrame = addPage(i18n("Colors"),0,0);
1195 // DesktopIcon("colorize",KIcon::SizeMedium)); 1195 // DesktopIcon("colorize",KIcon::SizeMedium));
1196 1196
1197 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1197 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1198 // topLayout->setSpacing(spacingHint()); 1198 // topLayout->setSpacing(spacingHint());
1199 // topLayout->setMargin(marginHint()); 1199 // topLayout->setMargin(marginHint());
1200 1200
1201 topLayout->setSpacing(2); 1201 topLayout->setSpacing(2);
1202 topLayout->setMargin(3); 1202 topLayout->setMargin(3);
1203 1203
1204 int ii = 1; 1204 int ii = 1;
1205 QGroupBox *categoryGroup ; 1205 QGroupBox *categoryGroup ;
1206 1206
1207 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1207 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
1208 topFrame); 1208 topFrame);
1209 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1209 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1210 1210
1211 mCategoryCombo = new QComboBox(categoryGroup); 1211 mCategoryCombo = new QComboBox(categoryGroup);
1212 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1212 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1213 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1213 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1214 1214
1215 mCategoryButton = new KColorButton(categoryGroup); 1215 mCategoryButton = new KColorButton(categoryGroup);
1216 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1216 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1217 updateCategoryColor(); 1217 updateCategoryColor();
1218 1218
1219 1219
1220 // Holiday Color 1220 // Holiday Color
1221 1221
1222 KPrefsWidColor *holidayColor = 1222 KPrefsWidColor *holidayColor =
1223 addWidColor(i18n("Holiday color:"), 1223 addWidColor(i18n("Holiday color:"),
1224 &(KOPrefs::instance()->mHolidayColor),topFrame); 1224 &(KOPrefs::instance()->mHolidayColor),topFrame);
1225 topLayout->addWidget(holidayColor->label(),ii,0); 1225 topLayout->addWidget(holidayColor->label(),ii,0);
1226 topLayout->addWidget(holidayColor->button(),ii++,1); 1226 topLayout->addWidget(holidayColor->button(),ii++,1);
1227 1227
1228 // Highlight Color 1228 // Highlight Color
1229 KPrefsWidColor *highlightColor = 1229 KPrefsWidColor *highlightColor =
1230 addWidColor(i18n("Highlight color:"), 1230 addWidColor(i18n("Highlight color:"),
1231 &(KOPrefs::instance()->mHighlightColor),topFrame); 1231 &(KOPrefs::instance()->mHighlightColor),topFrame);
1232 topLayout->addWidget(highlightColor->label(),ii,0); 1232 topLayout->addWidget(highlightColor->label(),ii,0);
1233 topLayout->addWidget(highlightColor->button(),ii++,1); 1233 topLayout->addWidget(highlightColor->button(),ii++,1);
1234 1234
1235 // Event color 1235 // Event color
1236 KPrefsWidColor *eventColor = 1236 KPrefsWidColor *eventColor =
1237 addWidColor(i18n("Default event color:"), 1237 addWidColor(i18n("Default event color:"),
1238 &(KOPrefs::instance()->mEventColor),topFrame); 1238 &(KOPrefs::instance()->mEventColor),topFrame);
1239 topLayout->addWidget(eventColor->label(),ii,0); 1239 topLayout->addWidget(eventColor->label(),ii,0);
1240 topLayout->addWidget(eventColor->button(),ii++,1); 1240 topLayout->addWidget(eventColor->button(),ii++,1);
1241 1241
1242 // agenda view background color 1242 // agenda view background color
1243 KPrefsWidColor *agendaBgColor = 1243 KPrefsWidColor *agendaBgColor =
1244 addWidColor(i18n("Agenda view background color:"), 1244 addWidColor(i18n("Agenda view background color:"),
1245 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1245 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1246 topLayout->addWidget(agendaBgColor->label(),ii,0); 1246 topLayout->addWidget(agendaBgColor->label(),ii,0);
1247 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1247 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1248 1248
1249 // working hours color 1249 // working hours color
1250 KPrefsWidColor *workingHoursColor = 1250 KPrefsWidColor *workingHoursColor =
1251 addWidColor(i18n("Working hours color:"), 1251 addWidColor(i18n("Working hours color:"),
1252 &(KOPrefs::instance()->mWorkingHoursColor),topFrame); 1252 &(KOPrefs::instance()->mWorkingHoursColor),topFrame);
1253 topLayout->addWidget(workingHoursColor->label(),ii,0); 1253 topLayout->addWidget(workingHoursColor->label(),ii,0);
1254 topLayout->addWidget(workingHoursColor->button(),ii++,1); 1254 topLayout->addWidget(workingHoursColor->button(),ii++,1);
1255 1255
1256 KPrefsDialogWidBool *sb = 1256 KPrefsDialogWidBool *sb =
1257 addWidBool(i18n("Use colors for application:"), 1257 addWidBool(i18n("Use colors for application:"),
1258 &(KOPrefs::instance()->mUseAppColors),topFrame); 1258 &(KOPrefs::instance()->mUseAppColors),topFrame);
1259 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); 1259 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
1260 1260
1261 ii++; 1261 ii++;
1262 KPrefsWidColor * workingHoursColor1 = 1262 KPrefsWidColor * workingHoursColor1 =
1263 addWidColor(i18n("Buttons, menus, etc.:"), 1263 addWidColor(i18n("Buttons, menus, etc.:"),
1264 &(KOPrefs::instance()->mAppColor1),topFrame); 1264 &(KOPrefs::instance()->mAppColor1),topFrame);
1265 topLayout->addWidget(workingHoursColor1->label(),ii,0); 1265 topLayout->addWidget(workingHoursColor1->label(),ii,0);
1266 topLayout->addWidget(workingHoursColor1->button(),ii++,1); 1266 topLayout->addWidget(workingHoursColor1->button(),ii++,1);
1267 1267
1268 KPrefsWidColor * workingHoursColor2 = 1268 KPrefsWidColor * workingHoursColor2 =
1269 addWidColor(i18n("Frames, labels, etc.:"), 1269 addWidColor(i18n("Frames, labels, etc.:"),
1270 &(KOPrefs::instance()->mAppColor2),topFrame); 1270 &(KOPrefs::instance()->mAppColor2),topFrame);
1271 topLayout->addWidget(workingHoursColor2->label(),ii,0); 1271 topLayout->addWidget(workingHoursColor2->label(),ii,0);
1272 topLayout->addWidget(workingHoursColor2->button(),ii++,1); 1272 topLayout->addWidget(workingHoursColor2->button(),ii++,1);
1273 1273
1274 1274
1275 1275
1276} 1276}
1277 1277
1278void KOPrefsDialog::setCategoryColor() 1278void KOPrefsDialog::setCategoryColor()
1279{ 1279{
1280 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); 1280 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
1281} 1281}
1282 1282
1283void KOPrefsDialog::updateCategoryColor() 1283void KOPrefsDialog::updateCategoryColor()
1284{ 1284{
1285 QString cat = mCategoryCombo->currentText(); 1285 QString cat = mCategoryCombo->currentText();
1286 QColor *color = mCategoryDict.find(cat); 1286 QColor *color = mCategoryDict.find(cat);
1287 if (!color) { 1287 if (!color) {
1288 color = KOPrefs::instance()->categoryColor(cat); 1288 color = KOPrefs::instance()->categoryColor(cat);
1289 } 1289 }
1290 if (color) { 1290 if (color) {
1291 mCategoryButton->setColor(*color); 1291 mCategoryButton->setColor(*color);
1292 } 1292 }
1293} 1293}
1294 1294
1295void KOPrefsDialog::setupPrinterTab() 1295void KOPrefsDialog::setupPrinterTab()
1296{ 1296{
1297 mPrinterTab = addPage(i18n("Printing"),0, 1297 mPrinterTab = addPage(i18n("Printing"),0,
1298 DesktopIcon("fileprint",KIcon::SizeMedium)); 1298 DesktopIcon("fileprint",KIcon::SizeMedium));
1299 1299
1300 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); 1300 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
1301 topLayout->setSpacing(spacingHint()); 1301 topLayout->setSpacing(spacingHint());
1302 topLayout->setMargin(marginHint()); 1302 topLayout->setMargin(marginHint());
1303 1303
1304 topLayout->setRowStretch(4,1); 1304 topLayout->setRowStretch(4,1);
1305} 1305}
1306 1306
1307void KOPrefsDialog::setupGroupSchedulingTab() 1307void KOPrefsDialog::setupGroupSchedulingTab()
1308{ 1308{
1309#if 0 1309#if 0
1310 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, 1310 QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
1311 DesktopIcon("personal",KIcon::SizeMedium)); 1311 DesktopIcon("personal",KIcon::SizeMedium));
1312 1312
1313 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 1313 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
1314 topLayout->setSpacing(spacingHint()); 1314 topLayout->setSpacing(spacingHint());
1315 topLayout->setMargin(marginHint()); 1315 topLayout->setMargin(marginHint());
1316 1316
1317#if 0 1317#if 0
1318 KPrefsWidRadios *schedulerGroup = 1318 KPrefsWidRadios *schedulerGroup =
1319 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), 1319 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
1320 topFrame); 1320 topFrame);
1321 schedulerGroup->addRadio("Dummy"); // Only for debugging 1321 schedulerGroup->addRadio("Dummy"); // Only for debugging
1322 schedulerGroup->addRadio(i18n("Mail client")); 1322 schedulerGroup->addRadio(i18n("Mail client"));
1323 1323
1324 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); 1324 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
1325#endif 1325#endif
1326 1326
1327 KPrefsWidRadios *sendGroup = 1327 KPrefsWidRadios *sendGroup =
1328 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), 1328 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
1329 topFrame); 1329 topFrame);
1330 sendGroup->addRadio(i18n("Send to outbox")); 1330 sendGroup->addRadio(i18n("Send to outbox"));
1331 sendGroup->addRadio(i18n("Send directly")); 1331 sendGroup->addRadio(i18n("Send directly"));
1332 1332
1333 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); 1333 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
1334 1334
1335 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); 1335 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
1336 mAMails = new QListView(topFrame); 1336 mAMails = new QListView(topFrame);
1337 mAMails->addColumn(i18n("Email"),300); 1337 mAMails->addColumn(i18n("Email"),300);
1338 topLayout->addMultiCellWidget(mAMails,3,3,0,1); 1338 topLayout->addMultiCellWidget(mAMails,3,3,0,1);
1339 1339
1340 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); 1340 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
1341 aEmailsEdit = new QLineEdit(topFrame); 1341 aEmailsEdit = new QLineEdit(topFrame);
1342 aEmailsEdit->setEnabled(false); 1342 aEmailsEdit->setEnabled(false);
1343 topLayout->addWidget(aEmailsEdit,4,1); 1343 topLayout->addWidget(aEmailsEdit,4,1);
1344 1344
1345 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); 1345 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
1346 topLayout->addWidget(add,5,0); 1346 topLayout->addWidget(add,5,0);
1347 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); 1347 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
1348 topLayout->addWidget(del,5,1); 1348 topLayout->addWidget(del,5,1);
1349 1349
1350 //topLayout->setRowStretch(2,1); 1350 //topLayout->setRowStretch(2,1);
1351 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); 1351 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
1352 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); 1352 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
1353 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); 1353 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
1354 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); 1354 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
1355#endif 1355#endif
1356} 1356}
1357 1357
1358void KOPrefsDialog::setupGroupAutomationTab() 1358void KOPrefsDialog::setupGroupAutomationTab()
1359{ 1359{
1360 return; 1360 return;
1361 QFrame *topFrame = addPage(i18n("Group Automation"),0, 1361 QFrame *topFrame = addPage(i18n("Group Automation"),0,
1362 DesktopIcon("personal",KIcon::SizeMedium)); 1362 DesktopIcon("personal",KIcon::SizeMedium));
1363 1363
1364 QGridLayout *topLayout = new QGridLayout(topFrame,5,1); 1364 QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
1365 topLayout->setSpacing(spacingHint()); 1365 topLayout->setSpacing(spacingHint());
1366 topLayout->setMargin(marginHint()); 1366 topLayout->setMargin(marginHint());
1367 1367
1368 KPrefsWidRadios *autoRefreshGroup = 1368 KPrefsWidRadios *autoRefreshGroup =
1369 addWidRadios(i18n("Auto Send Refresh"), 1369 addWidRadios(i18n("Auto Send Refresh"),
1370 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); 1370 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
1371 autoRefreshGroup->addRadio(i18n("Never")); 1371 autoRefreshGroup->addRadio(i18n("Never"));
1372 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); 1372 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
1373 //autoRefreshGroup->addRadio(i18n("selected emails")); 1373 //autoRefreshGroup->addRadio(i18n("selected emails"));
1374 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); 1374 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
1375 1375
1376 KPrefsWidRadios *autoInsertGroup = 1376 KPrefsWidRadios *autoInsertGroup =
1377 addWidRadios(i18n("Auto Insert IMIP Replies"), 1377 addWidRadios(i18n("Auto Insert IMIP Replies"),
1378 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); 1378 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
1379 autoInsertGroup->addRadio(i18n("Never")); 1379 autoInsertGroup->addRadio(i18n("Never"));
1380 autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); 1380 autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
1381 //autoInsertGroup->addRadio(i18n("selected emails")); 1381 //autoInsertGroup->addRadio(i18n("selected emails"));
1382 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); 1382 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
1383 1383
1384 KPrefsWidRadios *autoRequestGroup = 1384 KPrefsWidRadios *autoRequestGroup =
1385 addWidRadios(i18n("Auto Insert IMIP Requests"), 1385 addWidRadios(i18n("Auto Insert IMIP Requests"),
1386 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); 1386 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
1387 autoRequestGroup->addRadio(i18n("Never")); 1387 autoRequestGroup->addRadio(i18n("Never"));
1388 autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); 1388 autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
1389 //autoInsertGroup->addRadio(i18n("selected emails")); 1389 //autoInsertGroup->addRadio(i18n("selected emails"));
1390 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); 1390 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
1391 1391
1392 KPrefsWidRadios *autoFreeBusyGroup = 1392 KPrefsWidRadios *autoFreeBusyGroup =
1393 addWidRadios(i18n("Auto Send FreeBusy Information"), 1393 addWidRadios(i18n("Auto Send FreeBusy Information"),
1394 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); 1394 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
1395 autoFreeBusyGroup->addRadio(i18n("Never")); 1395 autoFreeBusyGroup->addRadio(i18n("Never"));
1396 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); 1396 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
1397 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1397 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1398 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); 1398 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0);
1399 1399
1400 KPrefsWidRadios *autoFreeBusyReplyGroup = 1400 KPrefsWidRadios *autoFreeBusyReplyGroup =
1401 addWidRadios(i18n("Auto Save FreeBusy Replies"), 1401 addWidRadios(i18n("Auto Save FreeBusy Replies"),
1402 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); 1402 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame);
1403 autoFreeBusyReplyGroup->addRadio(i18n("Never")); 1403 autoFreeBusyReplyGroup->addRadio(i18n("Never"));
1404 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); 1404 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
1405 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1405 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1406 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); 1406 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
1407} 1407}
1408 1408
1409void KOPrefsDialog::showPrinterTab() 1409void KOPrefsDialog::showPrinterTab()
1410{ 1410{
1411 showPage(pageIndex(mPrinterTab)); 1411 showPage(pageIndex(mPrinterTab));
1412} 1412}
1413 1413
1414 1414
1415void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, 1415void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
1416 const QStringList *tags) 1416 const QStringList *tags)
1417{ 1417{
1418 if (tags) { 1418 if (tags) {
1419 int i = tags->findIndex(text); 1419 int i = tags->findIndex(text);
1420 if (i > 0) combo->setCurrentItem(i); 1420 if (i > 0) combo->setCurrentItem(i);
1421 } else { 1421 } else {
1422 for(int i=0;i<combo->count();++i) { 1422 for(int i=0;i<combo->count();++i) {
1423 if (combo->text(i) == text) { 1423 if (combo->text(i) == text) {
1424 combo->setCurrentItem(i); 1424 combo->setCurrentItem(i);
1425 break; 1425 break;
1426 } 1426 }
1427 } 1427 }
1428 } 1428 }
1429} 1429}
1430 1430
1431void KOPrefsDialog::usrReadConfig() 1431void KOPrefsDialog::usrReadConfig()
1432{ 1432{
1433 mNameEdit->setText(KOPrefs::instance()->fullName()); 1433 mNameEdit->setText(KOPrefs::instance()->fullName());
1434 mEmailEdit->setText(KOPrefs::instance()->email()); 1434 mEmailEdit->setText(KOPrefs::instance()->email());
1435 1435
1436 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); 1436 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
1437 QDate current ( 2001, 1,1); 1437 QDate current ( 2001, 1,1);
1438 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1438 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1439 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1439 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1440 setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); 1440 setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId));
1441 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1441 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1442 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); 1442 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
1443 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); 1443 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
1444 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); 1444 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
1445 // if (KOPrefs::instance()->mAllDaySize > 47 ) 1445 // if (KOPrefs::instance()->mAllDaySize > 47 )
1446 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; 1446 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2;
1447 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); 1447 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize);
1448 1448
1449 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); 1449 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
1450 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); 1450 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
1451 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); 1451 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
1452 // mAMails->clear(); 1452 // mAMails->clear();
1453 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); 1453 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
1454// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { 1454// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
1455// QListViewItem *item = new QListViewItem(mAMails); 1455// QListViewItem *item = new QListViewItem(mAMails);
1456// item->setText(0,*it); 1456// item->setText(0,*it);
1457// mAMails->insertItem(item); 1457// mAMails->insertItem(item);
1458// } 1458// }
1459 1459
1460 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); 1460 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP);
1461 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); 1461 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser);
1462 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); 1462 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd);
1463 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); 1463 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile);
1464 1464
1465 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); 1465 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
1466 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); 1466 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
1467 QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1467 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1468 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 1468 mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
1469 dummy = KOPrefs::instance()->mUserDateFormatShort; 1469 dummy = KOPrefs::instance()->mUserDateFormatShort;
1470 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 1470 mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
1471 updateCategories(); 1471 updateCategories();
1472 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); 1472 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
1473 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); 1473 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
1474 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); 1474 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
1475 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); 1475 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
1476} 1476}
1477 1477
1478 1478
1479void KOPrefsDialog::usrWriteConfig() 1479void KOPrefsDialog::usrWriteConfig()
1480{ 1480{
1481 1481
1482 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); 1482 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text();
1483 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); 1483 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text();
1484 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); 1484 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text();
1485 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); 1485 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text();
1486 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); 1486 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text();
1487 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); 1487 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
1488 1488
1489 KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 1489 KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
1490 KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 1490 KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
1491 KOPrefs::instance()->setFullName(mNameEdit->text()); 1491 KOPrefs::instance()->setFullName(mNameEdit->text());
1492 KOPrefs::instance()->setEmail(mEmailEdit->text()); 1492 KOPrefs::instance()->setEmail(mEmailEdit->text());
1493 1493
1494 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); 1494 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
1495 1495
1496 KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); 1496 KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText();
1497 QDate date; 1497 QDate date;
1498 date = mStartDateSavingEdit->date(); 1498 date = mStartDateSavingEdit->date();
1499 int sub = 0; 1499 int sub = 0;
1500 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1500 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1501 sub = 1; 1501 sub = 1;
1502 KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; 1502 KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub;
1503 date = mEndDateSavingEdit->date(); 1503 date = mEndDateSavingEdit->date();
1504 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1504 if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1505 sub = 1; 1505 sub = 1;
1506 else 1506 else
1507 sub = 0; 1507 sub = 0;
1508 KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; 1508 KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub;
1509 // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); 1509 // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value();
1510 1510
1511 KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); 1511 KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
1512 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); 1512 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
1513 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); 1513 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
1514 1514
1515 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); 1515 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value();
1516 1516
1517 QDictIterator<QColor> it(mCategoryDict); 1517 QDictIterator<QColor> it(mCategoryDict);
1518 while (it.current()) { 1518 while (it.current()) {
1519 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); 1519 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
1520 ++it; 1520 ++it;
1521 } 1521 }
1522 1522
1523 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); 1523 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
1524 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); 1524 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
1525 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); 1525 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
1526 1526
1527 KOPrefs::instance()->mAdditionalMails.clear(); 1527 KOPrefs::instance()->mAdditionalMails.clear();
1528 // QListViewItem *item; 1528 // QListViewItem *item;
1529 // item = mAMails->firstChild(); 1529 // item = mAMails->firstChild();
1530 // while (item) 1530 // while (item)
1531 // { 1531 // {
1532 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); 1532 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
1533 // item = item->nextSibling(); 1533 // item = item->nextSibling();
1534 // } 1534 // }
1535 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); 1535 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
1536 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; 1536 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
1537 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; 1537 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
1538 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; 1538 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
1539 1539
1540} 1540}
1541 1541
1542void KOPrefsDialog::updateCategories() 1542void KOPrefsDialog::updateCategories()
1543{ 1543{
1544 mCategoryCombo->clear(); 1544 mCategoryCombo->clear();
1545 mCategoryDict.clear(); 1545 mCategoryDict.clear();
1546 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1546 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1547 updateCategoryColor(); 1547 updateCategoryColor();
1548} 1548}
1549 1549
1550void KOPrefsDialog::warningGroupScheduling() 1550void KOPrefsDialog::warningGroupScheduling()
1551{ 1551{
1552 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); 1552 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked());
1553} 1553}
1554 1554
1555void KOPrefsDialog::warningProjectView() 1555void KOPrefsDialog::warningProjectView()
1556{ 1556{
1557 warningExperimental(mEnableProjectView->checkBox()->isChecked()); 1557 warningExperimental(mEnableProjectView->checkBox()->isChecked());
1558} 1558}
1559 1559
1560void KOPrefsDialog::warningExperimental(bool on) 1560void KOPrefsDialog::warningExperimental(bool on)
1561{ 1561{
1562 if (on) { 1562 if (on) {
1563 KMessageBox::information(this,i18n("This is an experimental feature. " 1563 KMessageBox::information(this,i18n("This is an experimental feature. "
1564 "It may not work, it may do nothing useful and it may cause data loss. " 1564 "It may not work, it may do nothing useful and it may cause data loss. "
1565 "Use with care.\n" 1565 "Use with care.\n"
1566 "You have to restart KOrganizer for this setting to take effect.")); 1566 "You have to restart KOrganizer for this setting to take effect."));
1567 } else { 1567 } else {
1568 KMessageBox::information(this, 1568 KMessageBox::information(this,
1569 i18n("You have to restart KOrganizer for this setting to take effect.")); 1569 i18n("You have to restart KOrganizer for this setting to take effect."));
1570 } 1570 }
1571} 1571}
1572 1572
1573void KOPrefsDialog::toggleEmailSettings(bool on) 1573void KOPrefsDialog::toggleEmailSettings(bool on)
1574{ 1574{
1575 if (on) { 1575 if (on) {
1576 mEmailEdit->setEnabled(false); 1576 mEmailEdit->setEnabled(false);
1577 mNameEdit->setEnabled(false); 1577 mNameEdit->setEnabled(false);
1578 mEmailLabel->setEnabled(false); 1578 mEmailLabel->setEnabled(false);
1579 mNameLabel->setEnabled(false); 1579 mNameLabel->setEnabled(false);
1580 1580
1581 KEMailSettings settings; 1581 KEMailSettings settings;
1582 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); 1582 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName));
1583 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); 1583 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress));
1584 } else { 1584 } else {
1585 mEmailEdit->setEnabled(true); 1585 mEmailEdit->setEnabled(true);
1586 mNameEdit->setEnabled(true); 1586 mNameEdit->setEnabled(true);
1587 mEmailLabel->setEnabled(true); 1587 mEmailLabel->setEnabled(true);
1588 mNameLabel->setEnabled(true); 1588 mNameLabel->setEnabled(true);
1589 } 1589 }
1590} 1590}
1591 1591
1592void KOPrefsDialog::addItem() 1592void KOPrefsDialog::addItem()
1593{ 1593{
1594 // aEmailsEdit->setEnabled(true); 1594 // aEmailsEdit->setEnabled(true);
1595// QListViewItem *item = new QListViewItem(mAMails); 1595// QListViewItem *item = new QListViewItem(mAMails);
1596// mAMails->insertItem(item); 1596// mAMails->insertItem(item);
1597// mAMails->setSelected(item,true); 1597// mAMails->setSelected(item,true);
1598// aEmailsEdit->setText(i18n("(EmptyEmail)")); 1598// aEmailsEdit->setText(i18n("(EmptyEmail)"));
1599} 1599}
1600 1600
1601void KOPrefsDialog::removeItem() 1601void KOPrefsDialog::removeItem()
1602{ 1602{
1603// QListViewItem *item; 1603// QListViewItem *item;
1604// item = mAMails->selectedItem(); 1604// item = mAMails->selectedItem();
1605// if (!item) return; 1605// if (!item) return;
1606// mAMails->takeItem(item); 1606// mAMails->takeItem(item);
1607// item = mAMails->selectedItem(); 1607// item = mAMails->selectedItem();
1608// if (!item) { 1608// if (!item) {
1609// aEmailsEdit->setText(""); 1609// aEmailsEdit->setText("");
1610// aEmailsEdit->setEnabled(false); 1610// aEmailsEdit->setEnabled(false);
1611// } 1611// }
1612// if (mAMails->childCount() == 0) { 1612// if (mAMails->childCount() == 0) {
1613// aEmailsEdit->setEnabled(false); 1613// aEmailsEdit->setEnabled(false);
1614// } 1614// }
1615} 1615}
1616 1616
1617void KOPrefsDialog::updateItem() 1617void KOPrefsDialog::updateItem()
1618{ 1618{
1619 // QListViewItem *item; 1619 // QListViewItem *item;
1620// item = mAMails->selectedItem(); 1620// item = mAMails->selectedItem();
1621// if (!item) return; 1621// if (!item) return;
1622// item->setText(0,aEmailsEdit->text()); 1622// item->setText(0,aEmailsEdit->text());
1623} 1623}
1624 1624
1625void KOPrefsDialog::updateInput() 1625void KOPrefsDialog::updateInput()
1626{ 1626{
1627// QListViewItem *item; 1627// QListViewItem *item;
1628// item = mAMails->selectedItem(); 1628// item = mAMails->selectedItem();
1629// if (!item) return; 1629// if (!item) return;
1630// aEmailsEdit->setEnabled(true); 1630// aEmailsEdit->setEnabled(true);
1631// aEmailsEdit->setText(item->text(0)); 1631// aEmailsEdit->setText(item->text(0));
1632} 1632}
1633void KOPrefsDialog::updateTimezoneOffset( int index ) 1633void KOPrefsDialog::updateTimezoneOffset( int index )
1634{ 1634{
1635 /* 1635 /*
1636 qDebug("updateTimezoneOffset %d ", index); 1636 qDebug("updateTimezoneOffset %d ", index);
1637 if ( index < 24 ) { 1637 if ( index < 24 ) {
1638 mTimezoneOffsetSpin->setEnabled ( false ); 1638 mTimezoneOffsetSpin->setEnabled ( false );
1639 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); 1639 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 );
1640 1640
1641 1641
1642 } else { 1642 } else {
1643 if ( index == 24 ) { 1643 if ( index == 24 ) {
1644 mTimezoneOffsetSpin->setEnabled ( true ); 1644 mTimezoneOffsetSpin->setEnabled ( true );
1645 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1645 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1646 1646
1647 } else { 1647 } else {
1648 mTimezoneOffsetSpin->setEnabled ( false ); 1648 mTimezoneOffsetSpin->setEnabled ( false );
1649 mTimezoneOffsetSpin->setValue( 0 ); 1649 mTimezoneOffsetSpin->setValue( 0 );
1650 } 1650 }
1651 } 1651 }
1652 */ 1652 */
1653} 1653}
1654 1654
1655void KOPrefsDialog::setupTimeZoneTab() 1655void KOPrefsDialog::setupTimeZoneTab()
1656{ 1656{
1657 QFrame *topFrame = addPage(i18n("Time Zone"),0,0); 1657 QFrame *topFrame = addPage(i18n("Time Zone"),0,0);
1658 // DesktopIcon("clock",KIcon::SizeMedium)); 1658 // DesktopIcon("clock",KIcon::SizeMedium));
1659 1659
1660 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1660 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1661 topLayout->setSpacing(spacingHint()); 1661 topLayout->setSpacing(spacingHint());
1662 topLayout->setMargin(marginHint()); 1662 topLayout->setMargin(marginHint());
1663 1663
1664 QHBox *timeZoneBox = new QHBox( topFrame ); 1664 QHBox *timeZoneBox = new QHBox( topFrame );
1665 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 1665 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
1666 1666
1667 new QLabel( i18n("Timezone:"), timeZoneBox ); 1667 new QLabel( i18n("Timezone:"), timeZoneBox );
1668 mTimeZoneCombo = new QComboBox( timeZoneBox ); 1668 mTimeZoneCombo = new QComboBox( timeZoneBox );
1669 if ( QApplication::desktop()->width() < 300 ) { 1669 if ( QApplication::desktop()->width() < 300 ) {
1670 mTimeZoneCombo->setMaximumWidth(150); 1670 mTimeZoneCombo->setMaximumWidth(150);
1671 } 1671 }
1672 1672
1673 QStringList list; 1673 QStringList list;
1674 list = KGlobal::locale()->timeZoneList(); 1674 list = KGlobal::locale()->timeZoneList();
1675 mTimeZoneCombo->insertStringList(list); 1675 mTimeZoneCombo->insertStringList(list);
1676 1676
1677 // find the currently set time zone and select it 1677 // find the currently set time zone and select it
1678 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; 1678 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId;
1679 int nCurrentlySet = 11; 1679 int nCurrentlySet = 11;
1680 for (int i = 0; i < mTimeZoneCombo->count(); i++) 1680 for (int i = 0; i < mTimeZoneCombo->count(); i++)
1681 { 1681 {
1682 if (mTimeZoneCombo->text(i) == sCurrentlySet) 1682 if (mTimeZoneCombo->text(i) == sCurrentlySet)
1683 { 1683 {
1684 nCurrentlySet = i; 1684 nCurrentlySet = i;
1685 break; 1685 break;
1686 } 1686 }
1687 } 1687 }
1688 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 1688 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
1689 int iii = 1; 1689 int iii = 1;
1690 KPrefsDialogWidBool *sb = 1690 KPrefsDialogWidBool *sb =
1691 addWidBool(i18n("Timezone has daylight saving"), 1691 addWidBool(i18n("Timezone has daylight saving"),
1692 &(KOPrefs::instance()->mUseDaylightsaving),topFrame); 1692 &(KOPrefs::instance()->mUseDaylightsaving),topFrame);
1693 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 1693 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
1694 ++iii; 1694 ++iii;
1695 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 1695 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
1696 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1696 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1697 ++iii; 1697 ++iii;
1698 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 1698 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
1699 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1699 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1700 ++iii; 1700 ++iii;
1701 lab = new QLabel( i18n("Daylight start:"), topFrame ); 1701 lab = new QLabel( i18n("Daylight start:"), topFrame );
1702 topLayout->addWidget(lab, iii,0); 1702 topLayout->addWidget(lab, iii,0);
1703 mStartDateSavingEdit = new KDateEdit(topFrame); 1703 mStartDateSavingEdit = new KDateEdit(topFrame);
1704 topLayout->addWidget(mStartDateSavingEdit, iii,1); 1704 topLayout->addWidget(mStartDateSavingEdit, iii,1);
1705 ++iii; 1705 ++iii;
1706 1706
1707 lab = new QLabel( i18n("Daylight end:"), topFrame ); 1707 lab = new QLabel( i18n("Daylight end:"), topFrame );
1708 topLayout->addWidget(lab, iii,0); 1708 topLayout->addWidget(lab, iii,0);
1709 mEndDateSavingEdit = new KDateEdit(topFrame); 1709 mEndDateSavingEdit = new KDateEdit(topFrame);
1710 topLayout->addWidget(mEndDateSavingEdit, iii,1); 1710 topLayout->addWidget(mEndDateSavingEdit, iii,1);
1711 ++iii; 1711 ++iii;
1712 QDate current ( 2001, 1,1); 1712 QDate current ( 2001, 1,1);
1713 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1713 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1714 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1714 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1715 1715
1716 1716
1717} 1717}
1718#endif 1718#endif
diff --git a/kmicromail/libmailwrapper/libmailwrapper.pro b/kmicromail/libmailwrapper/libmailwrapper.pro
index 2b005d8..10d45b1 100644
--- a/kmicromail/libmailwrapper/libmailwrapper.pro
+++ b/kmicromail/libmailwrapper/libmailwrapper.pro
@@ -1,64 +1,65 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3 3
4HEADERS = mailwrapper.h \ 4HEADERS = mailwrapper.h \
5 imapwrapper.h \ 5 imapwrapper.h \
6 mailtypes.h \ 6 mailtypes.h \
7 pop3wrapper.h \ 7 pop3wrapper.h \
8 abstractmail.h \ 8 abstractmail.h \
9 smtpwrapper.h \ 9 smtpwrapper.h \
10 genericwrapper.h \ 10 genericwrapper.h \
11 mboxwrapper.h \ 11 mboxwrapper.h \
12 settings.h \ 12 settings.h \
13 logindialog.h \ 13 logindialog.h \
14 sendmailprogress.h \ 14 sendmailprogress.h \
15 statusmail.h \ 15 statusmail.h \
16 mhwrapper.h \ 16 mhwrapper.h \
17 nntpwrapper.h \ 17 nntpwrapper.h \
18 generatemail.h \ 18 generatemail.h \
19 storemail.h \ 19 storemail.h \
20 ../qpe/global.h 20 ../qpe/global.h
21 21
22SOURCES = imapwrapper.cpp \ 22SOURCES = imapwrapper.cpp \
23 mailwrapper.cpp \ 23 mailwrapper.cpp \
24 mailtypes.cpp \ 24 mailtypes.cpp \
25 pop3wrapper.cpp \ 25 pop3wrapper.cpp \
26 abstractmail.cpp \ 26 abstractmail.cpp \
27 smtpwrapper.cpp \ 27 smtpwrapper.cpp \
28 genericwrapper.cpp \ 28 genericwrapper.cpp \
29 mboxwrapper.cpp \ 29 mboxwrapper.cpp \
30 settings.cpp \ 30 settings.cpp \
31 logindialog.cpp \ 31 logindialog.cpp \
32 sendmailprogress.cpp \ 32 sendmailprogress.cpp \
33 statusmail.cpp \ 33 statusmail.cpp \
34 mhwrapper.cpp \ 34 mhwrapper.cpp \
35 nntpwrapper.cpp \ 35 nntpwrapper.cpp \
36 generatemail.cpp \ 36 generatemail.cpp \
37 storemail.cpp \ 37 storemail.cpp \
38 ./qpe/qdialog_hacked.cpp \
38 ../qpe/global.cpp 39 ../qpe/global.cpp
39 40
40INTERFACES = logindialogui.ui \ 41INTERFACES = logindialogui.ui \
41 sendmailprogressui.ui 42 sendmailprogressui.ui
42 43
43INCLUDEPATH += .. ../../microkde ../../microkde/kdecore ../libetpan/include 44INCLUDEPATH += ../qpe .. ../../microkde ../../microkde/kdecore ../libetpan/include
44LIBS += -lssl -lcrypto 45LIBS += -lssl -lcrypto
45 46
46#-lqpe -letpan 47#-lqpe -letpan
47 48
48DESTDIR = ../../bin 49DESTDIR = ../../bin
49TARGET = micromailwrapper 50TARGET = micromailwrapper
50 51
51DEFINES += DESKTOP_VERSION 52DEFINES += DESKTOP_VERSION
52unix : { 53unix : {
53OBJECTS_DIR = obj/unix 54OBJECTS_DIR = obj/unix
54MOC_DIR = moc/unix 55MOC_DIR = moc/unix
55} 56}
56win32: { 57win32: {
57DEFINES += _WIN32_ 58DEFINES += _WIN32_
58LIBS += mfc71u.lib 59LIBS += mfc71u.lib
59QMAKE_LINK += /NODEFAULTLIB:LIBC 60QMAKE_LINK += /NODEFAULTLIB:LIBC
60#QMAKE_LINK += /NODEFAULTLIB:MSVCRT 61#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
61#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib 62#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
62OBJECTS_DIR = obj/win 63OBJECTS_DIR = obj/win
63MOC_DIR = moc/win 64MOC_DIR = moc/win
64} 65}
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp
index b19dbbe..7655385 100644
--- a/kmicromail/mainwindow.cpp
+++ b/kmicromail/mainwindow.cpp
@@ -1,305 +1,305 @@
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#else 14#else
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#endif 16#endif
17#include "defines.h" 17#include "defines.h"
18#include "mainwindow.h" 18#include "mainwindow.h"
19#include <KDGanttMinimizeSplitter.h> 19#include <KDGanttMinimizeSplitter.h>
20 20
21 21
22#include <kabc/stdaddressbook.h> 22#include <kabc/stdaddressbook.h>
23 23
24MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) 24MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags )
25 : QMainWindow( parent, name ) //, flags ) 25 : QMainWindow( parent, name ) //, flags )
26{ 26{
27 setCaption( i18n( "KOpieMail/Pi" ) ); 27 setCaption( i18n( "KOpieMail/Pi" ) );
28 setToolBarsMovable( false ); 28 setToolBarsMovable( false );
29 //KABC::StdAddressBook::self(); 29 //KABC::StdAddressBook::self();
30 toolBar = new QToolBar( this ); 30 toolBar = new QToolBar( this );
31 menuBar = new QPEMenuBar( toolBar ); 31 menuBar = new QPEMenuBar( toolBar );
32 mailMenu = new QPopupMenu( menuBar ); 32 mailMenu = new QPopupMenu( menuBar );
33 menuBar->insertItem( i18n( "Mail" ), mailMenu ); 33 menuBar->insertItem( i18n( "Mail" ), mailMenu );
34 settingsMenu = new QPopupMenu( menuBar ); 34 settingsMenu = new QPopupMenu( menuBar );
35 menuBar->insertItem( i18n( "Settings" ), settingsMenu ); 35 menuBar->insertItem( i18n( "Settings" ), settingsMenu );
36 36
37 addToolBar( toolBar ); 37 addToolBar( toolBar );
38 toolBar->setHorizontalStretchable( true ); 38 toolBar->setHorizontalStretchable( true );
39 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"), 39 QAction* getMail = new QAction( i18n( "Get all new mails" ), SmallIcon("enter"),
40 0, 0, this ); 40 0, 0, this );
41 connect(getMail, SIGNAL( activated() ), 41 connect(getMail, SIGNAL( activated() ),
42 SLOT( slotGetAllMail() ) ); 42 SLOT( slotGetAllMail() ) );
43 getMail->addTo( mailMenu ); 43 getMail->addTo( mailMenu );
44 44
45 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"), 45 getMail = new QAction( i18n( "Get new messages" ), SmallIcon("add"),
46 0, 0, this ); 46 0, 0, this );
47 getMail->addTo( toolBar ); 47 getMail->addTo( toolBar );
48 getMail->addTo( mailMenu ); 48 getMail->addTo( mailMenu );
49 connect(getMail, SIGNAL( activated() ), 49 connect(getMail, SIGNAL( activated() ),
50 SLOT( slotGetMail() ) ); 50 SLOT( slotGetMail() ) );
51 51
52 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"), 52 composeMail = new QAction( i18n( "Compose new mail" ), SmallIcon("composemail"),
53 0, 0, this ); 53 0, 0, this );
54 composeMail->addTo( toolBar ); 54 composeMail->addTo( toolBar );
55 composeMail->addTo( mailMenu ); 55 composeMail->addTo( mailMenu );
56 56
57 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") , 57 sendQueued = new QAction( i18n( "Send queued mails" ), SmallIcon("sendqueued") ,
58 0, 0, this ); 58 0, 0, this );
59 sendQueued->addTo( toolBar ); 59 sendQueued->addTo( toolBar );
60 sendQueued->addTo( mailMenu ); 60 sendQueued->addTo( mailMenu );
61 61
62 /* 62 /*
63 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC, 63 syncFolders = new QAction( i18n( "Sync mailfolders" ), ICON_SYNC,
64 0, 0, this ); 64 0, 0, this );
65 syncFolders->addTo( toolBar ); 65 syncFolders->addTo( toolBar );
66 syncFolders->addTo( mailMenu ); 66 syncFolders->addTo( mailMenu );
67 */ 67 */
68 68
69 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") , 69 showFolders = new QAction( i18n( "Show/Hide folders" ), SmallIcon("showfolders") ,
70 0, 0, this, 0, true ); 70 0, 0, this, 0, true );
71 showFolders->addTo( toolBar ); 71 showFolders->addTo( toolBar );
72 showFolders->addTo( mailMenu ); 72 showFolders->addTo( mailMenu );
73 showFolders->setOn( true ); 73 showFolders->setOn( true );
74 connect(showFolders, SIGNAL( toggled(bool) ), 74 connect(showFolders, SIGNAL( toggled(bool) ),
75 SLOT( slotShowFolders(bool) ) ); 75 SLOT( slotShowFolders(bool) ) );
76 76
77 /* 77 /*
78 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ), 78 searchMails = new QAction( i18n( "Search mails" ), SmallIcon("find") ),
79 0, 0, this ); 79 0, 0, this );
80 searchMails->addTo( toolBar ); 80 searchMails->addTo( toolBar );
81 searchMails->addTo( mailMenu ); 81 searchMails->addTo( mailMenu );
82 */ 82 */
83 83
84 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this); 84 deleteMails = new QAction(i18n("Delete Mail"), SmallIcon("trash"), 0, 0, this);
85 deleteMails->addTo( toolBar ); 85 deleteMails->addTo( toolBar );
86 deleteMails->addTo( mailMenu ); 86 deleteMails->addTo( mailMenu );
87 connect( deleteMails, SIGNAL( activated() ), 87 connect( deleteMails, SIGNAL( activated() ),
88 SLOT( slotDeleteMail() ) ); 88 SLOT( slotDeleteMail() ) );
89 89
90 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") , 90 editSettings = new QAction( i18n( "Edit settings" ), SmallIcon("SettingsIcon") ,
91 0, 0, this ); 91 0, 0, this );
92 editSettings->addTo( settingsMenu ); 92 editSettings->addTo( settingsMenu );
93 connect( editSettings, SIGNAL( activated() ), 93 connect( editSettings, SIGNAL( activated() ),
94 SLOT( slotEditSettings() ) ); 94 SLOT( slotEditSettings() ) );
95 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") , 95 editAccounts = new QAction( i18n( "Configure accounts" ), SmallIcon("editaccounts") ,
96 0, 0, this ); 96 0, 0, this );
97 editAccounts->addTo( settingsMenu ); 97 editAccounts->addTo( settingsMenu );
98 98
99 //setCentralWidget( view ); 99 //setCentralWidget( view );
100 100
101 QVBox* wrapperBox = new QVBox( this ); 101 QVBox* wrapperBox = new QVBox( this );
102 setCentralWidget( wrapperBox ); 102 setCentralWidget( wrapperBox );
103 103
104 // QWidget *view = new QWidget( wrapperBox ); 104 // QWidget *view = new QWidget( wrapperBox );
105 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); 105 KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox);
106 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); 106 split->setMinimizeDirection( KDGanttMinimizeSplitter::Left);
107 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); 107 //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight );
108 108
109 folderView = new AccountView( split ); 109 folderView = new AccountView( split );
110 folderView->header()->hide(); 110 folderView->header()->hide();
111 folderView->setRootIsDecorated( false ); 111 folderView->setRootIsDecorated( false );
112 folderView->addColumn( i18n( "Mailbox" ) ); 112 folderView->addColumn( i18n( "Mailbox" ) );
113 113
114 //layout->addWidget( folderView ); 114 //layout->addWidget( folderView );
115 115
116 mailView = new QListView( split ); 116 mailView = new QListView( split );
117 mailView->addColumn( i18n( " " ) ); 117 mailView->addColumn( i18n( " " ) );
118 mailView->addColumn( i18n( "Subject" ),QListView::Manual ); 118 mailView->addColumn( i18n( "Subject" ),QListView::Manual );
119 mailView->addColumn( i18n( "Sender" ),QListView::Manual ); 119 mailView->addColumn( i18n( "Sender" ),QListView::Manual );
120 mailView->addColumn( i18n( "Size" ),QListView::Manual); 120 mailView->addColumn( i18n( "Size" ),QListView::Manual);
121 mailView->addColumn( i18n( "Date" ),QListView::Manual); 121 mailView->addColumn( i18n( "Date" ),QListView::Manual);
122 mailView->setAllColumnsShowFocus(true); 122 mailView->setAllColumnsShowFocus(true);
123 //mailView->setSorting(-1); 123 //mailView->setSorting(-1);
124 mailView->setRootIsDecorated( false ); 124 mailView->setRootIsDecorated( false );
125 statusWidget = new StatusWidget( wrapperBox ); 125 statusWidget = new StatusWidget( wrapperBox );
126 statusWidget->hide(); 126 statusWidget->hide();
127 127
128 //layout->addWidget( mailView ); 128 //layout->addWidget( mailView );
129 //layout->setStretchFactor( folderView, 1 ); 129 //layout->setStretchFactor( folderView, 1 );
130 //layout->setStretchFactor( mailView, 2 ); 130 //layout->setStretchFactor( mailView, 2 );
131 131
132 slotAdjustLayout(); 132 slotAdjustLayout();
133#ifndef DESKTOP_VERSION 133#ifndef DESKTOP_VERSION
134 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); 134 QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold);
135 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); 135 QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold);
136#endif 136#endif
137 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, 137 connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this,
138 SLOT( mailLeftClicked(QListViewItem*) ) ); 138 SLOT( mailLeftClicked(QListViewItem*) ) );
139 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, 139 connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this,
140 SLOT( mailLeftClicked(QListViewItem*) ) ); 140 SLOT( mailLeftClicked(QListViewItem*) ) );
141 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, 141 connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this,
142 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); 142 SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) );
143 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), 143 connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)),
144 this,SLOT(refreshMailView(const QValueList<RecMailP>&))); 144 this,SLOT(refreshMailView(const QValueList<RecMailP>&)));
145 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); 145 connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) );
146 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); 146 connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) );
147// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); 147// connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) );
148 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); 148 connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) );
149 //mailView->setMultiSelection ( true ); 149 //mailView->setMultiSelection ( true );
150 mailView->setSelectionMode( QListView::Extended ); 150 mailView->setSelectionMode( QListView::Extended );
151 QValueList<int> list; 151 QValueList<int> list;
152 int fw = 100; 152 int fw = 100;
153 if ( QApplication::desktop()->width() > 320 ) 153 if ( QApplication::desktop()->width() > 320 )
154 fw = 50; 154 fw = 50;
155 list.append( fw ); 155 list.append( fw );
156 list.append( 100 ); 156 list.append( 100 );
157 split->setSizes( list ); 157 split->setSizes( list );
158 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); 158 QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) );
159 mailView->setShowSortIndicator ( true ); 159 mailView->setShowSortIndicator ( true );
160 QLabel *spacer = new QLabel( toolBar ); 160 QLabel *spacer = new QLabel( toolBar );
161 spacer->setBackgroundMode( QWidget::PaletteButton ); 161 spacer->setBackgroundMode( QWidget::PaletteButton );
162 toolBar->setStretchableWidget( spacer ); 162 toolBar->setStretchableWidget( spacer );
163 163
164 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); 164 QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
165 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 165 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
166 if ( QApplication::desktop()->width() > 320 ) 166 if ( QApplication::desktop()->width() > 320 )
167 closeMail->addTo(toolBar); 167 closeMail->addTo(toolBar);
168 closeMail->addTo(mailMenu); 168 closeMail->addTo(mailMenu);
169 169
170 170
171 QPopupMenu* helpMenu = new QPopupMenu( menuBar ); 171 QPopupMenu* helpMenu = new QPopupMenu( menuBar );
172 menuBar->insertItem( i18n( "Help" ), helpMenu ); 172 menuBar->insertItem( i18n( "Help" ), helpMenu );
173 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); 173 QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this);
174 connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); 174 connect( li, SIGNAL( activated() ), SLOT( showAbout()) );
175 li->addTo(helpMenu); 175 li->addTo(helpMenu);
176 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); 176 li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this);
177 connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); 177 connect( li, SIGNAL( activated() ), SLOT( showLicence()) );
178 li->addTo(helpMenu); 178 li->addTo(helpMenu);
179 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); 179 li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this);
180 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); 180 connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) );
181 li->addTo(helpMenu); 181 li->addTo(helpMenu);
182} 182}
183 183
184MainWindow::~MainWindow() 184MainWindow::~MainWindow()
185{ 185{
186} 186}
187 187
188void MainWindow::showLicence() 188void MainWindow::showLicence()
189{ 189{
190 KApplication::showLicence(); 190 KApplication::showLicence();
191} 191}
192void MainWindow::showAbout() 192void MainWindow::showAbout()
193{ 193{
194 QString version; 194 QString version;
195#include <../version> 195#include <../version>
196 196
197 QString cap = "About KOpieMail/Pi"; 197 QString cap = "About KOpieMail/Pi";
198 QString text =i18n("KOpieMail/Platform-independent\n") + 198 QString text =i18n("KOpieMail/Platform-independent\n") +
199 "(OM/Pi) " + version + " - " 199 "(OM/Pi) " + version + " - "
200 200
201#ifdef DESKTOP_VERSION 201#ifdef DESKTOP_VERSION
202 "Desktop Edition\n" 202 "Desktop Edition\n"
203#else 203#else
204 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" 204 "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n"
205#endif 205#endif
206 "www.pi-sync.net\n\n" 206 "www.pi-sync.net\n\n"
207 207
208 208
209 209
210"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" 210"Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n"
211 "KOpieMail/Pi is based on Opie Mail\n" 211 "KOpieMail/Pi is based on Opie Mail\n"
212 "Copyright (c) Rajko Albrecht and the Opie team\n" 212 "Copyright (c) Rajko Albrecht and the Opie team\n"
213 "KOpieMail/Pi is licensed under the GPL\n" 213 "KOpieMail/Pi is licensed under the GPL\n"
214 "\n" 214 "\n"
215 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" 215 "KOpieMail/Pi uses LibEtPan - a mail stuff library\n"
216 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" 216 "Copyright (C) 2001, 2002 - DINH Viet Hoa\n"
217 "libEtPan has its own licence - see LibEtPan licence\n"; 217 "libEtPan has its own licence - see LibEtPan licence\n";
218 218
219 KApplication::showText( cap, text ); 219 KApplication::showText( cap, text );
220} 220}
221void MainWindow::showEtpanLicence() 221void MainWindow::showEtpanLicence()
222{ 222{
223 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); 223 KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" );
224 224
225} 225}
226void MainWindow::appMessage(const QCString &, const QByteArray &) 226void MainWindow::appMessage(const QCString &, const QByteArray &)
227{ 227{
228 qDebug("appMessage implemented by subclass"); 228 qDebug("appMessage implemented by subclass");
229} 229}
230 230
231void MainWindow::slotAdjustLayout() { 231void MainWindow::slotAdjustLayout() {
232 232
233 /* 233 /*
234 QWidget *d = QApplication::desktop(); 234 QWidget *d = QApplication::desktop();
235 235
236 if ( d->width() < d->height() ) { 236 if ( d->width() < d->height() ) {
237 layout->setDirection( QBoxLayout::TopToBottom ); 237 layout->setDirection( QBoxLayout::TopToBottom );
238 } else { 238 } else {
239 layout->setDirection( QBoxLayout::LeftToRight ); 239 layout->setDirection( QBoxLayout::LeftToRight );
240 } 240 }
241 */ 241 */
242} 242}
243 243
244void MainWindow::slotAdjustColumns() 244void MainWindow::slotAdjustColumns()
245{ 245{
246 bool hidden = folderView->isHidden(); 246 bool hidden = folderView->isHidden();
247 if ( hidden ) folderView->show(); 247 if ( hidden ) folderView->show();
248 folderView->setColumnWidth( 0, folderView->visibleWidth() ); 248 folderView->setColumnWidth( 0, folderView->visibleWidth() );
249 if ( hidden ) folderView->hide(); 249 if ( hidden ) folderView->hide();
250 250
251 mailView->setColumnWidth( 0, 10 ); 251 mailView->setColumnWidth( 0, 10 );
252 mailView->setColumnWidth( 1, 100 ); 252 mailView->setColumnWidth( 1, 100 );
253 mailView->setColumnWidth( 2, 100 ); 253 mailView->setColumnWidth( 2, 100 );
254 mailView->setColumnWidth( 3, 50 ); 254 mailView->setColumnWidth( 3, 50 );
255 mailView->setColumnWidth( 4, 120 ); 255 mailView->setColumnWidth( 4, 120 );
256} 256}
257 257
258void MainWindow::slotEditSettings() 258void MainWindow::slotEditSettings()
259{ 259{
260} 260}
261 261
262void MainWindow::slotShowFolders( bool ) 262void MainWindow::slotShowFolders( bool )
263{ 263{
264 qDebug("not implemented: "); 264 qDebug("not implemented: ");
265} 265}
266 266
267void MainWindow::refreshMailView(const QValueList<RecMailP>&) 267void MainWindow::refreshMailView(const QValueList<RecMailP>&)
268{ 268{
269 qDebug("not implemented: "); 269 qDebug("not implemented: ");
270} 270}
271 271
272void MainWindow::mailLeftClicked(QListViewItem * ) 272void MainWindow::mailLeftClicked(QListViewItem * )
273{ 273{
274 qDebug("not implemented: "); 274 qDebug("not implemented: ");
275} 275}
276 276
277void MainWindow::displayMail() 277void MainWindow::displayMail()
278{ 278{
279 qDebug("not implemented: "); 279 qDebug("not implemented: ");
280} 280}
281 281
282void MainWindow::slotDeleteMail() 282void MainWindow::slotDeleteMail()
283{ 283{
284 qDebug("not implemented: "); 284 qDebug("not implemented: ");
285} 285}
286 286
287void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) 287void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int )
288{ 288{
289 qDebug("not implemented: "); 289 qDebug("not implemented: ");
290} 290}
291 291
292void MainWindow::slotSendQueued() 292void MainWindow::slotSendQueued()
293{ 293{
294 qDebug("not implemented: "); 294 qDebug("not implemented: ");
295} 295}
296 296
297void MainWindow::slotEditAccounts() 297void MainWindow::slotEditAccounts()
298{ 298{
299 qDebug("not implemented: "); 299 qDebug("not implemented: ");
300} 300}
301 301
302void MainWindow::slotComposeMail() 302void MainWindow::slotComposeMail()
303{ 303{
304 qDebug("not implemented: "); 304 qDebug("not implemented: ");
305} 305}
diff --git a/kmicromail/nntpgroupsdlg.cpp b/kmicromail/nntpgroupsdlg.cpp
index a461bdf..f564b10 100644
--- a/kmicromail/nntpgroupsdlg.cpp
+++ b/kmicromail/nntpgroupsdlg.cpp
@@ -1,30 +1,30 @@
1#include "nntpgroupsdlg.h" 1#include "nntpgroupsdlg.h"
2#include "nntpgroups.h" 2#include "nntpgroups.h"
3#include <klocale.h> 3#include <klocale.h>
4 4
5#include <libmailwrapper/settings.h> 5#include <libmailwrapper/settings.h>
6 6
7#include <qlayout.h> 7#include <qlayout.h>
8 8
9NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name) 9NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name)
10 : QDialog(parent,name,true,WStyle_ContextHelp) 10 : QDialog(parent,name,true,0)
11{ 11{
12 setCaption(i18n("Subscribed newsgroups")); 12 setCaption(i18n("Subscribed newsgroups"));
13 m_Account = account; 13 m_Account = account;
14 QVBoxLayout*dlglayout = new QVBoxLayout(this); 14 QVBoxLayout*dlglayout = new QVBoxLayout(this);
15 dlglayout->setSpacing(2); 15 dlglayout->setSpacing(2);
16 dlglayout->setMargin(1); 16 dlglayout->setMargin(1);
17 groupsWidget = new NNTPGroups(account,this); 17 groupsWidget = new NNTPGroups(account,this);
18 dlglayout->addWidget(groupsWidget); 18 dlglayout->addWidget(groupsWidget);
19} 19}
20 20
21NNTPGroupsDlg::~NNTPGroupsDlg() 21NNTPGroupsDlg::~NNTPGroupsDlg()
22{ 22{
23} 23}
24 24
25void NNTPGroupsDlg::accept() 25void NNTPGroupsDlg::accept()
26{ 26{
27 groupsWidget->storeValues(); 27 groupsWidget->storeValues();
28 m_Account->save(); 28 m_Account->save();
29 QDialog::accept(); 29 QDialog::accept();
30} 30}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 153c7c0..e088b9e 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,474 +1,477 @@
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#include "koprefsdialog.h"
5#include <libkdepim/externalapphandler.h>
6#include <libkdepim/kpimglobalprefs.h>
7#ifdef MINIKDE_KDIALOG_H
8#undef MINIKDE_KDIALOG_H
9#endif
4#include "settingsdialog.h" 10#include "settingsdialog.h"
5#include "opiemail.h" 11#include "opiemail.h"
6#include "editaccounts.h" 12#include "editaccounts.h"
7#include "composemail.h" 13#include "composemail.h"
8#include "mailistviewitem.h" 14#include "mailistviewitem.h"
9#include "viewmail.h" 15#include "viewmail.h"
10#include "selectstore.h" 16#include "selectstore.h"
11#include "selectsmtp.h" 17#include "selectsmtp.h"
12#include "accountitem.h" 18#include "accountitem.h"
13#include "koprefsdialog.h"
14#include "klocale.h" 19#include "klocale.h"
15 20
16#include <qmessagebox.h> 21#include <qmessagebox.h>
17#include <qtimer.h> 22#include <qtimer.h>
18#include <qcursor.h> 23#include <qcursor.h>
19#include <qregexp.h> 24#include <qregexp.h>
20#include <libkdepim/externalapphandler.h>
21#include <libkdepim/kpimglobalprefs.h>
22 25
23#ifdef DESKTOP_VERSION 26#ifdef DESKTOP_VERSION
24#include <qapplication.h> 27#include <qapplication.h>
25#else 28#else
26#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
27#endif 30#endif
28#include <libmailwrapper/smtpwrapper.h> 31#include <libmailwrapper/smtpwrapper.h>
29#include <libmailwrapper/mailtypes.h> 32#include <libmailwrapper/mailtypes.h>
30#include <libmailwrapper/abstractmail.h> 33#include <libmailwrapper/abstractmail.h>
31/* OPIE */ 34/* OPIE */
32//#include <qpe/resource.h> 35//#include <qpe/resource.h>
33//#include <qpe/qpeapplication.h> 36//#include <qpe/qpeapplication.h>
34 37
35/* QT */ 38/* QT */
36 39
37//using namespace Opie::Core; 40//using namespace Opie::Core;
38 41
39OpieMail::OpieMail( QWidget *parent, const char *name ) 42OpieMail::OpieMail( QWidget *parent, const char *name )
40 : MainWindow( parent, name) //, WStyle_ContextHelp ) 43 : MainWindow( parent, name) //, WStyle_ContextHelp )
41{ 44{
42 settings = new Settings(); 45 settings = new Settings();
43 46
44 folderView->populate( settings->getAccounts() ); 47 folderView->populate( settings->getAccounts() );
45 48
46} 49}
47 50
48OpieMail::~OpieMail() 51OpieMail::~OpieMail()
49{ 52{
50 if (settings) delete settings; 53 if (settings) delete settings;
51} 54}
52 55
53void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 56void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
54{ 57{
55 58
56} 59}
57#include <stdlib.h> 60#include <stdlib.h>
58void OpieMail::message(const QCString &msg, const QByteArray &data) 61void OpieMail::message(const QCString &msg, const QByteArray &data)
59{ 62{
60 // copied from old mail2 63 // copied from old mail2
61 static int ii = 0; 64 static int ii = 0;
62 //qDebug("QCOP CALL ############################# %d ", ii); 65 //qDebug("QCOP CALL ############################# %d ", ii);
63 //QString mess ( msg ); 66 //QString mess ( msg );
64 //qDebug("Message = %s ",mess.latin1()); 67 //qDebug("Message = %s ",mess.latin1());
65 ++ii; 68 ++ii;
66 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 69 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
67 70
68 mPendingEmail = QString::null; 71 mPendingEmail = QString::null;
69 mPendingName = QString::null; 72 mPendingName = QString::null;
70 if (msg == "writeMail(QString,QString)") 73 if (msg == "writeMail(QString,QString)")
71 { 74 {
72 //qDebug("writeMail(QString,QString) "); 75 //qDebug("writeMail(QString,QString) ");
73 QDataStream stream(data,IO_ReadOnly); 76 QDataStream stream(data,IO_ReadOnly);
74 stream >> mPendingName >> mPendingEmail; 77 stream >> mPendingName >> mPendingEmail;
75 // removing the whitespaces at beginning and end is needed! 78 // removing the whitespaces at beginning and end is needed!
76 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 79 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
77 } 80 }
78 else if (msg == "newMail()") 81 else if (msg == "newMail()")
79 { 82 {
80 //qDebug("slotComposeMail() "); 83 //qDebug("slotComposeMail() ");
81 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 84 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
82 // and a QCOP call does not like a processevents in his execution 85 // and a QCOP call does not like a processevents in his execution
83 // with the Qtimer we call slotComposeMail() after we reached the main event loop 86 // with the Qtimer we call slotComposeMail() after we reached the main event loop
84 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 87 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
85 // slotComposeMail(); 88 // slotComposeMail();
86 } 89 }
87 else if (msg == "newMail(QString)") 90 else if (msg == "newMail(QString)")
88 { 91 {
89 //qDebug(" newMail(QString)"); 92 //qDebug(" newMail(QString)");
90 QDataStream stream(data,IO_ReadOnly); 93 QDataStream stream(data,IO_ReadOnly);
91 stream >> mPendingName; 94 stream >> mPendingName;
92 // the format is 95 // the format is
93 // NAME <EMAIL>:SUBJECT 96 // NAME <EMAIL>:SUBJECT
94 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 97 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
95 } else { 98 } else {
96 mPendingData = data; 99 mPendingData = data;
97 mPendingMessage = msg; 100 mPendingMessage = msg;
98 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 101 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
99 } 102 }
100 103
101 //qDebug("END OpieMail::message "); 104 //qDebug("END OpieMail::message ");
102} 105}
103void OpieMail::slotExtAppHandler() 106void OpieMail::slotExtAppHandler()
104{ 107{
105 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 108 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
106} 109}
107void OpieMail::slotwriteMail2(const QString& namemail ) 110void OpieMail::slotwriteMail2(const QString& namemail )
108{ 111{
109 //qDebug("OpieMail::slotwriteMail2 "); 112 //qDebug("OpieMail::slotwriteMail2 ");
110 //qApp->processEvents(); 113 //qApp->processEvents();
111 ComposeMail compose( settings, this, 0, true ); 114 ComposeMail compose( settings, this, 0, true );
112 if ( !namemail.isEmpty() ) { 115 if ( !namemail.isEmpty() ) {
113 QString to = namemail; 116 QString to = namemail;
114 if ( namemail.find( " <") > 1 ) { 117 if ( namemail.find( " <") > 1 ) {
115 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 118 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
116 } else 119 } else
117 if ( namemail.find( "<") > 1 ) { 120 if ( namemail.find( "<") > 1 ) {
118 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 121 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
119 } 122 }
120 int sub = to.find( ">:"); 123 int sub = to.find( ">:");
121 if ( sub > 0 ) { 124 if ( sub > 0 ) {
122 compose.setTo( to.left(sub+1) ); 125 compose.setTo( to.left(sub+1) );
123 compose.setSubject( to.mid(sub+2) ); 126 compose.setSubject( to.mid(sub+2) );
124 } else 127 } else
125 compose.setTo( to ); 128 compose.setTo( to );
126 } 129 }
127 compose.slotAdjustColumns(); 130 compose.slotAdjustColumns();
128 compose.showMaximized(); 131 compose.showMaximized();
129 compose.exec(); 132 compose.exec();
130 raise(); 133 raise();
131 //qDebug("retttich "); 134 //qDebug("retttich ");
132} 135}
133void OpieMail::slotwriteMail(const QString&name,const QString&email) 136void OpieMail::slotwriteMail(const QString&name,const QString&email)
134{ 137{
135 // qDebug("OpieMail::slotwriteMail "); 138 // qDebug("OpieMail::slotwriteMail ");
136 ComposeMail compose( settings, this, 0, true ); 139 ComposeMail compose( settings, this, 0, true );
137 if (!email.isEmpty()) 140 if (!email.isEmpty())
138 { 141 {
139 if (!name.isEmpty()) 142 if (!name.isEmpty())
140 { 143 {
141 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 144 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
142 } 145 }
143 else 146 else
144 { 147 {
145 compose.setTo(email); 148 compose.setTo(email);
146 } 149 }
147 } 150 }
148 compose.slotAdjustColumns(); 151 compose.slotAdjustColumns();
149 compose.showMaximized(); 152 compose.showMaximized();
150 compose.exec(); 153 compose.exec();
151 raise(); 154 raise();
152} 155}
153 156
154void OpieMail::slotComposeMail() 157void OpieMail::slotComposeMail()
155{ 158{
156 if ( mPendingEmail == QString::null && mPendingName == QString::null) 159 if ( mPendingEmail == QString::null && mPendingName == QString::null)
157 slotwriteMail2( QString () ); 160 slotwriteMail2( QString () );
158 else { 161 else {
159 if ( mPendingEmail == QString::null ) 162 if ( mPendingEmail == QString::null )
160 slotwriteMail2( mPendingName ); 163 slotwriteMail2( mPendingName );
161 else 164 else
162 slotwriteMail( mPendingName, mPendingEmail ); 165 slotwriteMail( mPendingName, mPendingEmail );
163 } 166 }
164 //slotwriteMail(0l,0l); 167 //slotwriteMail(0l,0l);
165} 168}
166 169
167void OpieMail::slotSendQueued() 170void OpieMail::slotSendQueued()
168{ 171{
169 SMTPaccount *smtp = 0; 172 SMTPaccount *smtp = 0;
170 173
171 QList<Account> list = settings->getAccounts(); 174 QList<Account> list = settings->getAccounts();
172 QList<SMTPaccount> smtpList; 175 QList<SMTPaccount> smtpList;
173 smtpList.setAutoDelete(false); 176 smtpList.setAutoDelete(false);
174 Account *it; 177 Account *it;
175 for ( it = list.first(); it; it = list.next() ) 178 for ( it = list.first(); it; it = list.next() )
176 { 179 {
177 if ( it->getType() == MAILLIB::A_SMTP ) 180 if ( it->getType() == MAILLIB::A_SMTP )
178 { 181 {
179 smtp = static_cast<SMTPaccount *>(it); 182 smtp = static_cast<SMTPaccount *>(it);
180 smtpList.append(smtp); 183 smtpList.append(smtp);
181 } 184 }
182 } 185 }
183 if (smtpList.count()==0) 186 if (smtpList.count()==0)
184 { 187 {
185 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); 188 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n"));
186 return; 189 return;
187 } 190 }
188 if (smtpList.count()==1) 191 if (smtpList.count()==1)
189 { 192 {
190 smtp = smtpList.at(0); 193 smtp = smtpList.at(0);
191 } 194 }
192 else 195 else
193 { 196 {
194 smtp = 0; 197 smtp = 0;
195 selectsmtp selsmtp; 198 selectsmtp selsmtp;
196 selsmtp.setSelectionlist(&smtpList); 199 selsmtp.setSelectionlist(&smtpList);
197 selsmtp.showMaximized(); 200 selsmtp.showMaximized();
198 if ( selsmtp.exec() == QDialog::Accepted ) 201 if ( selsmtp.exec() == QDialog::Accepted )
199 { 202 {
200 smtp = selsmtp.selected_smtp(); 203 smtp = selsmtp.selected_smtp();
201 } 204 }
202 } 205 }
203 if (smtp) 206 if (smtp)
204 { 207 {
205 SMTPwrapper * wrap = new SMTPwrapper(smtp); 208 SMTPwrapper * wrap = new SMTPwrapper(smtp);
206 if ( wrap->flushOutbox() ) 209 if ( wrap->flushOutbox() )
207 { 210 {
208 QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed")); 211 QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed"));
209 } 212 }
210 delete wrap; 213 delete wrap;
211 } 214 }
212} 215}
213 216
214void OpieMail::slotSearchMails() 217void OpieMail::slotSearchMails()
215{ 218{
216 qDebug("OpieMail::slotSearchMails():not implemented "); 219 qDebug("OpieMail::slotSearchMails():not implemented ");
217} 220}
218 221
219void OpieMail::slotEditSettings() 222void OpieMail::slotEditSettings()
220{ 223{
221#if 0 224#if 0
222 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); 225 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp );
223 settingsDialog.showMaximized(); 226 settingsDialog.showMaximized();
224 settingsDialog.exec(); 227 settingsDialog.exec();
225#endif 228#endif
226 KOPrefsDialog settingsDialog( this, "koprefs", true ); 229 KOPrefsDialog settingsDialog( this, "koprefs", true );
227 settingsDialog.showMaximized(); 230 settingsDialog.showMaximized();
228 settingsDialog.exec(); 231 settingsDialog.exec();
229} 232}
230 233
231void OpieMail::slotEditAccounts() 234void OpieMail::slotEditAccounts()
232{ 235{
233 EditAccounts eaDialog( settings, this, 0, true ); 236 EditAccounts eaDialog( settings, this, 0, true );
234 eaDialog.slotAdjustColumns(); 237 eaDialog.slotAdjustColumns();
235 eaDialog.showMaximized(); 238 eaDialog.showMaximized();
236 eaDialog.exec(); 239 eaDialog.exec();
237 if ( settings ) delete settings; 240 if ( settings ) delete settings;
238 settings = new Settings(); 241 settings = new Settings();
239 242
240 folderView->populate( settings->getAccounts() ); 243 folderView->populate( settings->getAccounts() );
241} 244}
242 245
243void OpieMail::displayMail() 246void OpieMail::displayMail()
244{ 247{
245 QListViewItem*item = mailView->currentItem(); 248 QListViewItem*item = mailView->currentItem();
246 if (!item) return; 249 if (!item) return;
247 RecMailP mail = ((MailListViewItem*)item)->data(); 250 RecMailP mail = ((MailListViewItem*)item)->data();
248 RecBodyP body = folderView->fetchBody(mail); 251 RecBodyP body = folderView->fetchBody(mail);
249 ViewMail readMail( this,"", Qt::WType_Modal ); 252 ViewMail readMail( this,"", Qt::WType_Modal );
250 readMail.setBody( body ); 253 readMail.setBody( body );
251 readMail.setMail( mail ); 254 readMail.setMail( mail );
252 readMail.showMaximized(); 255 readMail.showMaximized();
253 readMail.exec(); 256 readMail.exec();
254 257
255 if ( readMail.deleted ) 258 if ( readMail.deleted )
256 { 259 {
257 folderView->refreshCurrent(); 260 folderView->refreshCurrent();
258 } 261 }
259 else 262 else
260 { 263 {
261 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 264 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
262 } 265 }
263} 266}
264void OpieMail::slotGetAllMail() 267void OpieMail::slotGetAllMail()
265{ 268{
266 QListViewItem * item = folderView->firstChild(); 269 QListViewItem * item = folderView->firstChild();
267 while ( item ){ 270 while ( item ){
268 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 271 ((AccountViewItem *)item)->contextMenuSelected( 101 );
269 item = item->nextSibling (); 272 item = item->nextSibling ();
270 } 273 }
271} 274}
272void OpieMail::slotGetMail() 275void OpieMail::slotGetMail()
273{ 276{
274 QListViewItem * item = folderView->currentItem(); 277 QListViewItem * item = folderView->currentItem();
275 if ( ! item ) return; 278 if ( ! item ) return;
276 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 279 ((AccountViewItem *)item)->contextMenuSelected( 101 );
277} 280}
278void OpieMail::slotDeleteMail() 281void OpieMail::slotDeleteMail()
279{ 282{
280 if (!mailView->currentItem()) return; 283 if (!mailView->currentItem()) return;
281 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 284 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
282 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 ) 285 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 )
283 { 286 {
284 mail->Wrapper()->deleteMail( mail ); 287 mail->Wrapper()->deleteMail( mail );
285 folderView->refreshCurrent(); 288 folderView->refreshCurrent();
286 } 289 }
287} 290}
288void OpieMail::slotDeleteAllMail() 291void OpieMail::slotDeleteAllMail()
289{ 292{
290 293
291 QValueList<RecMailP> t; 294 QValueList<RecMailP> t;
292 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 295 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
293 { 296 {
294 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 297 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
295 while ( item ) { 298 while ( item ) {
296 if ( item->isSelected() ) { 299 if ( item->isSelected() ) {
297 t.append( item->data() ); 300 t.append( item->data() );
298 } 301 }
299 item = (MailListViewItem*)item->nextSibling(); 302 item = (MailListViewItem*)item->nextSibling();
300 } 303 }
301 } 304 }
302 else 305 else
303 return; 306 return;
304 if ( t.count() == 0 ) 307 if ( t.count() == 0 )
305 return; 308 return;
306 RecMailP mail = t.first(); 309 RecMailP mail = t.first();
307 mail->Wrapper()->deleteMailList(t); 310 mail->Wrapper()->deleteMailList(t);
308 folderView->refreshCurrent(); 311 folderView->refreshCurrent();
309 312
310 313
311} 314}
312void OpieMail::clearSelection() 315void OpieMail::clearSelection()
313{ 316{
314 mailView->clearSelection(); 317 mailView->clearSelection();
315 318
316} 319}
317 320
318void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 321void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
319{ 322{
320 if (!mailView->currentItem()) return; 323 if (!mailView->currentItem()) return;
321 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 324 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
322 /* just the RIGHT button - or hold on pda */ 325 /* just the RIGHT button - or hold on pda */
323 if (button!=2) {return;} 326 if (button!=2) {return;}
324 if (!item) return; 327 if (!item) return;
325 QPopupMenu *m = new QPopupMenu(0); 328 QPopupMenu *m = new QPopupMenu(0);
326 if (m) 329 if (m)
327 { 330 {
328 if (mailtype==MAILLIB::A_NNTP) { 331 if (mailtype==MAILLIB::A_NNTP) {
329 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); 332 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
330 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); 333 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
331 m->insertSeparator(); 334 m->insertSeparator();
332 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 335 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
333 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 336 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
334 } else { 337 } else {
335 if (folderView->currentisDraft()) { 338 if (folderView->currentisDraft()) {
336 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); 339 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
337 } 340 }
338 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); 341 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
339 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 342 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
340 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); 343 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
341 m->insertSeparator(); 344 m->insertSeparator();
342 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 345 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
343 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 346 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
344 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 347 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
345 } 348 }
346 m->setFocus(); 349 m->setFocus();
347 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 350 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
348 delete m; 351 delete m;
349 } 352 }
350} 353}
351 354
352void OpieMail::slotShowFolders( bool show ) 355void OpieMail::slotShowFolders( bool show )
353{ 356{
354 if ( show && folderView->isHidden() ) 357 if ( show && folderView->isHidden() )
355 { 358 {
356 folderView->show(); 359 folderView->show();
357 } 360 }
358 else if ( !show && !folderView->isHidden() ) 361 else if ( !show && !folderView->isHidden() )
359 { 362 {
360 folderView->hide(); 363 folderView->hide();
361 } 364 }
362} 365}
363 366
364void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 367void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
365{ 368{
366 MailListViewItem*item = 0; 369 MailListViewItem*item = 0;
367 mailView->clear(); 370 mailView->clear();
368 371
369 QValueList<RecMailP>::ConstIterator it; 372 QValueList<RecMailP>::ConstIterator it;
370 for (it = list.begin(); it != list.end();++it) 373 for (it = list.begin(); it != list.end();++it)
371 { 374 {
372 item = new MailListViewItem(mailView,item); 375 item = new MailListViewItem(mailView,item);
373 item->storeData((*it)); 376 item->storeData((*it));
374 item->showEntry(); 377 item->showEntry();
375 } 378 }
376} 379}
377 380
378void OpieMail::mailLeftClicked( QListViewItem *item ) 381void OpieMail::mailLeftClicked( QListViewItem *item )
379{ 382{
380 mailView->clearSelection(); 383 mailView->clearSelection();
381 /* just LEFT button - or tap with stylus on pda */ 384 /* just LEFT button - or tap with stylus on pda */
382 //if (button!=1) return; 385 //if (button!=1) return;
383 if (!item) return; 386 if (!item) return;
384 if (folderView->currentisDraft()) { 387 if (folderView->currentisDraft()) {
385 reEditMail(); 388 reEditMail();
386 } else { 389 } else {
387 displayMail(); 390 displayMail();
388 } 391 }
389} 392}
390 393
391void OpieMail::slotMoveCopyMail() 394void OpieMail::slotMoveCopyMail()
392{ 395{
393 if (!mailView->currentItem()) return; 396 if (!mailView->currentItem()) return;
394 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 397 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
395 AbstractMail*targetMail = 0; 398 AbstractMail*targetMail = 0;
396 QString targetFolder = ""; 399 QString targetFolder = "";
397 Selectstore sels; 400 Selectstore sels;
398 folderView->setupFolderselect(&sels); 401 folderView->setupFolderselect(&sels);
399 if (!sels.exec()) return; 402 if (!sels.exec()) return;
400 targetMail = sels.currentMail(); 403 targetMail = sels.currentMail();
401 targetFolder = sels.currentFolder(); 404 targetFolder = sels.currentFolder();
402 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 405 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
403 targetFolder.isEmpty()) 406 targetFolder.isEmpty())
404 { 407 {
405 return; 408 return;
406 } 409 }
407 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 410 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
408 { 411 {
409 QMessageBox::critical(0,i18n("Error creating new Folder"), 412 QMessageBox::critical(0,i18n("Error creating new Folder"),
410 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 413 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
411 return; 414 return;
412 } 415 }
413 sels.hide(); 416 sels.hide();
414 qApp->processEvents(); 417 qApp->processEvents();
415 // qDebug("hiding sels "); 418 // qDebug("hiding sels ");
416 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 419 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
417 folderView->refreshCurrent(); 420 folderView->refreshCurrent();
418} 421}
419 422
420void OpieMail::slotMoveCopyAllMail() 423void OpieMail::slotMoveCopyAllMail()
421{ 424{
422 425
423 if (!mailView->currentItem()) return; 426 if (!mailView->currentItem()) return;
424 QValueList<RecMailP> t; 427 QValueList<RecMailP> t;
425 // 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 ) 428 // 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 )
426 { 429 {
427 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 430 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
428 while ( item ) { 431 while ( item ) {
429 if ( item->isSelected() ) { 432 if ( item->isSelected() ) {
430 t.append( item->data() ); 433 t.append( item->data() );
431 } 434 }
432 item = (MailListViewItem*)item->nextSibling(); 435 item = (MailListViewItem*)item->nextSibling();
433 } 436 }
434 } 437 }
435 // else 438 // else
436 // return; 439 // return;
437 if ( t.count() == 0 ) 440 if ( t.count() == 0 )
438 return; 441 return;
439 RecMailP mail = t.first(); 442 RecMailP mail = t.first();
440 AbstractMail*targetMail = 0; 443 AbstractMail*targetMail = 0;
441 QString targetFolder = ""; 444 QString targetFolder = "";
442 Selectstore sels; 445 Selectstore sels;
443 folderView->setupFolderselect(&sels); 446 folderView->setupFolderselect(&sels);
444 if (!sels.exec()) return; 447 if (!sels.exec()) return;
445 targetMail = sels.currentMail(); 448 targetMail = sels.currentMail();
446 targetFolder = sels.currentFolder(); 449 targetFolder = sels.currentFolder();
447 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 450 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
448 targetFolder.isEmpty()) 451 targetFolder.isEmpty())
449 { 452 {
450 return; 453 return;
451 } 454 }
452 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 455 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
453 { 456 {
454 QMessageBox::critical(0,i18n("Error creating new Folder"), 457 QMessageBox::critical(0,i18n("Error creating new Folder"),
455 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 458 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
456 return; 459 return;
457 } 460 }
458 sels.hide(); 461 sels.hide();
459 qApp->processEvents(); 462 qApp->processEvents();
460 //qDebug("hiding sels "); 463 //qDebug("hiding sels ");
461 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); 464 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails());
462 folderView->refreshCurrent(); 465 folderView->refreshCurrent();
463} 466}
464 467
465void OpieMail::reEditMail() 468void OpieMail::reEditMail()
466{ 469{
467 if (!mailView->currentItem()) return; 470 if (!mailView->currentItem()) return;
468 471
469 ComposeMail compose( settings, this, 0, true ); 472 ComposeMail compose( settings, this, 0, true );
470 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 473 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
471 compose.slotAdjustColumns(); 474 compose.slotAdjustColumns();
472 compose.showMaximized(); 475 compose.showMaximized();
473 compose.exec(); 476 compose.exec();
474} 477}
diff --git a/kmicromail/qpe/qdialog.h b/kmicromail/qpe/qdialog.h
new file mode 100644
index 0000000..d671e34
--- a/dev/null
+++ b/kmicromail/qpe/qdialog.h
@@ -0,0 +1,35 @@
1
2#ifndef MINIKDE_KDIALOG_H
3
4#ifndef DEFINE_QDIALOG_HACK
5#define DEFINE_QDIALOG_HACK
6#warning call of include <qdialog.h>
7#warning including /usr/local/qt/include/qdialog.h
8#warning if you get an compiling error please adjust your path her
9
10#include "/usr/local/qt/include/qdialog.h"
11class QDialog_hacked : public QDialog
12{
13 //Q__OBJECT
14
15 public:
16 QDialog_hacked ( QWidget * parent=0, const char * name=0, bool modal=true, WFlags f=0 );
17
18};
19
20#define QDialog QDialog_hacked
21
22#endif
23
24#else
25#warning ******************************************
26#warning ******************************************
27#warning ******************************************
28#warning ******************************************
29#warning ******************************************
30#warning ******************************************
31#warning ******************************************
32#warning ******************************************
33#include "/usr/local/qt/include/qdialog.h"
34
35#endif
diff --git a/kmicromail/qpe/qdialog_hacked.cpp b/kmicromail/qpe/qdialog_hacked.cpp
new file mode 100644
index 0000000..e2ce21a
--- a/dev/null
+++ b/kmicromail/qpe/qdialog_hacked.cpp
@@ -0,0 +1,30 @@
1
2#include <qdialog.h>
3#include <qhbox.h>
4#include <qpushbutton.h>
5#include <klocale.h>
6#ifdef QDialog
7#undef QDialog
8#endif
9 QDialog_hacked::QDialog_hacked ( QWidget * parent, const char * name, bool modal, WFlags f )
10 : QDialog( parent,name,modal)
11 {
12 qDebug("******************** ");
13 qDebug("******************** ");
14 qDebug("******************** ");
15 qDebug("******************** ");
16 qDebug("New hacked QDialog == KDialogBase ");
17 //QTimer::singleShot( 1, this,SLOT(addaddbuttons()) );
18
19 setOrientation ( Vertical );
20 QHBox * hb = new QHBox ( this );
21 QPushButton *ok = new QPushButton( i18n("OK"), hb );
22 QPushButton *cancel = new QPushButton( i18n("Cancel"), hb );
23 setExtension ( hb );
24 showExtension ( true );
25 connect ( ok, SIGNAL ( clicked()),this, SLOT (accept() ) );
26 connect ( cancel, SIGNAL ( clicked()),this, SLOT (reject() ) );
27
28 }
29
30
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 0b4c322..f1e0225 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -1,533 +1,536 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2
3
4
5#include <kfiledialog.h>
6#include "koprefs.h"
7#include <klocale.h>
8#include <kglobal.h>
9#include <kapplication.h>
10
11#ifdef MINIKDE_KDIALOG_H
12#undef MINIKDE_KDIALOG_H
13#endif
14
2#include "composemail.h" 15#include "composemail.h"
3#include "viewmail.h" 16#include "viewmail.h"
4 17
5#include <libmailwrapper/settings.h> 18#include <libmailwrapper/settings.h>
6#include <libmailwrapper/abstractmail.h> 19#include <libmailwrapper/abstractmail.h>
7#include <libmailwrapper/mailtypes.h> 20#include <libmailwrapper/mailtypes.h>
8#include <kapplication.h>
9
10/* OPIE */
11//#include <opie2/odebug.h>
12//#include <opie2/ofiledialog.h>
13//#include <opie2/oimagescrollview.h>
14 21
15#include <kfiledialog.h> 22#include <qdialog.h>
16#include <kdialog.h>
17 23
18#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
19 25
20/* QT */ 26/* QT */
21#include <qtextbrowser.h> 27#include <qtextbrowser.h>
22#include <qmessagebox.h> 28#include <qmessagebox.h>
23#include <qtextstream.h> 29#include <qtextstream.h>
24#include <qaction.h> 30#include <qaction.h>
25#include <qpopupmenu.h> 31#include <qpopupmenu.h>
26#include <qfile.h> 32#include <qfile.h>
27#include <qlayout.h> 33#include <qlayout.h>
28#include "koprefs.h"
29#include <klocale.h>
30#include <kglobal.h>
31 34
32//using namespace Opie::Ui; 35//using namespace Opie::Ui;
33//using namespace Opie::Core; 36//using namespace Opie::Core;
34 37
35AttachItem::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,
36 const QString&fsize,int num,const QValueList<int>&path) 39 const QString&fsize,int num,const QValueList<int>&path)
37 : QListViewItem(parent,after),_partNum(num) 40 : QListViewItem(parent,after),_partNum(num)
38{ 41{
39 _path=path; 42 _path=path;
40 setText(0, mime); 43 setText(0, mime);
41 setText(1, desc); 44 setText(1, desc);
42 setText(2, file); 45 setText(2, file);
43 setText(3, fsize); 46 setText(3, fsize);
44} 47}
45 48
46AttachItem::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,
47 const QString&fsize,int num,const QValueList<int>&path) 50 const QString&fsize,int num,const QValueList<int>&path)
48 : QListViewItem(parent,after),_partNum(num) 51 : QListViewItem(parent,after),_partNum(num)
49{ 52{
50 _path=path; 53 _path=path;
51 setText(0, mime); 54 setText(0, mime);
52 setText(1, desc); 55 setText(1, desc);
53 setText(2, file); 56 setText(2, file);
54 setText(3, fsize); 57 setText(3, fsize);
55} 58}
56 59
57bool AttachItem::isParentof(const QValueList<int>&path) 60bool AttachItem::isParentof(const QValueList<int>&path)
58{ 61{
59 /* if not set, then no parent */ 62 /* if not set, then no parent */
60 if (path.count()==0||_path.count()==0) return false; 63 if (path.count()==0||_path.count()==0) return false;
61 /* the parent must have one digit less then a child */ 64 /* the parent must have one digit less then a child */
62 if (path.count()!=_path.count()+1) return false; 65 if (path.count()!=_path.count()+1) return false;
63 for (unsigned int i=0; i < _path.count();++i) 66 for (unsigned int i=0; i < _path.count();++i)
64 { 67 {
65 if (_path[i]!=path[i]) return false; 68 if (_path[i]!=path[i]) return false;
66 } 69 }
67 return true; 70 return true;
68} 71}
69 72
70AttachItem* ViewMail::searchParent(const QValueList<int>&path) 73AttachItem* ViewMail::searchParent(const QValueList<int>&path)
71{ 74{
72 QListViewItemIterator it( attachments ); 75 QListViewItemIterator it( attachments );
73 for ( ; it.current(); ++it ) 76 for ( ; it.current(); ++it )
74 { 77 {
75 AttachItem*ati = (AttachItem*)it.current(); 78 AttachItem*ati = (AttachItem*)it.current();
76 if (ati->isParentof(path)) return ati; 79 if (ati->isParentof(path)) return ati;
77 } 80 }
78 return 0; 81 return 0;
79} 82}
80 83
81AttachItem* ViewMail::lastChild(AttachItem*parent) 84AttachItem* ViewMail::lastChild(AttachItem*parent)
82{ 85{
83 if (!parent) return 0; 86 if (!parent) return 0;
84 AttachItem* item = (AttachItem*)parent->firstChild(); 87 AttachItem* item = (AttachItem*)parent->firstChild();
85 if (!item) return item; 88 if (!item) return item;
86 AttachItem*temp=0; 89 AttachItem*temp=0;
87 while( (temp=(AttachItem*)item->nextSibling())) 90 while( (temp=(AttachItem*)item->nextSibling()))
88 { 91 {
89 item = temp; 92 item = temp;
90 } 93 }
91 return item; 94 return item;
92} 95}
93 96
94void ViewMail::setBody(const RecBodyP&body ) 97void ViewMail::setBody(const RecBodyP&body )
95{ 98{
96 99
97 m_body = body; 100 m_body = body;
98 m_mail[2] = body->Bodytext(); 101 m_mail[2] = body->Bodytext();
99 attachbutton->setEnabled(body->Parts().count()>0); 102 attachbutton->setEnabled(body->Parts().count()>0);
100 attachments->setEnabled(body->Parts().count()>0); 103 attachments->setEnabled(body->Parts().count()>0);
101 if (body->Parts().count()==0) 104 if (body->Parts().count()==0)
102 { 105 {
103 return; 106 return;
104 } 107 }
105 AttachItem * curItem=0; 108 AttachItem * curItem=0;
106 AttachItem * parentItem = 0; 109 AttachItem * parentItem = 0;
107 QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); 110 QString type=body->Description()->Type()+"/"+body->Description()->Subtype();
108 QString desc,fsize; 111 QString desc,fsize;
109 double s = body->Description()->Size(); 112 double s = body->Description()->Size();
110 int w; 113 int w;
111 w=0; 114 w=0;
112 115
113 while (s>1024) 116 while (s>1024)
114 { 117 {
115 s/=1024; 118 s/=1024;
116 ++w; 119 ++w;
117 if (w>=2) break; 120 if (w>=2) break;
118 } 121 }
119 122
120 QString q=""; 123 QString q="";
121 switch(w) 124 switch(w)
122 { 125 {
123 case 1: 126 case 1:
124 q="k"; 127 q="k";
125 break; 128 break;
126 case 2: 129 case 2:
127 q="M"; 130 q="M";
128 break; 131 break;
129 default: 132 default:
130 break; 133 break;
131 } 134 }
132 135
133 { 136 {
134 /* I did not found a method to make a CONTENT reset on a QTextStream 137 /* I did not found a method to make a CONTENT reset on a QTextStream
135 so I use this construct that the stream will re-constructed in each 138 so I use this construct that the stream will re-constructed in each
136 loop. To let it work, the textstream is packed into a own area of 139 loop. To let it work, the textstream is packed into a own area of
137 code is it will be destructed after finishing its small job. 140 code is it will be destructed after finishing its small job.
138 */ 141 */
139 QTextOStream o(&fsize); 142 QTextOStream o(&fsize);
140 if (w>0) o.precision(2); else o.precision(0); 143 if (w>0) o.precision(2); else o.precision(0);
141 o.setf(QTextStream::fixed); 144 o.setf(QTextStream::fixed);
142 o << s << " " << q << "Byte"; 145 o << s << " " << q << "Byte";
143 } 146 }
144 147
145 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); 148 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist());
146 QString filename = ""; 149 QString filename = "";
147 150
148 for (unsigned int i = 0; i < body->Parts().count();++i) 151 for (unsigned int i = 0; i < body->Parts().count();++i)
149 { 152 {
150 filename = ""; 153 filename = "";
151 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); 154 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype();
152 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); 155 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin();
153 for (;it!=body->Parts()[i]->Parameters().end();++it) 156 for (;it!=body->Parts()[i]->Parameters().end();++it)
154 { 157 {
155 if (it.key().lower()=="name") 158 if (it.key().lower()=="name")
156 { 159 {
157 filename=it.data(); 160 filename=it.data();
158 } 161 }
159 } 162 }
160 s = body->Parts()[i]->Size(); 163 s = body->Parts()[i]->Size();
161 w = 0; 164 w = 0;
162 while (s>1024) 165 while (s>1024)
163 { 166 {
164 s/=1024; 167 s/=1024;
165 ++w; 168 ++w;
166 if (w>=2) break; 169 if (w>=2) break;
167 } 170 }
168 switch(w) 171 switch(w)
169 { 172 {
170 case 1: 173 case 1:
171 q="k"; 174 q="k";
172 break; 175 break;
173 case 2: 176 case 2:
174 q="M"; 177 q="M";
175 break; 178 break;
176 default: 179 default:
177 q=""; 180 q="";
178 break; 181 break;
179 } 182 }
180 QTextOStream o(&fsize); 183 QTextOStream o(&fsize);
181 if (w>0) o.precision(2); else o.precision(0); 184 if (w>0) o.precision(2); else o.precision(0);
182 o.setf(QTextStream::fixed); 185 o.setf(QTextStream::fixed);
183 o << s << " " << q << "Byte"; 186 o << s << " " << q << "Byte";
184 desc = body->Parts()[i]->Description(); 187 desc = body->Parts()[i]->Description();
185 parentItem = searchParent(body->Parts()[i]->Positionlist()); 188 parentItem = searchParent(body->Parts()[i]->Positionlist());
186 if (parentItem) 189 if (parentItem)
187 { 190 {
188 AttachItem*temp = lastChild(parentItem); 191 AttachItem*temp = lastChild(parentItem);
189 if (temp) curItem = temp; 192 if (temp) curItem = temp;
190 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 193 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
191 attachments->setRootIsDecorated(true); 194 attachments->setRootIsDecorated(true);
192 curItem = parentItem; 195 curItem = parentItem;
193 } 196 }
194 else 197 else
195 { 198 {
196 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 199 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
197 } 200 }
198 } 201 }
199} 202}
200 203
201 204
202void ViewMail::slotShowHtml( bool state ) 205void ViewMail::slotShowHtml( bool state )
203{ 206{
204 m_showHtml = state; 207 m_showHtml = state;
205 setText(); 208 setText();
206} 209}
207 210
208void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) 211void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
209{ 212{
210 if (!item ) 213 if (!item )
211 return; 214 return;
212 215
213 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 216 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
214 { 217 {
215 setText(); 218 setText();
216 return; 219 return;
217 } 220 }
218 QPopupMenu *menu = new QPopupMenu(); 221 QPopupMenu *menu = new QPopupMenu();
219 int ret=0; 222 int ret=0;
220 223
221 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 224 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
222 { 225 {
223 menu->insertItem( i18n( "Show Text" ), 1 ); 226 menu->insertItem( i18n( "Show Text" ), 1 );
224 } 227 }
225 if (item->text(0).left(6)=="image/") { 228 if (item->text(0).left(6)=="image/") {
226 menu->insertItem(i18n("Display image preview"),2); 229 menu->insertItem(i18n("Display image preview"),2);
227 } 230 }
228 menu->insertItem( i18n( "Save Attachment" ), 0 ); 231 menu->insertItem( i18n( "Save Attachment" ), 0 );
229 menu->insertSeparator(1); 232 menu->insertSeparator(1);
230 233
231 ret = menu->exec( point, 0 ); 234 ret = menu->exec( point, 0 );
232 235
233 switch(ret) 236 switch(ret)
234 { 237 {
235 case 0: 238 case 0:
236 { 239 {
237 //MimeTypes types; 240 //MimeTypes types;
238 //types.insert( "all", "*" ); 241 //types.insert( "all", "*" );
239 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); 242 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this );
240 243
241 if( !str.isEmpty() ) 244 if( !str.isEmpty() )
242 { 245 {
243 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 246 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
244 if (content) 247 if (content)
245 { 248 {
246 QFile output(str); 249 QFile output(str);
247 output.open(IO_WriteOnly); 250 output.open(IO_WriteOnly);
248 output.writeBlock(content->Content(),content->Length()); 251 output.writeBlock(content->Content(),content->Length());
249 output.close(); 252 output.close();
250 delete content; 253 delete content;
251 } 254 }
252 } 255 }
253 } 256 }
254 break ; 257 break ;
255 258
256 case 2: 259 case 2:
257 { 260 {
258#ifdef DESKTOP_VERSION 261#ifdef DESKTOP_VERSION
259 QString tmpfile = locateLocal( "tmp", "opiemail-image"); 262 QString tmpfile = locateLocal( "tmp", "opiemail-image");
260#else 263#else
261 QString tmpfile = "/tmp/opiemail-image"; 264 QString tmpfile = "/tmp/opiemail-image";
262#endif 265#endif
263 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 266 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
264 if (content) { 267 if (content) {
265 QFile output(tmpfile); 268 QFile output(tmpfile);
266 output.open(IO_WriteOnly); 269 output.open(IO_WriteOnly);
267 output.writeBlock(content->Content(),content->Length()); 270 output.writeBlock(content->Content(),content->Length());
268 output.close(); 271 output.close();
269 delete content; 272 delete content;
270 MailImageDlg iview(""); 273 MailImageDlg iview("");
271 iview.setName(tmpfile); 274 iview.setName(tmpfile);
272 KApplication::execDialog(&iview); 275 KApplication::execDialog(&iview);
273 output.remove(); 276 output.remove();
274 } 277 }
275 } 278 }
276 break; 279 break;
277 case 1: 280 case 1:
278 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 281 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
279 { 282 {
280 setText(); 283 setText();
281 } 284 }
282 else 285 else
283 { 286 {
284 if ( m_recMail->Wrapper() != 0l ) 287 if ( m_recMail->Wrapper() != 0l )
285 { // make sure that there is a wrapper , even after delete or simular actions 288 { // make sure that there is a wrapper , even after delete or simular actions
286 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 289 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
287 } 290 }
288 } 291 }
289 break; 292 break;
290 } 293 }
291 delete menu; 294 delete menu;
292} 295}
293 296
294 297
295void ViewMail::setMail(const RecMailP&mail ) 298void ViewMail::setMail(const RecMailP&mail )
296{ 299{
297 300
298 m_recMail = mail; 301 m_recMail = mail;
299 302
300 m_mail[0] = mail->getFrom(); 303 m_mail[0] = mail->getFrom();
301 m_mail[1] = mail->getSubject(); 304 m_mail[1] = mail->getSubject();
302 m_mail[3] = mail->getDate(); 305 m_mail[3] = mail->getDate();
303 m_mail[4] = mail->Msgid(); 306 m_mail[4] = mail->Msgid();
304 307
305 m_mail2[0] = mail->To(); 308 m_mail2[0] = mail->To();
306 m_mail2[1] = mail->CC(); 309 m_mail2[1] = mail->CC();
307 m_mail2[2] = mail->Bcc(); 310 m_mail2[2] = mail->Bcc();
308 311
309 setText(); 312 setText();
310} 313}
311 314
312 315
313 316
314ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 317ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
315 : ViewMailBase(parent, name, fl), _inLoop(false) 318 : ViewMailBase(parent, name, fl), _inLoop(false)
316{ 319{
317 m_gotBody = false; 320 m_gotBody = false;
318 deleted = false; 321 deleted = false;
319 322
320 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 323 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
321 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 324 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
322 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 325 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
323 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 326 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
324 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 327 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
325 328
326 attachments->setEnabled(m_gotBody); 329 attachments->setEnabled(m_gotBody);
327 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 330 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
328 331
329 readConfig(); 332 readConfig();
330 attachments->setSorting(-1); 333 attachments->setSorting(-1);
331} 334}
332 335
333void ViewMail::readConfig() 336void ViewMail::readConfig()
334{ 337{
335 338
336 setFont ( KOPrefs::instance()->mReadFont ); 339 setFont ( KOPrefs::instance()->mReadFont );
337 m_showHtml = KOPrefs::instance()->mViewAsHtml; 340 m_showHtml = KOPrefs::instance()->mViewAsHtml;
338 showHtml->setOn( m_showHtml ); 341 showHtml->setOn( m_showHtml );
339} 342}
340 343
341void ViewMail::setText() 344void ViewMail::setText()
342{ 345{
343 346
344 QString toString; 347 QString toString;
345 QString ccString; 348 QString ccString;
346 QString bccString; 349 QString bccString;
347 350
348 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) 351 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
349 { 352 {
350 toString += (*it); 353 toString += (*it);
351 } 354 }
352 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) 355 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it )
353 { 356 {
354 ccString += (*it); 357 ccString += (*it);
355 } 358 }
356 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) 359 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it )
357 { 360 {
358 bccString += (*it); 361 bccString += (*it);
359 } 362 }
360 363
361 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); 364 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) );
362 365
363 m_mailHtml = "<html><body>" 366 m_mailHtml = "<html><body>"
364 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 367 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
365 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 368 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
366 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 369 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
367 "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 370 "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
368 "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 371 "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
369 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 372 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
370 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + 373 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] +
371 "</td></tr></table><font>"; 374 "</td></tr></table><font>";
372 375
373 if ( !m_showHtml ) 376 if ( !m_showHtml )
374 { 377 {
375 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); 378 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
376 } 379 }
377 else 380 else
378 { 381 {
379 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); 382 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
380 } 383 }
381 // remove later in favor of a real handling 384 // remove later in favor of a real handling
382 m_gotBody = true; 385 m_gotBody = true;
383} 386}
384 387
385 388
386ViewMail::~ViewMail() 389ViewMail::~ViewMail()
387{ 390{
388 m_recMail->Wrapper()->cleanMimeCache(); 391 m_recMail->Wrapper()->cleanMimeCache();
389 hide(); 392 hide();
390} 393}
391 394
392void ViewMail::hide() 395void ViewMail::hide()
393{ 396{
394 QWidget::hide(); 397 QWidget::hide();
395 398
396 if (_inLoop) 399 if (_inLoop)
397 { 400 {
398 _inLoop = false; 401 _inLoop = false;
399 qApp->exit_loop(); 402 qApp->exit_loop();
400 403
401 } 404 }
402 405
403} 406}
404 407
405void ViewMail::exec() 408void ViewMail::exec()
406{ 409{
407 show(); 410 show();
408 411
409 if (!_inLoop) 412 if (!_inLoop)
410 { 413 {
411 _inLoop = true; 414 _inLoop = true;
412 qApp->enter_loop(); 415 qApp->enter_loop();
413 } 416 }
414 417
415} 418}
416 419
417QString ViewMail::deHtml(const QString &string) 420QString ViewMail::deHtml(const QString &string)
418{ 421{
419 QString string_ = string; 422 QString string_ = string;
420 string_.replace(QRegExp("&"), "&amp;"); 423 string_.replace(QRegExp("&"), "&amp;");
421 string_.replace(QRegExp("<"), "&lt;"); 424 string_.replace(QRegExp("<"), "&lt;");
422 string_.replace(QRegExp(">"), "&gt;"); 425 string_.replace(QRegExp(">"), "&gt;");
423 string_.replace(QRegExp("\\n"), "<br>"); 426 string_.replace(QRegExp("\\n"), "<br>");
424 return string_; 427 return string_;
425} 428}
426 429
427void ViewMail::slotReply() 430void ViewMail::slotReply()
428{ 431{
429 if (!m_gotBody) 432 if (!m_gotBody)
430 { 433 {
431 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); 434 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok"));
432 return; 435 return;
433 } 436 }
434 437
435 QString rtext; 438 QString rtext;
436 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 439 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
437 .arg( m_mail[0] ) 440 .arg( m_mail[0] )
438 .arg( m_mail[3] ); 441 .arg( m_mail[3] );
439 442
440 QString text = m_mail[2]; 443 QString text = m_mail[2];
441 QStringList lines = QStringList::split(QRegExp("\\n"), text); 444 QStringList lines = QStringList::split(QRegExp("\\n"), text);
442 QStringList::Iterator it; 445 QStringList::Iterator it;
443 for (it = lines.begin(); it != lines.end(); it++) 446 for (it = lines.begin(); it != lines.end(); it++)
444 { 447 {
445 rtext += "> " + *it + "\n"; 448 rtext += "> " + *it + "\n";
446 } 449 }
447 rtext += "\n"; 450 rtext += "\n";
448 451
449 QString prefix; 452 QString prefix;
450 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; 453 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
451 else prefix = "Re: "; // no i18n on purpose 454 else prefix = "Re: "; // no i18n on purpose
452 455
453 Settings *settings = new Settings(); 456 Settings *settings = new Settings();
454 ComposeMail composer( settings ,this, 0, true); 457 ComposeMail composer( settings ,this, 0, true);
455 if (m_recMail->Replyto().isEmpty()) { 458 if (m_recMail->Replyto().isEmpty()) {
456 composer.setTo( m_recMail->getFrom()); 459 composer.setTo( m_recMail->getFrom());
457 } else { 460 } else {
458 composer.setTo( m_recMail->Replyto()); 461 composer.setTo( m_recMail->Replyto());
459 } 462 }
460 composer.setSubject( prefix + m_mail[1] ); 463 composer.setSubject( prefix + m_mail[1] );
461 composer.setMessage( rtext ); 464 composer.setMessage( rtext );
462 composer.setInReplyTo(m_recMail->Msgid()); 465 composer.setInReplyTo(m_recMail->Msgid());
463 466
464 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 467 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
465 { 468 {
466 m_recMail->Wrapper()->answeredMail(m_recMail); 469 m_recMail->Wrapper()->answeredMail(m_recMail);
467 } 470 }
468} 471}
469 472
470void ViewMail::slotForward() 473void ViewMail::slotForward()
471{ 474{
472 if (!m_gotBody) 475 if (!m_gotBody)
473 { 476 {
474 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); 477 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok"));
475 return; 478 return;
476 } 479 }
477 480
478 QString ftext; 481 QString ftext;
479 ftext += QString("\n----- Forwarded message from %1 -----\n\n") 482 ftext += QString("\n----- Forwarded message from %1 -----\n\n")
480 .arg( m_mail[0] ); 483 .arg( m_mail[0] );
481 if (!m_mail[3].isNull()) 484 if (!m_mail[3].isNull())
482 ftext += QString("Date: %1\n") 485 ftext += QString("Date: %1\n")
483 .arg( m_mail[3] ); 486 .arg( m_mail[3] );
484 if (!m_mail[0].isNull()) 487 if (!m_mail[0].isNull())
485 ftext += QString("From: %1\n") 488 ftext += QString("From: %1\n")
486 .arg( m_mail[0] ); 489 .arg( m_mail[0] );
487 if (!m_mail[1].isNull()) 490 if (!m_mail[1].isNull())
488 ftext += QString("Subject: %1\n") 491 ftext += QString("Subject: %1\n")
489 .arg( m_mail[1] ); 492 .arg( m_mail[1] );
490 493
491 ftext += QString("\n%1\n") 494 ftext += QString("\n%1\n")
492 .arg( m_mail[2]); 495 .arg( m_mail[2]);
493 496
494 ftext += QString("----- End forwarded message -----\n"); 497 ftext += QString("----- End forwarded message -----\n");
495 498
496 Settings *settings = new Settings(); 499 Settings *settings = new Settings();
497 ComposeMail composer( settings ,this, 0, true); 500 ComposeMail composer( settings ,this, 0, true);
498 composer.setSubject( "Fwd: " + m_mail[1] ); 501 composer.setSubject( "Fwd: " + m_mail[1] );
499 composer.setMessage( ftext ); 502 composer.setMessage( ftext );
500 if ( QDialog::Accepted == KApplication::execDialog( &composer )) 503 if ( QDialog::Accepted == KApplication::execDialog( &composer ))
501 { 504 {
502 } 505 }
503} 506}
504 507
505void ViewMail::slotDeleteMail( ) 508void ViewMail::slotDeleteMail( )
506{ 509{
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 ) 510 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 { 511 {
509 m_recMail->Wrapper()->deleteMail( m_recMail ); 512 m_recMail->Wrapper()->deleteMail( m_recMail );
510 hide(); 513 hide();
511 deleted = true; 514 deleted = true;
512 } 515 }
513} 516}
514 517
515MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) 518MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
516 : KDialog(parent,name,modal) 519 : QDialog(parent,name,modal)
517{ 520{
518 QVBoxLayout*dlglayout = new QVBoxLayout(this); 521 QVBoxLayout*dlglayout = new QVBoxLayout(this);
519 dlglayout->setSpacing(2); 522 dlglayout->setSpacing(2);
520 dlglayout->setMargin(1); 523 dlglayout->setMargin(1);
521 //m_imageview = new Opie::MM::OImageScrollView(this); 524 //m_imageview = new Opie::MM::OImageScrollView(this);
522 //dlglayout->addWidget(m_imageview); 525 //dlglayout->addWidget(m_imageview);
523} 526}
524 527
525MailImageDlg::~MailImageDlg() 528MailImageDlg::~MailImageDlg()
526{ 529{
527} 530}
528 531
529void MailImageDlg::setName(const QString&fname) 532void MailImageDlg::setName(const QString&fname)
530{ 533{
531 qDebug("viewmail.cpp: MailImageDlg::setName Pending"); 534 qDebug("viewmail.cpp: MailImageDlg::setName Pending");
532 // m_imageview->setImage(fname); 535 // m_imageview->setImage(fname);
533} 536}
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h
index c42577e..194ac8e 100644
--- a/kmicromail/viewmail.h
+++ b/kmicromail/viewmail.h
@@ -1,86 +1,86 @@
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 <kdialog.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 45
46protected: 46protected:
47 QString deHtml(const QString &string); 47 QString deHtml(const QString &string);
48 AttachItem* searchParent(const QValueList<int>&path); 48 AttachItem* searchParent(const QValueList<int>&path);
49 AttachItem* lastChild(AttachItem*parent); 49 AttachItem* lastChild(AttachItem*parent);
50 50
51protected slots: 51protected slots:
52 void slotReply(); 52 void slotReply();
53 void slotForward(); 53 void slotForward();
54 void setText(); 54 void setText();
55 void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); 55 void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
56 void slotDeleteMail( ); 56 void slotDeleteMail( );
57 void slotShowHtml( bool ); 57 void slotShowHtml( bool );
58 58
59private: 59private:
60 void readConfig(); 60 void readConfig();
61 61
62 bool _inLoop; 62 bool _inLoop;
63 QString m_mailHtml; 63 QString m_mailHtml;
64 bool m_gotBody; 64 bool m_gotBody;
65 RecBodyP m_body; 65 RecBodyP m_body;
66 RecMailP m_recMail; 66 RecMailP m_recMail;
67 bool m_showHtml; 67 bool m_showHtml;
68 68
69 // 0 from 1 subject 2 bodytext 3 date 69 // 0 from 1 subject 2 bodytext 3 date
70 QMap <int,QString> m_mail; 70 QMap <int,QString> m_mail;
71 // 0 to 1 cc 2 bcc 71 // 0 to 1 cc 2 bcc
72 QMap <int,QStringList> m_mail2; 72 QMap <int,QStringList> m_mail2;
73}; 73};
74 74
75class MailImageDlg:public KDialog 75class MailImageDlg:public QDialog
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78public: 78public:
79 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); 79 MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0);
80 ~MailImageDlg(); 80 ~MailImageDlg();
81 void setName(const QString&); 81 void setName(const QString&);
82protected: 82protected:
83 //Opie::MM::OImageScrollView*m_imageview; 83 //Opie::MM::OImageScrollView*m_imageview;
84}; 84};
85 85
86#endif 86#endif