author | zautrix <zautrix> | 2004-09-15 06:15:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-15 06:15:59 (UTC) |
commit | 35b8948c6c203473866c74f1d13185a848454e04 (patch) (unidiff) | |
tree | b6d8eca9863cbca8e24d474d8c895065faa17458 | |
parent | f1f43030eefa765950cb501aece6cc71fb4e9859 (diff) | |
download | kdepimpi-35b8948c6c203473866c74f1d13185a848454e04.zip kdepimpi-35b8948c6c203473866c74f1d13185a848454e04.tar.gz kdepimpi-35b8948c6c203473866c74f1d13185a848454e04.tar.bz2 |
Mail config added
-rw-r--r-- | kmicromail/composemail.cpp | 30 | ||||
-rw-r--r-- | kmicromail/composemail.h | 1 | ||||
-rw-r--r-- | kmicromail/kmicromailE.pro | 4 | ||||
-rw-r--r-- | kmicromail/koprefs.cpp | 507 | ||||
-rw-r--r-- | kmicromail/koprefs.cpp~ | 568 | ||||
-rw-r--r-- | kmicromail/koprefs.h | 81 | ||||
-rw-r--r-- | kmicromail/koprefs.h~ | 304 | ||||
-rw-r--r-- | kmicromail/koprefsdialog.cpp | 1706 | ||||
-rw-r--r-- | kmicromail/koprefsdialog.cpp~ | 1609 | ||||
-rw-r--r-- | kmicromail/koprefsdialog.h | 176 | ||||
-rw-r--r-- | kmicromail/koprefsdialog.h~ | 161 | ||||
-rw-r--r-- | kmicromail/main.cpp | 3 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 22 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 3 | ||||
-rw-r--r-- | kmicromail/settingsdialog.cpp | 48 | ||||
-rw-r--r-- | kmicromail/settingsdialog.h | 3 | ||||
-rw-r--r-- | kmicromail/settingsdialogui.ui | 65 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 10 |
18 files changed, 5229 insertions, 72 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 9b799b3..e6f7daa 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,460 +1,478 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | #include "composemail.h" | 3 | #include "composemail.h" |
4 | 4 | ||
5 | #include <libmailwrapper/smtpwrapper.h> | 5 | #include <libmailwrapper/smtpwrapper.h> |
6 | #include <libmailwrapper/storemail.h> | 6 | #include <libmailwrapper/storemail.h> |
7 | #include <libmailwrapper/abstractmail.h> | 7 | #include <libmailwrapper/abstractmail.h> |
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | 9 | ||
10 | /* OPIE */ | 10 | /* OPIE */ |
11 | //#include <opie2/ofiledialog.h> | 11 | //#include <opie2/ofiledialog.h> |
12 | //#include <opie2/odebug.h> | 12 | //#include <opie2/odebug.h> |
13 | #include <kfiledialog.h> | 13 | #include <kfiledialog.h> |
14 | //#include <qpe/resource.h> | 14 | //#include <qpe/resource.h> |
15 | #include <qpe/config.h> | ||
16 | #include <qpe/global.h> | 15 | #include <qpe/global.h> |
17 | //#include <qpe/contact.h> | 16 | //#include <qpe/contact.h> |
18 | 17 | ||
19 | 18 | ||
20 | #include <qcombobox.h> | 19 | #include <qcombobox.h> |
21 | #include <qcheckbox.h> | 20 | #include <qcheckbox.h> |
22 | #include <qtimer.h> | 21 | #include <qtimer.h> |
23 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
24 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
25 | #include <qmultilineedit.h> | 24 | #include <qmultilineedit.h> |
26 | #include <qlabel.h> | 25 | #include <qlabel.h> |
27 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
28 | #include <qlistview.h> | 27 | #include <qlistview.h> |
29 | #include <kabc/addresseedialog.h> | 28 | #include <kabc/addresseedialog.h> |
30 | #include <kabc/stdaddressbook.h> | 29 | #include <kabc/stdaddressbook.h> |
31 | #include <kabc/addressee.h> | 30 | #include <kabc/addressee.h> |
32 | #ifdef DESKTOP_VERSION | 31 | #ifdef DESKTOP_VERSION |
33 | #include <kabc/addresseedialog.h> | 32 | #include <kabc/addresseedialog.h> |
34 | #else //DESKTOP_VERSION | 33 | #else //DESKTOP_VERSION |
35 | #include <libkdepim/externalapphandler.h> | 34 | #include <libkdepim/externalapphandler.h> |
36 | #endif //DESKTOP_VERSION | 35 | #endif //DESKTOP_VERSION |
37 | 36 | ||
37 | #include "koprefs.h" | ||
38 | 38 | ||
39 | //using namespace Opie::Core; | 39 | //using namespace Opie::Core; |
40 | //using namespace Opie::Ui; | 40 | //using namespace Opie::Ui; |
41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) | 41 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) |
42 | : ComposeMailUI( parent, name, modal ) | 42 | : ComposeMailUI( parent, name, modal ) |
43 | { | 43 | { |
44 | |||
45 | mPickLineEdit = 0; | 44 | mPickLineEdit = 0; |
46 | connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), | 45 | 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&))); | 46 | this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
48 | settings = s; | 47 | settings = s; |
49 | m_replyid = ""; | 48 | m_replyid = ""; |
49 | if ( KOPrefs::instance()->mUseKapi) { | ||
50 | KConfig config( locateLocal("config", "kabcrc") ); | 50 | KConfig config( locateLocal("config", "kabcrc") ); |
51 | config.setGroup( "General" ); | 51 | config.setGroup( "General" ); |
52 | QString whoami_uid = config.readEntry( "WhoAmI" ); | 52 | QString whoami_uid = config.readEntry( "WhoAmI" ); |
53 | 53 | ||
54 | if ( whoami_uid.isEmpty() ) { | 54 | if ( whoami_uid.isEmpty() ) { |
55 | QMessageBox::information( 0, tr( "Hint" ), | 55 | QMessageBox::information( 0, tr( "Hint" ), |
56 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 56 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
57 | tr( "Ok" ) ); | 57 | tr( "Ok" ) ); |
58 | 58 | ||
59 | |||
60 | fillSettings(); | ||
59 | } else | 61 | } else |
60 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); | 62 | ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); |
61 | 63 | ||
62 | 64 | ||
63 | #ifdef DESKTOP_VERSION | 65 | #ifdef DESKTOP_VERSION |
64 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 66 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
65 | QStringList mails = con.emails(); | 67 | QStringList mails = con.emails(); |
66 | QString defmail = con.preferredEmail(); | 68 | QString defmail = con.preferredEmail(); |
67 | if ( mails.count() == 0) | 69 | if ( mails.count() == 0) |
68 | QMessageBox::information( 0, tr( "Hint" ), | 70 | QMessageBox::information( 0, tr( "Hint" ), |
69 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 71 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
70 | tr( "Ok" ) ); | 72 | tr( "Ok" ) ); |
71 | if (defmail.length()!=0) { | 73 | if (defmail.length()!=0) { |
72 | fromBox->insertItem(defmail); | 74 | fromBox->insertItem(defmail); |
73 | } | 75 | } |
74 | QStringList::ConstIterator sit = mails.begin(); | 76 | QStringList::ConstIterator sit = mails.begin(); |
75 | for (;sit!=mails.end();++sit) { | 77 | for (;sit!=mails.end();++sit) { |
76 | if ( (*sit)==defmail) | 78 | if ( (*sit)==defmail) |
77 | continue; | 79 | continue; |
78 | fromBox->insertItem((*sit)); | 80 | fromBox->insertItem((*sit)); |
79 | } | 81 | } |
80 | senderNameEdit->setText(con.formattedName()); | 82 | senderNameEdit->setText(con.formattedName()); |
81 | #endif | 83 | #endif |
82 | Config cfg( "mail" ); | 84 | |
83 | cfg.setGroup( "Compose" ); | 85 | } else { |
84 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 86 | fillSettings(); |
87 | } | ||
88 | checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); | ||
85 | 89 | ||
86 | attList->addColumn( tr( "Name" ) ); | 90 | attList->addColumn( tr( "Name" ) ); |
87 | attList->addColumn( tr( "Size" ) ); | 91 | attList->addColumn( tr( "Size" ) ); |
88 | QList<Account> accounts = settings->getAccounts(); | 92 | QList<Account> accounts = settings->getAccounts(); |
89 | 93 | ||
94 | if ( QApplication::desktop()->width() < 320 ) | ||
95 | smtpAccountBox->setMaximumWidth( 80 ); | ||
90 | Account *it; | 96 | Account *it; |
91 | for ( it = accounts.first(); it; it = accounts.next() ) { | 97 | for ( it = accounts.first(); it; it = accounts.next() ) { |
92 | if ( it->getType()==MAILLIB::A_SMTP ) { | 98 | if ( it->getType()==MAILLIB::A_SMTP ) { |
93 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 99 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
94 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 100 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
95 | smtpAccounts.append( smtp ); | 101 | smtpAccounts.append( smtp ); |
96 | } | 102 | } |
97 | } | 103 | } |
98 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 104 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
99 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 105 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
100 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 106 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
101 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 107 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
102 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 108 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
103 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 109 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
104 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 110 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
105 | mMail = 0; | 111 | mMail = 0; |
106 | warnAttach = true; | 112 | warnAttach = true; |
107 | if ( smtpAccounts.count() > 0 ) { | 113 | if ( smtpAccounts.count() > 0 ) { |
108 | fillValues( smtpAccountBox->currentItem() ); | 114 | fillValues( smtpAccountBox->currentItem() ); |
109 | } else { | 115 | } else { |
110 | QMessageBox::information( 0, tr( "Problem" ), | 116 | QMessageBox::information( 0, tr( "Problem" ), |
111 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), | 117 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), |
112 | tr( "Ok" ) ); | 118 | tr( "Ok" ) ); |
113 | return; | 119 | return; |
114 | } | 120 | } |
115 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 121 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
116 | 122 | message->setFont ( KOPrefs::instance()->mComposeFont ); | |
117 | } | 123 | } |
118 | 124 | ||
125 | void ComposeMail::fillSettings() | ||
126 | { | ||
127 | if ( QApplication::desktop()->width() < 320 ) | ||
128 | fromBox->setMaximumWidth( 100 ); | ||
129 | QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); | ||
130 | QStringList::ConstIterator sit = mailList.begin(); | ||
131 | int pref = 0; | ||
132 | for (;sit!=mailList.end();++sit) { | ||
133 | fromBox->insertItem((*sit)); | ||
134 | } | ||
135 | senderNameEdit->setText(KOPrefs::instance()->mName); | ||
136 | } | ||
119 | 137 | ||
120 | 138 | ||
121 | void ComposeMail::saveAsDraft() | 139 | void ComposeMail::saveAsDraft() |
122 | { | 140 | { |
123 | 141 | ||
124 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 142 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
125 | mail->setMail(fromBox->currentText()); | 143 | mail->setMail(fromBox->currentText()); |
126 | mail->setTo( toLine->text() ); | 144 | mail->setTo( toLine->text() ); |
127 | mail->setName(senderNameEdit->text()); | 145 | mail->setName(senderNameEdit->text()); |
128 | mail->setCC( ccLine->text() ); | 146 | mail->setCC( ccLine->text() ); |
129 | mail->setBCC( bccLine->text() ); | 147 | mail->setBCC( bccLine->text() ); |
130 | mail->setReply( replyLine->text() ); | 148 | mail->setReply( replyLine->text() ); |
131 | mail->setSubject( subjectLine->text() ); | 149 | mail->setSubject( subjectLine->text() ); |
132 | if (!m_replyid.isEmpty()) { | 150 | if (!m_replyid.isEmpty()) { |
133 | QStringList ids; | 151 | QStringList ids; |
134 | ids.append(m_replyid); | 152 | ids.append(m_replyid); |
135 | mail->setInreply(ids); | 153 | mail->setInreply(ids); |
136 | } | 154 | } |
137 | QString txt = message->text(); | 155 | QString txt = message->text(); |
138 | if ( !sigMultiLine->text().isEmpty() ) { | 156 | if ( !sigMultiLine->text().isEmpty() ) { |
139 | txt.append( "\n--\n" ); | 157 | txt.append( "\n--\n" ); |
140 | txt.append( sigMultiLine->text() ); | 158 | txt.append( sigMultiLine->text() ); |
141 | } | 159 | } |
142 | mail->setMessage( txt ); | 160 | mail->setMessage( txt ); |
143 | 161 | ||
144 | /* only use the default drafts folder name! */ | 162 | /* only use the default drafts folder name! */ |
145 | Storemail wrapper(AbstractMail::draftFolder()); | 163 | Storemail wrapper(AbstractMail::draftFolder()); |
146 | wrapper.storeMail(mail); | 164 | wrapper.storeMail(mail); |
147 | 165 | ||
148 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 166 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
149 | /* attachments we will ignore! */ | 167 | /* attachments we will ignore! */ |
150 | if ( it != 0 ) { | 168 | if ( it != 0 ) { |
151 | if ( warnAttach ) | 169 | if ( warnAttach ) |
152 | QMessageBox::warning(0,tr("Store message"), | 170 | QMessageBox::warning(0,tr("Store message"), |
153 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 171 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
154 | warnAttach = false; | 172 | warnAttach = false; |
155 | } | 173 | } |
156 | setStatus( tr("Mail saved as draft!") ); | 174 | setStatus( tr("Mail saved as draft!") ); |
157 | } | 175 | } |
158 | void ComposeMail::clearStatus() | 176 | void ComposeMail::clearStatus() |
159 | { | 177 | { |
160 | topLevelWidget()->setCaption( tr("Compose mail") ); | 178 | topLevelWidget()->setCaption( tr("Compose mail") ); |
161 | } | 179 | } |
162 | void ComposeMail::setStatus( QString status ) | 180 | void ComposeMail::setStatus( QString status ) |
163 | { | 181 | { |
164 | topLevelWidget()->setCaption( status ); | 182 | topLevelWidget()->setCaption( status ); |
165 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; | 183 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; |
166 | } | 184 | } |
167 | void ComposeMail::pickAddress( ) | 185 | void ComposeMail::pickAddress( ) |
168 | { | 186 | { |
169 | 187 | ||
170 | QLineEdit *line = mPickLineEdit; | 188 | QLineEdit *line = mPickLineEdit; |
171 | if ( line == 0 ) | 189 | if ( line == 0 ) |
172 | return; | 190 | return; |
173 | #ifdef DESKTOP_VERSION | 191 | #ifdef DESKTOP_VERSION |
174 | //qDebug(" ComposeMail::pickAddress "); | 192 | //qDebug(" ComposeMail::pickAddress "); |
175 | QString names ;//= AddressPicker::getNames(); | 193 | QString names ;//= AddressPicker::getNames(); |
176 | 194 | ||
177 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 195 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
178 | uint i=0; | 196 | uint i=0; |
179 | for (i=0; i < list.count(); i++) { | 197 | for (i=0; i < list.count(); i++) { |
180 | if ( !list[i].preferredEmail().isEmpty()) { | 198 | if ( !list[i].preferredEmail().isEmpty()) { |
181 | if ( ! names.isEmpty() ) | 199 | if ( ! names.isEmpty() ) |
182 | names+= ","; | 200 | names+= ","; |
183 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | 201 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; |
184 | 202 | ||
185 | } | 203 | } |
186 | } | 204 | } |
187 | 205 | ||
188 | 206 | ||
189 | if ( line->text().isEmpty() ) { | 207 | if ( line->text().isEmpty() ) { |
190 | line->setText( names ); | 208 | line->setText( names ); |
191 | } else if ( !names.isEmpty() ) { | 209 | } else if ( !names.isEmpty() ) { |
192 | line->setText( line->text() + ", " + names ); | 210 | line->setText( line->text() + ", " + names ); |
193 | } | 211 | } |
194 | #else | 212 | #else |
195 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); | 213 | bool res = ExternalAppHandler::instance()->requestNameEmailUidListFromKAPI("QPE/Application/ompi", this->name() /* name is here the unique uid*/); |
196 | // the result should now arrive through method insertAttendees | 214 | // the result should now arrive through method insertAttendees |
197 | #endif | 215 | #endif |
198 | } | 216 | } |
199 | //the map includes name/email pairs, that comes from Ka/Pi | 217 | //the map includes name/email pairs, that comes from Ka/Pi |
200 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 218 | void ComposeMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
201 | { | 219 | { |
202 | //qDebug("ComposeMail::insertAttendees "); | 220 | //qDebug("ComposeMail::insertAttendees "); |
203 | raise(); | 221 | raise(); |
204 | 222 | ||
205 | if ( mPickLineEdit == 0 ) { //whoami received | 223 | if ( mPickLineEdit == 0 ) { //whoami received |
206 | QString defmail = uidList[0]; | 224 | QString defmail = uidList[0]; |
207 | if ( emailList.count() == 0 ) | 225 | if ( emailList.count() == 0 ) |
208 | QMessageBox::information( 0, tr( "Hint" ), | 226 | QMessageBox::information( 0, tr( "Hint" ), |
209 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), | 227 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
210 | tr( "Ok" ) ); | 228 | tr( "Ok" ) ); |
211 | if (defmail.length()!=0) { | 229 | if (defmail.length()!=0) { |
212 | fromBox->insertItem(defmail); | 230 | fromBox->insertItem(defmail); |
213 | } | 231 | } |
214 | QStringList::ConstIterator sit = emailList.begin(); | 232 | QStringList::ConstIterator sit = emailList.begin(); |
215 | int pref = 0; | 233 | int pref = 0; |
216 | for (;sit!=emailList.end();++sit) { | 234 | for (;sit!=emailList.end();++sit) { |
217 | if ( (*sit)==defmail) | 235 | if ( (*sit)==defmail) |
218 | continue; | 236 | continue; |
219 | fromBox->insertItem((*sit)); | 237 | fromBox->insertItem((*sit)); |
220 | } | 238 | } |
221 | senderNameEdit->setText(nameList[0]); | 239 | senderNameEdit->setText(nameList[0]); |
222 | return; | 240 | return; |
223 | } | 241 | } |
224 | QString names ; | 242 | QString names ; |
225 | QLineEdit *line = mPickLineEdit; | 243 | QLineEdit *line = mPickLineEdit; |
226 | if (uid == this->name()) | 244 | if (uid == this->name()) |
227 | { | 245 | { |
228 | for ( int i = 0; i < nameList.count(); i++) | 246 | for ( int i = 0; i < nameList.count(); i++) |
229 | { | 247 | { |
230 | QString _name = nameList[i]; | 248 | QString _name = nameList[i]; |
231 | QString _email = emailList[i]; | 249 | QString _email = emailList[i]; |
232 | QString _uid = uidList[i]; | 250 | QString _uid = uidList[i]; |
233 | if ( ! _email.isEmpty() ) { | 251 | if ( ! _email.isEmpty() ) { |
234 | if ( ! names.isEmpty() ) | 252 | if ( ! names.isEmpty() ) |
235 | names+= ","; | 253 | names+= ","; |
236 | names+= "\""+_name +"\"<" +_email +">"; | 254 | names+= "\""+_name +"\"<" +_email +">"; |
237 | } | 255 | } |
238 | } | 256 | } |
239 | } | 257 | } |
240 | if ( line->text().isEmpty() ) { | 258 | if ( line->text().isEmpty() ) { |
241 | line->setText( names ); | 259 | line->setText( names ); |
242 | } else if ( !names.isEmpty() ) { | 260 | } else if ( !names.isEmpty() ) { |
243 | line->setText( line->text() + ", " + names ); | 261 | line->setText( line->text() + ", " + names ); |
244 | } | 262 | } |
245 | } | 263 | } |
246 | 264 | ||
247 | void ComposeMail::setTo( const QString & to ) | 265 | void ComposeMail::setTo( const QString & to ) |
248 | { | 266 | { |
249 | toLine->setText( to ); | 267 | toLine->setText( to ); |
250 | } | 268 | } |
251 | 269 | ||
252 | void ComposeMail::setSubject( const QString & subject ) | 270 | void ComposeMail::setSubject( const QString & subject ) |
253 | { | 271 | { |
254 | subjectLine->setText( subject ); | 272 | subjectLine->setText( subject ); |
255 | } | 273 | } |
256 | 274 | ||
257 | void ComposeMail::setInReplyTo( const QString & messageId ) | 275 | void ComposeMail::setInReplyTo( const QString & messageId ) |
258 | { | 276 | { |
259 | m_replyid = messageId; | 277 | m_replyid = messageId; |
260 | } | 278 | } |
261 | 279 | ||
262 | void ComposeMail::setMessage( const QString & text ) | 280 | void ComposeMail::setMessage( const QString & text ) |
263 | { | 281 | { |
264 | message->setText( text ); | 282 | message->setText( text ); |
265 | } | 283 | } |
266 | 284 | ||
267 | 285 | ||
268 | void ComposeMail::pickAddressTo() | 286 | void ComposeMail::pickAddressTo() |
269 | { | 287 | { |
270 | mPickLineEdit = toLine; | 288 | mPickLineEdit = toLine; |
271 | pickAddress( ); | 289 | pickAddress( ); |
272 | } | 290 | } |
273 | 291 | ||
274 | void ComposeMail::pickAddressCC() | 292 | void ComposeMail::pickAddressCC() |
275 | { | 293 | { |
276 | mPickLineEdit = ccLine; | 294 | mPickLineEdit = ccLine; |
277 | pickAddress( ); | 295 | pickAddress( ); |
278 | } | 296 | } |
279 | 297 | ||
280 | void ComposeMail::pickAddressBCC() | 298 | void ComposeMail::pickAddressBCC() |
281 | { | 299 | { |
282 | mPickLineEdit = bccLine; | 300 | mPickLineEdit = bccLine; |
283 | pickAddress( ); | 301 | pickAddress( ); |
284 | } | 302 | } |
285 | 303 | ||
286 | void ComposeMail::pickAddressReply() | 304 | void ComposeMail::pickAddressReply() |
287 | { | 305 | { |
288 | mPickLineEdit = replyLine; | 306 | mPickLineEdit = replyLine; |
289 | pickAddress( ); | 307 | pickAddress( ); |
290 | } | 308 | } |
291 | 309 | ||
292 | void ComposeMail::fillValues( int ) | 310 | void ComposeMail::fillValues( int ) |
293 | { | 311 | { |
294 | #if 0 | 312 | #if 0 |
295 | SMTPaccount *smtp = smtpAccounts.at( current ); | 313 | SMTPaccount *smtp = smtpAccounts.at( current ); |
296 | ccLine->clear(); | 314 | ccLine->clear(); |
297 | if ( smtp->getUseCC() ) { | 315 | if ( smtp->getUseCC() ) { |
298 | ccLine->setText( smtp->getCC() ); | 316 | ccLine->setText( smtp->getCC() ); |
299 | } | 317 | } |
300 | bccLine->clear(); | 318 | bccLine->clear(); |
301 | if ( smtp->getUseBCC() ) { | 319 | if ( smtp->getUseBCC() ) { |
302 | bccLine->setText( smtp->getBCC() ); | 320 | bccLine->setText( smtp->getBCC() ); |
303 | } | 321 | } |
304 | replyLine->clear(); | 322 | replyLine->clear(); |
305 | if ( smtp->getUseReply() ) { | 323 | if ( smtp->getUseReply() ) { |
306 | replyLine->setText( smtp->getReply() ); | 324 | replyLine->setText( smtp->getReply() ); |
307 | } | 325 | } |
308 | sigMultiLine->setText( smtp->getSignature() ); | 326 | sigMultiLine->setText( smtp->getSignature() ); |
309 | #endif | 327 | #endif |
310 | } | 328 | } |
311 | 329 | ||
312 | void ComposeMail::slotAdjustColumns() | 330 | void ComposeMail::slotAdjustColumns() |
313 | { | 331 | { |
314 | int currPage = tabWidget->currentPageIndex(); | 332 | int currPage = tabWidget->currentPageIndex(); |
315 | 333 | ||
316 | tabWidget->showPage( attachTab ); | 334 | tabWidget->showPage( attachTab ); |
317 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 335 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
318 | attList->setColumnWidth( 1, 80 ); | 336 | attList->setColumnWidth( 1, 80 ); |
319 | 337 | ||
320 | tabWidget->setCurrentPage( currPage ); | 338 | tabWidget->setCurrentPage( currPage ); |
321 | } | 339 | } |
322 | 340 | ||
323 | void ComposeMail::addAttachment() | 341 | void ComposeMail::addAttachment() |
324 | { | 342 | { |
325 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); | 343 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); |
326 | if ( !lnk.isEmpty() ) { | 344 | if ( !lnk.isEmpty() ) { |
327 | Attachment *att = new Attachment( lnk ); | 345 | Attachment *att = new Attachment( lnk ); |
328 | (void) new AttachViewItem( attList, att ); | 346 | (void) new AttachViewItem( attList, att ); |
329 | } | 347 | } |
330 | } | 348 | } |
331 | 349 | ||
332 | void ComposeMail::removeAttachment() | 350 | void ComposeMail::removeAttachment() |
333 | { | 351 | { |
334 | if ( !attList->currentItem() ) { | 352 | if ( !attList->currentItem() ) { |
335 | QMessageBox::information( this, tr( "Error" ), | 353 | QMessageBox::information( this, tr( "Error" ), |
336 | tr( "<p>Please select a File.</p>" ), | 354 | tr( "<p>Please select a File.</p>" ), |
337 | tr( "Ok" ) ); | 355 | tr( "Ok" ) ); |
338 | } else { | 356 | } else { |
339 | attList->takeItem( attList->currentItem() ); | 357 | attList->takeItem( attList->currentItem() ); |
340 | } | 358 | } |
341 | } | 359 | } |
342 | 360 | ||
343 | void ComposeMail::accept() | 361 | void ComposeMail::accept() |
344 | { | 362 | { |
345 | if ( smtpAccountBox->count() == 0 ) { | 363 | if ( smtpAccountBox->count() == 0 ) { |
346 | 364 | ||
347 | reject(); | 365 | reject(); |
348 | return; | 366 | return; |
349 | } | 367 | } |
350 | 368 | ||
351 | if (! checkBoxLater->isChecked() ) { | 369 | if (! checkBoxLater->isChecked() ) { |
352 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), | 370 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), |
353 | tr("Send this message?"), | 371 | tr("Send this message?"), |
354 | tr("Yes"), | 372 | tr("Yes"), |
355 | tr("Cancel")); | 373 | tr("Cancel")); |
356 | 374 | ||
357 | if (yesno == 1) { | 375 | if (yesno == 1) { |
358 | return; | 376 | return; |
359 | } | 377 | } |
360 | } | 378 | } |
361 | #if 0 | 379 | #if 0 |
362 | odebug << "Sending Mail with " | 380 | odebug << "Sending Mail with " |
363 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; | 381 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
364 | #endif | 382 | #endif |
365 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 383 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
366 | 384 | ||
367 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 385 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
368 | mail->setMail(fromBox->currentText()); | 386 | mail->setMail(fromBox->currentText()); |
369 | 387 | ||
370 | if ( !toLine->text().isEmpty() ) { | 388 | if ( !toLine->text().isEmpty() ) { |
371 | mail->setTo( toLine->text() ); | 389 | mail->setTo( toLine->text() ); |
372 | } else { | 390 | } else { |
373 | QMessageBox::warning(0,tr("Sending mail"), | 391 | QMessageBox::warning(0,tr("Sending mail"), |
374 | tr("No Receiver spezified" ) ); | 392 | tr("No Receiver spezified" ) ); |
375 | return; | 393 | return; |
376 | } | 394 | } |
377 | 395 | ||
378 | mail->setName(senderNameEdit->text()); | 396 | mail->setName(senderNameEdit->text()); |
379 | mail->setCC( ccLine->text() ); | 397 | mail->setCC( ccLine->text() ); |
380 | mail->setBCC( bccLine->text() ); | 398 | mail->setBCC( bccLine->text() ); |
381 | mail->setReply( replyLine->text() ); | 399 | mail->setReply( replyLine->text() ); |
382 | mail->setSubject( subjectLine->text() ); | 400 | mail->setSubject( subjectLine->text() ); |
383 | if (!m_replyid.isEmpty()) { | 401 | if (!m_replyid.isEmpty()) { |
384 | QStringList ids; | 402 | QStringList ids; |
385 | ids.append(m_replyid); | 403 | ids.append(m_replyid); |
386 | mail->setInreply(ids); | 404 | mail->setInreply(ids); |
387 | } | 405 | } |
388 | QString txt = message->text(); | 406 | QString txt = message->text(); |
389 | if ( !sigMultiLine->text().isEmpty() ) { | 407 | if ( !sigMultiLine->text().isEmpty() ) { |
390 | txt.append( "\n--\n" ); | 408 | txt.append( "\n--\n" ); |
391 | txt.append( sigMultiLine->text() ); | 409 | txt.append( sigMultiLine->text() ); |
392 | } | 410 | } |
393 | mail->setMessage( txt ); | 411 | mail->setMessage( txt ); |
394 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 412 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
395 | while ( it != 0 ) { | 413 | while ( it != 0 ) { |
396 | mail->addAttachment( it->getAttachment() ); | 414 | mail->addAttachment( it->getAttachment() ); |
397 | it = (AttachViewItem *) it->nextSibling(); | 415 | it = (AttachViewItem *) it->nextSibling(); |
398 | } | 416 | } |
399 | 417 | ||
400 | SMTPwrapper wrapper( smtp ); | 418 | SMTPwrapper wrapper( smtp ); |
401 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) | 419 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) |
402 | setStatus( tr ("Mail sent")); | 420 | setStatus( tr ("Mail sent")); |
403 | else { | 421 | else { |
404 | setStatus( tr ("Error: Something went wrong. Nothing sent")); | 422 | setStatus( tr ("Error: Something went wrong. Nothing sent")); |
405 | return; | 423 | return; |
406 | } | 424 | } |
407 | 425 | ||
408 | 426 | ||
409 | QDialog::accept(); | 427 | QDialog::accept(); |
410 | } | 428 | } |
411 | 429 | ||
412 | void ComposeMail::reject() | 430 | void ComposeMail::reject() |
413 | { | 431 | { |
414 | //qDebug("ComposeMail::reject() "); | 432 | //qDebug("ComposeMail::reject() "); |
415 | int yesno = QMessageBox::warning(0,tr("Store message?"), | 433 | int yesno = QMessageBox::warning(0,tr("Store message?"), |
416 | tr("Store message into drafts?\n"), | 434 | tr("Store message into drafts?\n"), |
417 | tr("Yes"), | 435 | tr("Yes"), |
418 | tr("No")); | 436 | tr("No")); |
419 | 437 | ||
420 | //qDebug("button %d ", yesno); | 438 | //qDebug("button %d ", yesno); |
421 | if (yesno == 0) { | 439 | if (yesno == 0) { |
422 | if ( toLine->text().isEmpty() ) { | 440 | if ( toLine->text().isEmpty() ) { |
423 | QMessageBox::warning(0,tr("Sending mail"), | 441 | QMessageBox::warning(0,tr("Sending mail"), |
424 | tr("No Receiver spezified" ) ); | 442 | tr("No Receiver spezified" ) ); |
425 | return; | 443 | return; |
426 | } | 444 | } |
427 | saveAsDraft(); | 445 | saveAsDraft(); |
428 | } | 446 | } |
429 | if (yesno == 2) { | 447 | if (yesno == 2) { |
430 | qDebug("return "); | 448 | qDebug("return "); |
431 | return; | 449 | return; |
432 | } | 450 | } |
433 | QDialog::reject(); | 451 | QDialog::reject(); |
434 | } | 452 | } |
435 | 453 | ||
436 | ComposeMail::~ComposeMail() | 454 | ComposeMail::~ComposeMail() |
437 | { | 455 | { |
438 | } | 456 | } |
439 | 457 | ||
440 | void ComposeMail::reEditMail(const RecMailP¤t) | 458 | void ComposeMail::reEditMail(const RecMailP¤t) |
441 | { | 459 | { |
442 | RecMailP data = current; | 460 | RecMailP data = current; |
443 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); | 461 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
444 | subjectLine->setText( data->getSubject()); | 462 | subjectLine->setText( data->getSubject()); |
445 | toLine->setText(data->To().join(",")); | 463 | toLine->setText(data->To().join(",")); |
446 | ccLine->setText(data->CC().join(",")); | 464 | ccLine->setText(data->CC().join(",")); |
447 | bccLine->setText(data->Bcc().join(",")); | 465 | bccLine->setText(data->Bcc().join(",")); |
448 | replyLine->setText(data->Replyto()); | 466 | replyLine->setText(data->Replyto()); |
449 | } | 467 | } |
450 | 468 | ||
451 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 469 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
452 | : QListViewItem( parent ) | 470 | : QListViewItem( parent ) |
453 | { | 471 | { |
454 | attachment = att; | 472 | attachment = att; |
455 | if ( !attachment->getPixmap().isNull() ) | 473 | if ( !attachment->getPixmap().isNull() ) |
456 | setPixmap( 0,attachment->getPixmap() ); | 474 | setPixmap( 0,attachment->getPixmap() ); |
457 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 475 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
458 | setText( 1, QString::number( att->getSize() ) ); | 476 | setText( 1, QString::number( att->getSize() ) ); |
459 | } | 477 | } |
460 | 478 | ||
diff --git a/kmicromail/composemail.h b/kmicromail/composemail.h index e20d9e1..0fc41fb 100644 --- a/kmicromail/composemail.h +++ b/kmicromail/composemail.h | |||
@@ -1,90 +1,91 @@ | |||
1 | #ifndef COMPOSEMAIL_H | 1 | #ifndef COMPOSEMAIL_H |
2 | #define COMPOSEMAIL_H | 2 | #define COMPOSEMAIL_H |
3 | 3 | ||
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | 6 | ||
7 | #include "composemailui.h" | 7 | #include "composemailui.h" |
8 | //#include "addresspickerui.h" | 8 | //#include "addresspickerui.h" |
9 | #include <libmailwrapper/settings.h> | 9 | #include <libmailwrapper/settings.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 10 | #include <libmailwrapper/mailwrapper.h> |
11 | 11 | ||
12 | class RecMail; | 12 | class RecMail; |
13 | 13 | ||
14 | #include <opie2/osmartpointer.h> | 14 | #include <opie2/osmartpointer.h> |
15 | #if 0 | 15 | #if 0 |
16 | class AddressPicker : public AddressPickerUI | 16 | class AddressPicker : public AddressPickerUI |
17 | { | 17 | { |
18 | //Q_OBJECT | 18 | //Q_OBJECT |
19 | 19 | ||
20 | public: | 20 | public: |
21 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false ); | 21 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false ); |
22 | static QString getNames(); | 22 | static QString getNames(); |
23 | 23 | ||
24 | protected: | 24 | protected: |
25 | QString selectedNames; | 25 | QString selectedNames; |
26 | void accept(); | 26 | void accept(); |
27 | 27 | ||
28 | }; | 28 | }; |
29 | #endif | 29 | #endif |
30 | class RecMail; | 30 | class RecMail; |
31 | 31 | ||
32 | class ComposeMail : public ComposeMailUI | 32 | class ComposeMail : public ComposeMailUI |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | 37 | ||
38 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false ); | 38 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false ); |
39 | virtual ~ComposeMail(); | 39 | virtual ~ComposeMail(); |
40 | 40 | ||
41 | void reEditMail(const Opie::Core::OSmartPointer<RecMail>¤t); | 41 | void reEditMail(const Opie::Core::OSmartPointer<RecMail>¤t); |
42 | 42 | ||
43 | public slots: | 43 | public slots: |
44 | void slotAdjustColumns(); | 44 | void slotAdjustColumns(); |
45 | 45 | ||
46 | void setTo( const QString & to ); | 46 | void setTo( const QString & to ); |
47 | void setSubject( const QString & subject ); | 47 | void setSubject( const QString & subject ); |
48 | void setInReplyTo( const QString & messageId ); | 48 | void setInReplyTo( const QString & messageId ); |
49 | void setMessage( const QString & text ); | 49 | void setMessage( const QString & text ); |
50 | void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); | 50 | void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); |
51 | 51 | ||
52 | 52 | ||
53 | protected slots: | 53 | protected slots: |
54 | void accept(); | 54 | void accept(); |
55 | void reject(); | 55 | void reject(); |
56 | 56 | ||
57 | private slots: | 57 | private slots: |
58 | void fillValues( int current ); | 58 | void fillValues( int current ); |
59 | void fillSettings(); | ||
59 | void pickAddress(); | 60 | void pickAddress(); |
60 | void pickAddressTo(); | 61 | void pickAddressTo(); |
61 | void pickAddressCC(); | 62 | void pickAddressCC(); |
62 | void pickAddressBCC(); | 63 | void pickAddressBCC(); |
63 | void pickAddressReply(); | 64 | void pickAddressReply(); |
64 | void saveAsDraft(); | 65 | void saveAsDraft(); |
65 | void addAttachment(); | 66 | void addAttachment(); |
66 | void removeAttachment(); | 67 | void removeAttachment(); |
67 | void clearStatus(); | 68 | void clearStatus(); |
68 | void setStatus( QString ); | 69 | void setStatus( QString ); |
69 | 70 | ||
70 | protected: | 71 | protected: |
71 | QLineEdit* mPickLineEdit; | 72 | QLineEdit* mPickLineEdit; |
72 | Opie::Core::OSmartPointer<Mail> mMail; | 73 | Opie::Core::OSmartPointer<Mail> mMail; |
73 | Settings *settings; | 74 | Settings *settings; |
74 | QList<SMTPaccount> smtpAccounts; | 75 | QList<SMTPaccount> smtpAccounts; |
75 | QString m_replyid; | 76 | QString m_replyid; |
76 | bool warnAttach; | 77 | bool warnAttach; |
77 | }; | 78 | }; |
78 | 79 | ||
79 | class AttachViewItem : public QListViewItem | 80 | class AttachViewItem : public QListViewItem |
80 | { | 81 | { |
81 | public: | 82 | public: |
82 | AttachViewItem( QListView *parent, Attachment *att ); | 83 | AttachViewItem( QListView *parent, Attachment *att ); |
83 | Attachment *getAttachment() { return attachment; } | 84 | Attachment *getAttachment() { return attachment; } |
84 | 85 | ||
85 | private: | 86 | private: |
86 | Attachment *attachment; | 87 | Attachment *attachment; |
87 | 88 | ||
88 | }; | 89 | }; |
89 | 90 | ||
90 | #endif | 91 | #endif |
diff --git a/kmicromail/kmicromailE.pro b/kmicromail/kmicromailE.pro index 4fa026d..0d6cf86 100644 --- a/kmicromail/kmicromailE.pro +++ b/kmicromail/kmicromailE.pro | |||
@@ -1,66 +1,70 @@ | |||
1 | CONFIG += qt warn_on | 1 | CONFIG += qt warn_on |
2 | TEMPLATE= app | 2 | TEMPLATE= app |
3 | HEADERS = defines.h \ | 3 | HEADERS = 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 | nntpgroups.h \ | 18 | nntpgroups.h \ |
19 | koprefs.h \ | ||
20 | koprefsdialog.h \ | ||
19 | nntpgroupsdlg.h | 21 | nntpgroupsdlg.h |
20 | 22 | ||
21 | SOURCES = main.cpp \ | 23 | SOURCES = main.cpp \ |
22 | opiemail.cpp \ | 24 | opiemail.cpp \ |
23 | mainwindow.cpp \ | 25 | mainwindow.cpp \ |
24 | accountview.cpp \ | 26 | accountview.cpp \ |
25 | accountitem.cpp \ | 27 | accountitem.cpp \ |
26 | composemail.cpp \ | 28 | composemail.cpp \ |
27 | editaccounts.cpp \ | 29 | editaccounts.cpp \ |
28 | viewmail.cpp \ | 30 | viewmail.cpp \ |
29 | viewmailbase.cpp \ | 31 | viewmailbase.cpp \ |
30 | mailistviewitem.cpp \ | 32 | mailistviewitem.cpp \ |
31 | settingsdialog.cpp \ | 33 | settingsdialog.cpp \ |
32 | statuswidget.cpp \ | 34 | statuswidget.cpp \ |
33 | newmaildir.cpp \ | 35 | newmaildir.cpp \ |
34 | selectstore.cpp \ | 36 | selectstore.cpp \ |
35 | selectsmtp.cpp \ | 37 | selectsmtp.cpp \ |
36 | nntpgroups.cpp \ | 38 | nntpgroups.cpp \ |
39 | koprefs.cpp\ | ||
40 | koprefsdialog.cpp\ | ||
37 | nntpgroupsdlg.cpp | 41 | nntpgroupsdlg.cpp |
38 | 42 | ||
39 | INTERFACES = editaccountsui.ui \ | 43 | INTERFACES = editaccountsui.ui \ |
40 | selectmailtypeui.ui \ | 44 | selectmailtypeui.ui \ |
41 | imapconfigui.ui \ | 45 | imapconfigui.ui \ |
42 | pop3configui.ui \ | 46 | pop3configui.ui \ |
43 | nntpconfigui.ui \ | 47 | nntpconfigui.ui \ |
44 | smtpconfigui.ui \ | 48 | smtpconfigui.ui \ |
45 | composemailui.ui \ | 49 | composemailui.ui \ |
46 | settingsdialogui.ui \ | 50 | settingsdialogui.ui \ |
47 | statuswidgetui.ui \ | 51 | statuswidgetui.ui \ |
48 | newmaildirui.ui \ | 52 | newmaildirui.ui \ |
49 | selectstoreui.ui \ | 53 | selectstoreui.ui \ |
50 | nntpgroupsui.ui | 54 | nntpgroupsui.ui |
51 | 55 | ||
52 | 56 | ||
53 | INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore libetpan/include $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include | 57 | INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore libetpan/include $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include |
54 | LIBS += -L$(QPEDIR)/lib -lkmicromailwrapper -lqpe -lkmicrolibetpan -lmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lmicrokde -lmicroqtcompat -lmicrokabc -lmicrokcal -lmicrokdepim | 58 | LIBS += -L$(QPEDIR)/lib -lkmicromailwrapper -lqpe -lkmicrolibetpan -lmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lmicrokde -lmicroqtcompat -lmicrokabc -lmicrokcal -lmicrokdepim |
55 | LIBS += $(QTOPIALIB) | 59 | LIBS += $(QTOPIALIB) |
56 | #LIBS += -lqtopia | 60 | #LIBS += -lqtopia |
57 | #next line for Zaurus only | 61 | #next line for Zaurus only |
58 | #LIBS += -luuid | 62 | #LIBS += -luuid |
59 | 63 | ||
60 | # | 64 | # |
61 | OBJECTS_DIR = obj/$(PLATFORM) | 65 | OBJECTS_DIR = obj/$(PLATFORM) |
62 | MOC_DIR = moc/$(PLATFORM) | 66 | MOC_DIR = moc/$(PLATFORM) |
63 | DESTDIR=$(QPEDIR)/bin | 67 | DESTDIR=$(QPEDIR)/bin |
64 | TARGET = ompi | 68 | TARGET = ompi |
65 | 69 | ||
66 | 70 | ||
diff --git a/kmicromail/koprefs.cpp b/kmicromail/koprefs.cpp new file mode 100644 index 0000000..6484c45 --- a/dev/null +++ b/kmicromail/koprefs.cpp | |||
@@ -0,0 +1,507 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | |||
24 | #include <time.h> | ||
25 | #ifndef _WIN32_ | ||
26 | #include <unistd.h> | ||
27 | #endif | ||
28 | #include <qdir.h> | ||
29 | #include <qtextstream.h> | ||
30 | #include <qtextcodec.h> | ||
31 | #include <qstring.h> | ||
32 | #include <qregexp.h> | ||
33 | #include <qfont.h> | ||
34 | #include <qcolor.h> | ||
35 | #include <qstringlist.h> | ||
36 | #include <stdlib.h> | ||
37 | |||
38 | #include <kglobal.h> | ||
39 | #include <kconfig.h> | ||
40 | #include <klocale.h> | ||
41 | #include <kdebug.h> | ||
42 | #include <kemailsettings.h> | ||
43 | #include <kstaticdeleter.h> | ||
44 | |||
45 | #include "koprefs.h" | ||
46 | #include "mainwindow.h" | ||
47 | |||
48 | |||
49 | KOPrefs *KOPrefs::mInstance = 0; | ||
50 | static KStaticDeleter<KOPrefs> insd; | ||
51 | |||
52 | KOPrefs::KOPrefs() : | ||
53 | KPimPrefs("kopiemailrc") | ||
54 | { | ||
55 | mAppFont = QFont("helvetica",12); | ||
56 | mComposeFont = QFont("helvetica",12); | ||
57 | mReadFont = QFont("helvetica",12); | ||
58 | |||
59 | KPrefs::setCurrentGroup("General"); | ||
60 | addItemString("SenderName",&mName,i18n ("Please set at") ); | ||
61 | addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); | ||
62 | addItemBool("ViewMailAsHtml",&mViewAsHtml,false); | ||
63 | addItemBool("SendMailLater",&mSendLater,true); | ||
64 | addItemBool("UseKapi",&mUseKapi,false); | ||
65 | |||
66 | KPrefs::setCurrentGroup("Fonts"); | ||
67 | addItemFont("Application Font",&mAppFont); | ||
68 | addItemFont("Compose Font",&mComposeFont); | ||
69 | addItemFont("Read Font",&mReadFont); | ||
70 | |||
71 | #if 0 | ||
72 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); | ||
73 | mDefaultViewFont = QFont("helvetica",10); | ||
74 | mDefaultMonthViewFont = QFont("helvetica",8); | ||
75 | mMarcusBainsFont= QFont("helvetica",10); | ||
76 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | ||
77 | mEditBoxFont = QFont("helvetica",12); | ||
78 | mJornalViewFont = QFont("helvetica",12); | ||
79 | |||
80 | KPrefs::setCurrentGroup("General"); | ||
81 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | ||
82 | |||
83 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | ||
84 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | ||
85 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | ||
86 | addItemBool("ShowIconList",&mShowIconList,true); | ||
87 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | ||
88 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | ||
89 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | ||
90 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | ||
91 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | ||
92 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | ||
93 | addItemBool("ShowIconBack",&mShowIconBack,true); | ||
94 | addItemBool("ShowIconToday",&mShowIconToday,true); | ||
95 | addItemBool("ShowIconForward",&mShowIconForward,true); | ||
96 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | ||
97 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); | ||
98 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | ||
99 | addItemBool("ShowIconNext",&mShowIconNext,true); | ||
100 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | ||
101 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | ||
102 | addItemBool("LanguageChanged",&mLanguageChanged,false); | ||
103 | |||
104 | addItemBool("AskForQuit",&mAskForQuit,false); | ||
105 | |||
106 | #ifndef DESKTOP_VERSION | ||
107 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | ||
108 | #else | ||
109 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | ||
110 | #endif | ||
111 | addItemBool("ToolBarHor",&mToolBarHor, true ); | ||
112 | addItemBool("ToolBarUp",&mToolBarUp, false ); | ||
113 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | ||
114 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | ||
115 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | ||
116 | |||
117 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | ||
118 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | ||
119 | addItemInt("AllDay Size",&mAllDaySize,28); | ||
120 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | ||
121 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | ||
122 | |||
123 | addItemStringList("LocationDefaults",&mLocationDefaults ); | ||
124 | addItemStringList("EventSummary User",&mEventSummaryUser); | ||
125 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | ||
126 | |||
127 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | ||
128 | addItemBool("Enable Project View",&mEnableProjectView,false); | ||
129 | addItemBool("Auto Save",&mAutoSave,false); | ||
130 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | ||
131 | addItemBool("Confirm Deletes",&mConfirm,true); | ||
132 | addItemString("Archive File",&mArchiveFile); | ||
133 | addItemString("Html Export File",&mHtmlExportFile, | ||
134 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | ||
135 | addItemBool("Html With Save",&mHtmlWithSave,false); | ||
136 | |||
137 | KPrefs::setCurrentGroup("Personal Settings"); | ||
138 | |||
139 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | ||
140 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | ||
141 | addItemBool("Bcc",&mBcc,false); | ||
142 | |||
143 | KPrefs::setCurrentGroup("Time & Date"); | ||
144 | |||
145 | // addItemString("Time Zone",&mTimeZone,"+0100"); | ||
146 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); | ||
147 | // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); | ||
148 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | ||
149 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | ||
150 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | ||
151 | |||
152 | |||
153 | addItemInt("Default Start Time",&mStartTime,10); | ||
154 | addItemInt("Default Duration",&mDefaultDuration,2); | ||
155 | addItemInt("Default Alarm Time",&mAlarmTime,3); | ||
156 | addItemInt("Daylight Savings",&mDaylightSavings,0); | ||
157 | KPrefs::setCurrentGroup("AlarmSettings"); | ||
158 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | ||
159 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | ||
160 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | ||
161 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | ||
162 | |||
163 | |||
164 | KPrefs::setCurrentGroup("Calendar"); | ||
165 | |||
166 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | ||
167 | |||
168 | KPrefs::setCurrentGroup("Fonts"); | ||
169 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | ||
170 | addItemFont("TimeBar Font",&mTimeBarFont); | ||
171 | addItemFont("MonthView Font",&mMonthViewFont); | ||
172 | addItemFont("AgendaView Font",&mAgendaViewFont); | ||
173 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | ||
174 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | ||
175 | addItemFont("TodoView Font",&mTodoViewFont); | ||
176 | addItemFont("ListView Font",&mListViewFont); | ||
177 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | ||
178 | addItemFont("EditBox Font",&mEditBoxFont); | ||
179 | addItemFont("JournalView Font",&mJornalViewFont); | ||
180 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | ||
181 | addItemFont("EventView Font",&mEventViewFont); | ||
182 | |||
183 | // KPrefs::setCurrentGroup("SyncProfiles"); | ||
184 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); | ||
185 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); | ||
186 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); | ||
187 | |||
188 | KPrefs::setCurrentGroup("RemoteSyncing"); | ||
189 | // addItemBool("UsePasswd",&mUsePassWd,false); | ||
190 | // addItemBool("WriteBackFile",&mWriteBackFile,true); | ||
191 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); | ||
192 | // addItemBool("AskForPreferences",&mAskForPreferences,true); | ||
193 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | ||
194 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | ||
195 | addItemInt("LastSyncTime",&mLastSyncTime,0); | ||
196 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); | ||
197 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | ||
198 | |||
199 | #ifdef _WIN32_ | ||
200 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | ||
201 | #else | ||
202 | QString hdp= locateLocal("data","korganizer")+"/"; | ||
203 | #endif | ||
204 | // addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); | ||
205 | // addItemString("RemoteUser",&mRemoteUser, "zaurus"); | ||
206 | // addItemString("RemotePassWd",&mRemotePassWd, ""); | ||
207 | // addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); | ||
208 | // addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); | ||
209 | |||
210 | |||
211 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | ||
212 | |||
213 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | ||
214 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | ||
215 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | ||
216 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | ||
217 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | ||
218 | |||
219 | |||
220 | KPrefs::setCurrentGroup("Locale"); | ||
221 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | ||
222 | addItemInt("PreferredTime",&mPreferredTime,0); | ||
223 | addItemInt("PreferredDate",&mPreferredDate,0); | ||
224 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | ||
225 | addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); | ||
226 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | ||
227 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | ||
228 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | ||
229 | |||
230 | |||
231 | KPrefs::setCurrentGroup("Colors"); | ||
232 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | ||
233 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | ||
234 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | ||
235 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | ||
236 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | ||
237 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | ||
238 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | ||
239 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | ||
240 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | ||
241 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | ||
242 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | ||
243 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | ||
244 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | ||
245 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | ||
246 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | ||
247 | addItemBool("UseAppColors",&mUseAppColors,false); | ||
248 | |||
249 | |||
250 | |||
251 | KPrefs::setCurrentGroup("Views"); | ||
252 | addItemInt("Hour Size",&mHourSize,8); | ||
253 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | ||
254 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | ||
255 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | ||
256 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | ||
257 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | ||
258 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | ||
259 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | ||
260 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | ||
261 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | ||
262 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | ||
263 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | ||
264 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); | ||
265 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | ||
266 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | ||
267 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | ||
268 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | ||
269 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); | ||
270 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | ||
271 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | ||
272 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | ||
273 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | ||
274 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | ||
275 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); | ||
276 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | ||
277 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | ||
278 | #ifdef DESKTOP_VERSION | ||
279 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | ||
280 | #else | ||
281 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | ||
282 | #endif | ||
283 | addItemInt("Day Begins",&mDayBegins,7); | ||
284 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | ||
285 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | ||
286 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | ||
287 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | ||
288 | |||
289 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | ||
290 | addItemBool("Full View Month",&mFullViewMonth,true); | ||
291 | addItemBool("Full View Todo",&mFullViewTodo,true); | ||
292 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | ||
293 | |||
294 | addItemInt("Next X Days",&mNextXDays,3); | ||
295 | |||
296 | KPrefs::setCurrentGroup("Printer"); | ||
297 | |||
298 | KPrefs::setCurrentGroup("Layout"); | ||
299 | |||
300 | addItemBool("CompactDialogs",&mCompactDialogs,false); | ||
301 | addItemBool("VerticalScreen",&mVerticalScreen,true); | ||
302 | |||
303 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | ||
304 | |||
305 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | ||
306 | |||
307 | KPrefs::setCurrentGroup("Group Scheduling"); | ||
308 | |||
309 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | ||
310 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | ||
311 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | ||
312 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | ||
313 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | ||
314 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | ||
315 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | ||
316 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | ||
317 | |||
318 | KPrefs::setCurrentGroup( "Editors" ); | ||
319 | |||
320 | addItemStringList( "EventTemplates", &mEventTemplates ); | ||
321 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | ||
322 | |||
323 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | ||
324 | |||
325 | #endif | ||
326 | |||
327 | } | ||
328 | |||
329 | |||
330 | KOPrefs::~KOPrefs() | ||
331 | { | ||
332 | if (mInstance == this) | ||
333 | mInstance = insd.setObject(0); | ||
334 | #if 0 | ||
335 | setLocaleDict( 0 ); | ||
336 | if ( mLocaleDict ) | ||
337 | delete mLocaleDict; | ||
338 | //qDebug("KOPrefs::~KOPrefs() "); | ||
339 | #endif | ||
340 | } | ||
341 | |||
342 | |||
343 | KOPrefs *KOPrefs::instance() | ||
344 | { | ||
345 | if (!mInstance) { | ||
346 | mInstance = insd.setObject(new KOPrefs()); | ||
347 | mInstance->readConfig(); | ||
348 | } | ||
349 | |||
350 | return mInstance; | ||
351 | } | ||
352 | |||
353 | void KOPrefs::usrSetDefaults() | ||
354 | { | ||
355 | |||
356 | } | ||
357 | |||
358 | void KOPrefs::fillMailDefaults() | ||
359 | { | ||
360 | if (mName.isEmpty()) mName = i18n("Anonymous"); | ||
361 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | ||
362 | } | ||
363 | |||
364 | void KOPrefs::setTimeZoneIdDefault() | ||
365 | { | ||
366 | mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); | ||
367 | } | ||
368 | |||
369 | |||
370 | void KOPrefs::usrReadConfig() | ||
371 | { | ||
372 | #if 0 | ||
373 | mLocaleDict = 0; | ||
374 | // pending LR fix translation | ||
375 | // qDebug("KOPrefs::usrReadConfig() fix translation "); | ||
376 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { | ||
377 | if ( mPreferredLanguage == 1 ) { | ||
378 | mLocaleDict = new QDict<QString>; | ||
379 | int i = 0; | ||
380 | QString fw ( germanwords[i] [0]); | ||
381 | while ( !fw.isEmpty() ) { | ||
382 | mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); | ||
383 | ++i; | ||
384 | fw = germanwords[i] [0]; | ||
385 | } | ||
386 | |||
387 | setLocaleDict( mLocaleDict ); | ||
388 | } else { | ||
389 | QString fileName ; | ||
390 | if ( mPreferredLanguage == 3 ) | ||
391 | fileName = MainWindow::resourcePath()+"usertranslation.txt"; | ||
392 | else if ( mPreferredLanguage == 2 ) | ||
393 | fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; | ||
394 | QFile file( fileName ); | ||
395 | if (file.open( IO_ReadOnly ) ) { | ||
396 | QTextStream ts( &file ); | ||
397 | ts.setEncoding( QTextStream::Latin1 ); | ||
398 | //ts.setCodec( QTextCodec::latin1 ); | ||
399 | QString text = ts.read(); | ||
400 | file.close(); | ||
401 | text.replace( QRegExp("\\\\n"), "\n" ); | ||
402 | QString line; | ||
403 | QString we; | ||
404 | QString wt; | ||
405 | int br = 0; | ||
406 | int nbr; | ||
407 | nbr = text.find ( "},", br ); | ||
408 | line = text.mid( br, nbr - br ); | ||
409 | br = nbr+1; | ||
410 | int se, ee, st, et; | ||
411 | mLocaleDict = new QDict<QString>; | ||
412 | QString end = "{ \"\",\"\" }"; | ||
413 | while ( (line != end) && (br > 1) ) { | ||
414 | //qDebug("%d *%s* ", br, line.latin1()); | ||
415 | se = line.find("\"")+1; | ||
416 | et = line.findRev("\"",-1); | ||
417 | ee = line.find("\",\""); | ||
418 | st = ee+3; | ||
419 | we = line.mid( se, ee-se ); | ||
420 | wt = line.mid( st, et-st ); | ||
421 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | ||
422 | mLocaleDict->insert( we, new QString (wt) ); | ||
423 | nbr = text.find ( "}", br ); | ||
424 | line = text.mid( br, nbr - br ); | ||
425 | br = nbr+1; | ||
426 | } | ||
427 | //qDebug("end *%s* ", end.latin1()); | ||
428 | |||
429 | setLocaleDict( mLocaleDict ); | ||
430 | } else { | ||
431 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | ||
432 | } | ||
433 | |||
434 | } | ||
435 | } | ||
436 | config()->setGroup("General"); | ||
437 | |||
438 | mCustomCategories = config()->readListEntry("Custom Categories"); | ||
439 | if ( KOPrefs::instance()->mLanguageChanged ) { | ||
440 | mLocationDefaults.clear(); | ||
441 | mEventSummaryUser.clear(); | ||
442 | mTodoSummaryUser.clear(); | ||
443 | } | ||
444 | if (mLocationDefaults.isEmpty()) { | ||
445 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | ||
446 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | ||
447 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | ||
448 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | ||
449 | mLocationDefaults.sort(); | ||
450 | } | ||
451 | |||
452 | if (mEventSummaryUser.isEmpty()) { | ||
453 | mEventSummaryUser = getDefaultList() ; | ||
454 | } | ||
455 | if (mTodoSummaryUser.isEmpty()) { | ||
456 | mTodoSummaryUser = getDefaultList() ; | ||
457 | } | ||
458 | |||
459 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | ||
460 | |||
461 | config()->setGroup("Personal Settings"); | ||
462 | mName = config()->readEntry("user_name",""); | ||
463 | mEmail = config()->readEntry("user_email",""); | ||
464 | fillMailDefaults(); | ||
465 | |||
466 | config()->setGroup("Category Colors"); | ||
467 | QStringList::Iterator it; | ||
468 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | ||
469 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | ||
470 | |||
471 | } | ||
472 | |||
473 | if (mTimeZoneId.isEmpty()) { | ||
474 | setTimeZoneIdDefault(); | ||
475 | } | ||
476 | #endif | ||
477 | KPimPrefs::usrReadConfig(); | ||
478 | } | ||
479 | |||
480 | |||
481 | void KOPrefs::usrWriteConfig() | ||
482 | { | ||
483 | #if 0 | ||
484 | config()->setGroup("General"); | ||
485 | config()->writeEntry("Custom Categories",mCustomCategories); | ||
486 | |||
487 | config()->setGroup("Personal Settings"); | ||
488 | config()->writeEntry("user_name",mName); | ||
489 | config()->writeEntry("user_email",mEmail); | ||
490 | |||
491 | config()->setGroup("Category Colors"); | ||
492 | QDictIterator<QColor> it(mCategoryColors); | ||
493 | while (it.current()) { | ||
494 | config()->writeEntry(it.currentKey(),*(it.current())); | ||
495 | ++it; | ||
496 | } | ||
497 | |||
498 | #endif | ||
499 | KPimPrefs::usrWriteConfig(); | ||
500 | } | ||
501 | |||
502 | |||
503 | |||
504 | KConfig* KOPrefs::getConfig() | ||
505 | { | ||
506 | return config(); | ||
507 | } | ||
diff --git a/kmicromail/koprefs.cpp~ b/kmicromail/koprefs.cpp~ new file mode 100644 index 0000000..dd978bf --- a/dev/null +++ b/kmicromail/koprefs.cpp~ | |||
@@ -0,0 +1,568 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | |||
24 | #include <time.h> | ||
25 | #ifndef _WIN32_ | ||
26 | #include <unistd.h> | ||
27 | #endif | ||
28 | #include <qdir.h> | ||
29 | #include <qtextstream.h> | ||
30 | #include <qtextcodec.h> | ||
31 | #include <qstring.h> | ||
32 | #include <qregexp.h> | ||
33 | #include <qfont.h> | ||
34 | #include <qcolor.h> | ||
35 | #include <qstringlist.h> | ||
36 | #include <stdlib.h> | ||
37 | |||
38 | #include <kglobal.h> | ||
39 | #include <kconfig.h> | ||
40 | #include <klocale.h> | ||
41 | #include <kdebug.h> | ||
42 | #include <kemailsettings.h> | ||
43 | #include <kstaticdeleter.h> | ||
44 | |||
45 | #include "koprefs.h" | ||
46 | #include "mainwindow.h" | ||
47 | |||
48 | const char *germanwords[][2] = { | ||
49 | #include "wordsgerman.h" | ||
50 | "", "" | ||
51 | }; | ||
52 | |||
53 | KOPrefs *KOPrefs::mInstance = 0; | ||
54 | static KStaticDeleter<KOPrefs> insd; | ||
55 | |||
56 | KOPrefs::KOPrefs() : | ||
57 | KPimPrefs("korganizerrc") | ||
58 | { | ||
59 | mCategoryColors.setAutoDelete(true); | ||
60 | mLocaleDict = 0; | ||
61 | fillMailDefaults(); | ||
62 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | ||
63 | QColor defaultHolidayColor = QColor(255,0,0); | ||
64 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | ||
65 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | ||
66 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | ||
67 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | ||
68 | QColor defaultTodoOverdueColor = QColor(255,153,125); | ||
69 | |||
70 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); | ||
71 | mDefaultViewFont = QFont("helvetica",10); | ||
72 | mDefaultMonthViewFont = QFont("helvetica",8); | ||
73 | mMarcusBainsFont= QFont("helvetica",10); | ||
74 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | ||
75 | mEditBoxFont = QFont("helvetica",12); | ||
76 | mJornalViewFont = QFont("helvetica",12); | ||
77 | |||
78 | KPrefs::setCurrentGroup("General"); | ||
79 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | ||
80 | |||
81 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | ||
82 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | ||
83 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | ||
84 | addItemBool("ShowIconList",&mShowIconList,true); | ||
85 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | ||
86 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | ||
87 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | ||
88 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | ||
89 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | ||
90 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | ||
91 | addItemBool("ShowIconBack",&mShowIconBack,true); | ||
92 | addItemBool("ShowIconToday",&mShowIconToday,true); | ||
93 | addItemBool("ShowIconForward",&mShowIconForward,true); | ||
94 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | ||
95 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); | ||
96 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | ||
97 | addItemBool("ShowIconNext",&mShowIconNext,true); | ||
98 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | ||
99 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | ||
100 | addItemBool("LanguageChanged",&mLanguageChanged,false); | ||
101 | |||
102 | addItemBool("AskForQuit",&mAskForQuit,false); | ||
103 | |||
104 | #ifndef DESKTOP_VERSION | ||
105 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | ||
106 | #else | ||
107 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | ||
108 | #endif | ||
109 | addItemBool("ToolBarHor",&mToolBarHor, true ); | ||
110 | addItemBool("ToolBarUp",&mToolBarUp, false ); | ||
111 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | ||
112 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | ||
113 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | ||
114 | |||
115 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | ||
116 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | ||
117 | addItemInt("AllDay Size",&mAllDaySize,28); | ||
118 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | ||
119 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | ||
120 | |||
121 | addItemStringList("LocationDefaults",&mLocationDefaults ); | ||
122 | addItemStringList("EventSummary User",&mEventSummaryUser); | ||
123 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | ||
124 | |||
125 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | ||
126 | addItemBool("Enable Project View",&mEnableProjectView,false); | ||
127 | addItemBool("Auto Save",&mAutoSave,false); | ||
128 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | ||
129 | addItemBool("Confirm Deletes",&mConfirm,true); | ||
130 | addItemString("Archive File",&mArchiveFile); | ||
131 | addItemString("Html Export File",&mHtmlExportFile, | ||
132 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | ||
133 | addItemBool("Html With Save",&mHtmlWithSave,false); | ||
134 | |||
135 | KPrefs::setCurrentGroup("Personal Settings"); | ||
136 | |||
137 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | ||
138 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | ||
139 | addItemBool("Bcc",&mBcc,false); | ||
140 | |||
141 | KPrefs::setCurrentGroup("Time & Date"); | ||
142 | |||
143 | // addItemString("Time Zone",&mTimeZone,"+0100"); | ||
144 | addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); | ||
145 | // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); | ||
146 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | ||
147 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | ||
148 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | ||
149 | |||
150 | |||
151 | addItemInt("Default Start Time",&mStartTime,10); | ||
152 | addItemInt("Default Duration",&mDefaultDuration,2); | ||
153 | addItemInt("Default Alarm Time",&mAlarmTime,3); | ||
154 | addItemInt("Daylight Savings",&mDaylightSavings,0); | ||
155 | KPrefs::setCurrentGroup("AlarmSettings"); | ||
156 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | ||
157 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | ||
158 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | ||
159 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | ||
160 | |||
161 | |||
162 | KPrefs::setCurrentGroup("Calendar"); | ||
163 | |||
164 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | ||
165 | |||
166 | KPrefs::setCurrentGroup("Fonts"); | ||
167 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | ||
168 | addItemFont("TimeBar Font",&mTimeBarFont); | ||
169 | addItemFont("MonthView Font",&mMonthViewFont); | ||
170 | addItemFont("AgendaView Font",&mAgendaViewFont); | ||
171 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | ||
172 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | ||
173 | addItemFont("TodoView Font",&mTodoViewFont); | ||
174 | addItemFont("ListView Font",&mListViewFont); | ||
175 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | ||
176 | addItemFont("EditBox Font",&mEditBoxFont); | ||
177 | addItemFont("JournalView Font",&mJornalViewFont); | ||
178 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | ||
179 | addItemFont("EventView Font",&mEventViewFont); | ||
180 | |||
181 | // KPrefs::setCurrentGroup("SyncProfiles"); | ||
182 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); | ||
183 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); | ||
184 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); | ||
185 | |||
186 | KPrefs::setCurrentGroup("RemoteSyncing"); | ||
187 | // addItemBool("UsePasswd",&mUsePassWd,false); | ||
188 | // addItemBool("WriteBackFile",&mWriteBackFile,true); | ||
189 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); | ||
190 | // addItemBool("AskForPreferences",&mAskForPreferences,true); | ||
191 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | ||
192 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | ||
193 | addItemInt("LastSyncTime",&mLastSyncTime,0); | ||
194 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); | ||
195 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | ||
196 | |||
197 | #ifdef _WIN32_ | ||
198 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | ||
199 | #else | ||
200 | QString hdp= locateLocal("data","korganizer")+"/"; | ||
201 | #endif | ||
202 | // addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); | ||
203 | // addItemString("RemoteUser",&mRemoteUser, "zaurus"); | ||
204 | // addItemString("RemotePassWd",&mRemotePassWd, ""); | ||
205 | // addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); | ||
206 | // addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); | ||
207 | |||
208 | |||
209 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | ||
210 | |||
211 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | ||
212 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | ||
213 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | ||
214 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | ||
215 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | ||
216 | |||
217 | |||
218 | KPrefs::setCurrentGroup("Locale"); | ||
219 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | ||
220 | addItemInt("PreferredTime",&mPreferredTime,0); | ||
221 | addItemInt("PreferredDate",&mPreferredDate,0); | ||
222 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | ||
223 | addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); | ||
224 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | ||
225 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | ||
226 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | ||
227 | |||
228 | |||
229 | KPrefs::setCurrentGroup("Colors"); | ||
230 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | ||
231 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | ||
232 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | ||
233 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | ||
234 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | ||
235 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | ||
236 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | ||
237 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | ||
238 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | ||
239 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | ||
240 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | ||
241 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | ||
242 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | ||
243 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | ||
244 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | ||
245 | addItemBool("UseAppColors",&mUseAppColors,false); | ||
246 | |||
247 | |||
248 | |||
249 | KPrefs::setCurrentGroup("Views"); | ||
250 | addItemInt("Hour Size",&mHourSize,8); | ||
251 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | ||
252 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | ||
253 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | ||
254 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | ||
255 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | ||
256 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | ||
257 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | ||
258 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | ||
259 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | ||
260 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | ||
261 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | ||
262 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); | ||
263 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | ||
264 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | ||
265 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | ||
266 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | ||
267 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); | ||
268 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | ||
269 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | ||
270 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | ||
271 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | ||
272 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | ||
273 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); | ||
274 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | ||
275 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | ||
276 | #ifdef DESKTOP_VERSION | ||
277 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | ||
278 | #else | ||
279 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | ||
280 | #endif | ||
281 | addItemInt("Day Begins",&mDayBegins,7); | ||
282 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | ||
283 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | ||
284 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | ||
285 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | ||
286 | |||
287 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | ||
288 | addItemBool("Full View Month",&mFullViewMonth,true); | ||
289 | addItemBool("Full View Todo",&mFullViewTodo,true); | ||
290 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | ||
291 | |||
292 | addItemInt("Next X Days",&mNextXDays,3); | ||
293 | |||
294 | KPrefs::setCurrentGroup("Printer"); | ||
295 | |||
296 | KPrefs::setCurrentGroup("Layout"); | ||
297 | |||
298 | addItemBool("CompactDialogs",&mCompactDialogs,false); | ||
299 | addItemBool("VerticalScreen",&mVerticalScreen,true); | ||
300 | |||
301 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | ||
302 | |||
303 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | ||
304 | |||
305 | KPrefs::setCurrentGroup("Group Scheduling"); | ||
306 | |||
307 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | ||
308 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | ||
309 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | ||
310 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | ||
311 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | ||
312 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | ||
313 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | ||
314 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | ||
315 | |||
316 | KPrefs::setCurrentGroup( "Editors" ); | ||
317 | |||
318 | addItemStringList( "EventTemplates", &mEventTemplates ); | ||
319 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | ||
320 | |||
321 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | ||
322 | |||
323 | |||
324 | |||
325 | } | ||
326 | |||
327 | |||
328 | KOPrefs::~KOPrefs() | ||
329 | { | ||
330 | if (mInstance == this) | ||
331 | mInstance = insd.setObject(0); | ||
332 | setLocaleDict( 0 ); | ||
333 | if ( mLocaleDict ) | ||
334 | delete mLocaleDict; | ||
335 | //qDebug("KOPrefs::~KOPrefs() "); | ||
336 | } | ||
337 | |||
338 | |||
339 | KOPrefs *KOPrefs::instance() | ||
340 | { | ||
341 | if (!mInstance) { | ||
342 | mInstance = insd.setObject(new KOPrefs()); | ||
343 | mInstance->readConfig(); | ||
344 | } | ||
345 | |||
346 | return mInstance; | ||
347 | } | ||
348 | |||
349 | void KOPrefs::usrSetDefaults() | ||
350 | { | ||
351 | |||
352 | } | ||
353 | |||
354 | void KOPrefs::fillMailDefaults() | ||
355 | { | ||
356 | if (mName.isEmpty()) mName = i18n("Anonymous"); | ||
357 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | ||
358 | } | ||
359 | |||
360 | void KOPrefs::setTimeZoneIdDefault() | ||
361 | { | ||
362 | mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); | ||
363 | } | ||
364 | |||
365 | void KOPrefs::setCategoryDefaults() | ||
366 | { | ||
367 | mCustomCategories.clear(); | ||
368 | mCustomCategories = getDefaultList(); | ||
369 | |||
370 | QStringList::Iterator it; | ||
371 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | ||
372 | setCategoryColor(*it,mDefaultCategoryColor); | ||
373 | } | ||
374 | } | ||
375 | |||
376 | QStringList KOPrefs::getDefaultList() | ||
377 | { | ||
378 | QStringList retval ; | ||
379 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | ||
380 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | ||
381 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | ||
382 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | ||
383 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | ||
384 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | ||
385 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | ||
386 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | ||
387 | retval.sort(); | ||
388 | return retval; | ||
389 | } | ||
390 | |||
391 | void KOPrefs::usrReadConfig() | ||
392 | { | ||
393 | mLocaleDict = 0; | ||
394 | // pending LR fix translation | ||
395 | // qDebug("KOPrefs::usrReadConfig() fix translation "); | ||
396 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { | ||
397 | if ( mPreferredLanguage == 1 ) { | ||
398 | mLocaleDict = new QDict<QString>; | ||
399 | int i = 0; | ||
400 | QString fw ( germanwords[i] [0]); | ||
401 | while ( !fw.isEmpty() ) { | ||
402 | mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); | ||
403 | ++i; | ||
404 | fw = germanwords[i] [0]; | ||
405 | } | ||
406 | |||
407 | setLocaleDict( mLocaleDict ); | ||
408 | } else { | ||
409 | QString fileName ; | ||
410 | if ( mPreferredLanguage == 3 ) | ||
411 | fileName = MainWindow::resourcePath()+"usertranslation.txt"; | ||
412 | else if ( mPreferredLanguage == 2 ) | ||
413 | fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; | ||
414 | QFile file( fileName ); | ||
415 | if (file.open( IO_ReadOnly ) ) { | ||
416 | QTextStream ts( &file ); | ||
417 | ts.setEncoding( QTextStream::Latin1 ); | ||
418 | //ts.setCodec( QTextCodec::latin1 ); | ||
419 | QString text = ts.read(); | ||
420 | file.close(); | ||
421 | text.replace( QRegExp("\\\\n"), "\n" ); | ||
422 | QString line; | ||
423 | QString we; | ||
424 | QString wt; | ||
425 | int br = 0; | ||
426 | int nbr; | ||
427 | nbr = text.find ( "},", br ); | ||
428 | line = text.mid( br, nbr - br ); | ||
429 | br = nbr+1; | ||
430 | int se, ee, st, et; | ||
431 | mLocaleDict = new QDict<QString>; | ||
432 | QString end = "{ \"\",\"\" }"; | ||
433 | while ( (line != end) && (br > 1) ) { | ||
434 | //qDebug("%d *%s* ", br, line.latin1()); | ||
435 | se = line.find("\"")+1; | ||
436 | et = line.findRev("\"",-1); | ||
437 | ee = line.find("\",\""); | ||
438 | st = ee+3; | ||
439 | we = line.mid( se, ee-se ); | ||
440 | wt = line.mid( st, et-st ); | ||
441 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | ||
442 | mLocaleDict->insert( we, new QString (wt) ); | ||
443 | nbr = text.find ( "}", br ); | ||
444 | line = text.mid( br, nbr - br ); | ||
445 | br = nbr+1; | ||
446 | } | ||
447 | //qDebug("end *%s* ", end.latin1()); | ||
448 | |||
449 | setLocaleDict( mLocaleDict ); | ||
450 | } else { | ||
451 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | ||
452 | } | ||
453 | |||
454 | } | ||
455 | } | ||
456 | config()->setGroup("General"); | ||
457 | |||
458 | mCustomCategories = config()->readListEntry("Custom Categories"); | ||
459 | if ( KOPrefs::instance()->mLanguageChanged ) { | ||
460 | mLocationDefaults.clear(); | ||
461 | mEventSummaryUser.clear(); | ||
462 | mTodoSummaryUser.clear(); | ||
463 | } | ||
464 | if (mLocationDefaults.isEmpty()) { | ||
465 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | ||
466 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | ||
467 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | ||
468 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | ||
469 | mLocationDefaults.sort(); | ||
470 | } | ||
471 | |||
472 | if (mEventSummaryUser.isEmpty()) { | ||
473 | mEventSummaryUser = getDefaultList() ; | ||
474 | } | ||
475 | if (mTodoSummaryUser.isEmpty()) { | ||
476 | mTodoSummaryUser = getDefaultList() ; | ||
477 | } | ||
478 | |||
479 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | ||
480 | |||
481 | config()->setGroup("Personal Settings"); | ||
482 | mName = config()->readEntry("user_name",""); | ||
483 | mEmail = config()->readEntry("user_email",""); | ||
484 | fillMailDefaults(); | ||
485 | |||
486 | config()->setGroup("Category Colors"); | ||
487 | QStringList::Iterator it; | ||
488 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | ||
489 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | ||
490 | |||
491 | } | ||
492 | |||
493 | if (mTimeZoneId.isEmpty()) { | ||
494 | setTimeZoneIdDefault(); | ||
495 | } | ||
496 | KPimPrefs::usrReadConfig(); | ||
497 | } | ||
498 | |||
499 | |||
500 | void KOPrefs::usrWriteConfig() | ||
501 | { | ||
502 | config()->setGroup("General"); | ||
503 | config()->writeEntry("Custom Categories",mCustomCategories); | ||
504 | |||
505 | config()->setGroup("Personal Settings"); | ||
506 | config()->writeEntry("user_name",mName); | ||
507 | config()->writeEntry("user_email",mEmail); | ||
508 | |||
509 | config()->setGroup("Category Colors"); | ||
510 | QDictIterator<QColor> it(mCategoryColors); | ||
511 | while (it.current()) { | ||
512 | config()->writeEntry(it.currentKey(),*(it.current())); | ||
513 | ++it; | ||
514 | } | ||
515 | |||
516 | |||
517 | KPimPrefs::usrWriteConfig(); | ||
518 | } | ||
519 | |||
520 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | ||
521 | { | ||
522 | mCategoryColors.replace(cat,new QColor(color)); | ||
523 | } | ||
524 | |||
525 | QColor *KOPrefs::categoryColor(QString cat) | ||
526 | { | ||
527 | QColor *color = 0; | ||
528 | |||
529 | if (!cat.isEmpty()) color = mCategoryColors[cat]; | ||
530 | |||
531 | if (color) return color; | ||
532 | else return &mDefaultCategoryColor; | ||
533 | } | ||
534 | |||
535 | void KOPrefs::setFullName(const QString &name) | ||
536 | { | ||
537 | mName = name; | ||
538 | } | ||
539 | |||
540 | void KOPrefs::setEmail(const QString &email) | ||
541 | { | ||
542 | //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); | ||
543 | mEmail = email; | ||
544 | } | ||
545 | |||
546 | QString KOPrefs::fullName() | ||
547 | { | ||
548 | if (mEmailControlCenter) { | ||
549 | KEMailSettings settings; | ||
550 | return settings.getSetting(KEMailSettings::RealName); | ||
551 | } else { | ||
552 | return mName; | ||
553 | } | ||
554 | } | ||
555 | |||
556 | QString KOPrefs::email() | ||
557 | { | ||
558 | if (mEmailControlCenter) { | ||
559 | KEMailSettings settings; | ||
560 | return settings.getSetting(KEMailSettings::EmailAddress); | ||
561 | } else { | ||
562 | return mEmail; | ||
563 | } | ||
564 | } | ||
565 | KConfig* KOPrefs::getConfig() | ||
566 | { | ||
567 | return config(); | ||
568 | } | ||
diff --git a/kmicromail/koprefs.h b/kmicromail/koprefs.h new file mode 100644 index 0000000..c42d787 --- a/dev/null +++ b/kmicromail/koprefs.h | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | #ifndef KOPREFS_H | ||
24 | #define KOPREFS_H | ||
25 | |||
26 | #include <qdict.h> | ||
27 | |||
28 | #include <libkdepim/kpimprefs.h> | ||
29 | |||
30 | class KConfig; | ||
31 | class QFont; | ||
32 | class QColor; | ||
33 | class QStringList; | ||
34 | |||
35 | class KOPrefs : public KPimPrefs | ||
36 | { | ||
37 | public: | ||
38 | virtual ~KOPrefs(); | ||
39 | |||
40 | /** Get instance of KOPrefs. It is made sure that there is only one | ||
41 | instance. */ | ||
42 | static KOPrefs *instance(); | ||
43 | |||
44 | /** Set preferences to default values */ | ||
45 | void usrSetDefaults(); | ||
46 | |||
47 | /** Read preferences from config file */ | ||
48 | void usrReadConfig(); | ||
49 | |||
50 | /** Write preferences to config file */ | ||
51 | void usrWriteConfig(); | ||
52 | void setCategoryDefaults(){;}; | ||
53 | |||
54 | protected: | ||
55 | void setTimeZoneIdDefault(); | ||
56 | |||
57 | /** Fill empty mail fields with default values. */ | ||
58 | void fillMailDefaults(); | ||
59 | |||
60 | private: | ||
61 | /** Constructor disabled for public. Use instance() to create a KOPrefs | ||
62 | object. */ | ||
63 | KOPrefs(); | ||
64 | |||
65 | static KOPrefs *mInstance; | ||
66 | QDict<QString> *mLocaleDict; | ||
67 | public: | ||
68 | // preferences data | ||
69 | KConfig* getConfig(); | ||
70 | QFont mAppFont; | ||
71 | QFont mComposeFont; | ||
72 | QFont mReadFont; | ||
73 | QFont mTimeZoneId; | ||
74 | QString mName; | ||
75 | QString mEmail; | ||
76 | bool mSendLater, mViewAsHtml, mUseKapi; | ||
77 | private: | ||
78 | |||
79 | }; | ||
80 | |||
81 | #endif | ||
diff --git a/kmicromail/koprefs.h~ b/kmicromail/koprefs.h~ new file mode 100644 index 0000000..a9ac52f --- a/dev/null +++ b/kmicromail/koprefs.h~ | |||
@@ -0,0 +1,304 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | #ifndef KOPREFS_H | ||
24 | #define KOPREFS_H | ||
25 | |||
26 | #include <qdict.h> | ||
27 | |||
28 | #include <libkdepim/kpimprefs.h> | ||
29 | |||
30 | class KConfig; | ||
31 | class QFont; | ||
32 | class QColor; | ||
33 | class QStringList; | ||
34 | |||
35 | class KOPrefs : public KPimPrefs | ||
36 | { | ||
37 | public: | ||
38 | enum { FormatVCalendar, FormatICalendar }; | ||
39 | enum { MailClientKMail, MailClientSendmail }; | ||
40 | enum { IMIPDummy, IMIPKMail }; | ||
41 | enum { IMIPOutbox, IMIPdirectsend }; | ||
42 | enum { neverAuto, addressbookAuto, selectedAuto }; | ||
43 | enum { standardDestination, askDestination }; | ||
44 | |||
45 | virtual ~KOPrefs(); | ||
46 | |||
47 | /** Get instance of KOPrefs. It is made sure that there is only one | ||
48 | instance. */ | ||
49 | static KOPrefs *instance(); | ||
50 | |||
51 | /** Set preferences to default values */ | ||
52 | void usrSetDefaults(); | ||
53 | |||
54 | /** Read preferences from config file */ | ||
55 | void usrReadConfig(); | ||
56 | |||
57 | /** Write preferences to config file */ | ||
58 | void usrWriteConfig(); | ||
59 | void setCategoryDefaults(); | ||
60 | |||
61 | protected: | ||
62 | void setTimeZoneIdDefault(); | ||
63 | |||
64 | /** Fill empty mail fields with default values. */ | ||
65 | void fillMailDefaults(); | ||
66 | |||
67 | private: | ||
68 | /** Constructor disabled for public. Use instance() to create a KOPrefs | ||
69 | object. */ | ||
70 | KOPrefs(); | ||
71 | |||
72 | static KOPrefs *mInstance; | ||
73 | QDict<QString> *mLocaleDict; | ||
74 | QStringList getDefaultList(); | ||
75 | public: | ||
76 | // preferences data | ||
77 | KConfig* getConfig(); | ||
78 | void setFullName(const QString &); | ||
79 | QString fullName(); | ||
80 | void setEmail(const QString &); | ||
81 | QString email(); | ||
82 | |||
83 | QString mAdditional; | ||
84 | |||
85 | bool mEmailControlCenter; | ||
86 | |||
87 | bool mBcc; | ||
88 | bool mAutoSave; | ||
89 | int mAutoSaveInterval; | ||
90 | bool mConfirm; | ||
91 | |||
92 | bool mEnableGroupScheduling; | ||
93 | bool mEnableProjectView; | ||
94 | |||
95 | int mDefaultFormat; | ||
96 | int mMailClient; | ||
97 | |||
98 | QString mTimeZone; | ||
99 | QString mTimeZoneId; | ||
100 | //QString mTimeZoneName; // e.g. +00:04:00 Indian/Mauritius | ||
101 | //int mTimeZoneOffset; // e.g. -240 min | ||
102 | bool mUseDaylightsaving; | ||
103 | int mDaylightsavingStart; | ||
104 | int mDaylightsavingEnd; | ||
105 | int mStartTime; | ||
106 | int mDefaultDuration; | ||
107 | int mAlarmTime; | ||
108 | int mDaylightSavings; | ||
109 | |||
110 | int mWorkingHoursStart; | ||
111 | int mWorkingHoursEnd; | ||
112 | bool mExcludeHolidays; | ||
113 | bool mExcludeSaturdays; | ||
114 | bool mMarcusBainsShowSeconds; | ||
115 | |||
116 | QFont mTimeBarFont; | ||
117 | QFont mMonthViewFont; | ||
118 | QFont mAgendaViewFont; | ||
119 | QFont mMarcusBainsFont; | ||
120 | QFont mTimeLabelsFont; | ||
121 | QFont mTodoViewFont; | ||
122 | QFont mListViewFont; | ||
123 | QFont mDateNavigatorFont; | ||
124 | QFont mEditBoxFont; | ||
125 | QFont mJornalViewFont; | ||
126 | QFont mWhatsNextFont; | ||
127 | QFont mEventViewFont; | ||
128 | |||
129 | |||
130 | |||
131 | |||
132 | QColor mHolidayColor; | ||
133 | QColor mHighlightColor; | ||
134 | QColor mEventColor; | ||
135 | QColor mAgendaBgColor; | ||
136 | QColor mWorkingHoursColor; | ||
137 | QColor mTodoDueTodayColor; | ||
138 | QColor mTodoOverdueColor; | ||
139 | QColor mMonthViewEvenColor; | ||
140 | QColor mMonthViewOddColor; | ||
141 | QColor mMonthViewHolidayColor; | ||
142 | bool mMonthViewUsesDayColors; | ||
143 | bool mMonthViewSatSunTog; | ||
144 | QColor mAppColor1; | ||
145 | QColor mAppColor2; | ||
146 | bool mUseAppColors; | ||
147 | |||
148 | int mDayBegins; | ||
149 | int mHourSize; | ||
150 | int mAllDaySize; | ||
151 | bool mShowFullMenu; | ||
152 | bool mDailyRecur; | ||
153 | bool mWeeklyRecur; | ||
154 | bool mMonthDailyRecur; | ||
155 | bool mMonthWeeklyRecur; | ||
156 | bool mMonthShowIcons; | ||
157 | bool mMonthShowShort; | ||
158 | bool mEnableToolTips; | ||
159 | bool mEnableMonthScroll; | ||
160 | bool mFullViewMonth; | ||
161 | bool mMonthViewUsesCategoryColor; | ||
162 | bool mFullViewTodo; | ||
163 | bool mShowCompletedTodo; | ||
164 | bool mMarcusBainsEnabled; | ||
165 | int mNextXDays; | ||
166 | int mWhatsNextDays; | ||
167 | int mWhatsNextPrios; | ||
168 | bool mEnableQuickTodo; | ||
169 | bool mLanguageChanged; | ||
170 | |||
171 | bool mCompactDialogs; | ||
172 | bool mVerticalScreen; | ||
173 | |||
174 | bool mShowIconNewTodo; | ||
175 | bool mShowIconNewEvent; | ||
176 | bool mShowIconSearch; | ||
177 | bool mShowIconList; | ||
178 | bool mShowIconDay1; | ||
179 | bool mShowIconDay5; | ||
180 | bool mShowIconDay7; | ||
181 | bool mShowIconMonth; | ||
182 | bool mShowIconTodoview; | ||
183 | bool mShowIconBackFast; | ||
184 | bool mShowIconBack; | ||
185 | bool mShowIconToday; | ||
186 | bool mShowIconForward; | ||
187 | bool mShowIconForwardFast; | ||
188 | bool mShowIconWhatsThis; | ||
189 | bool mShowIconNextDays; | ||
190 | bool mShowIconNext; | ||
191 | bool mShowIconJournal; | ||
192 | |||
193 | bool mShowIconStretch; | ||
194 | |||
195 | bool mToolBarHor; | ||
196 | bool mToolBarUp; | ||
197 | bool mToolBarMiniIcons; | ||
198 | |||
199 | bool mAskForQuit; | ||
200 | bool mUsePassWd; | ||
201 | bool mWriteBackFile; | ||
202 | int mWriteBackInFuture; | ||
203 | bool mAskForPreferences; | ||
204 | bool mShowSyncSummary; | ||
205 | bool mShowSyncEvents; | ||
206 | bool mShowTodoInAgenda; | ||
207 | bool mWriteBackExistingOnly; | ||
208 | |||
209 | QString mRemoteIP; | ||
210 | QString mRemoteUser; | ||
211 | QString mRemotePassWd; | ||
212 | QString mRemoteFile; | ||
213 | QString mLocalTempFile; | ||
214 | QString mPhoneDevice; | ||
215 | QString mPhoneConnection; | ||
216 | QString mPhoneModel; | ||
217 | |||
218 | int mLastSyncTime; | ||
219 | int mSyncAlgoPrefs; | ||
220 | int mRingSyncAlgoPrefs; | ||
221 | QStringList mSyncProfileNames; | ||
222 | QStringList mExternSyncProfiles; | ||
223 | QString mLocalMachineName; | ||
224 | void setCategoryColor(QString cat,const QColor & color); | ||
225 | QColor *categoryColor(QString cat); | ||
226 | |||
227 | QString mArchiveFile; | ||
228 | QString mHtmlExportFile; | ||
229 | bool mHtmlWithSave; | ||
230 | |||
231 | QStringList mSelectedPlugins; | ||
232 | |||
233 | QString mLastImportFile; | ||
234 | QString mLastVcalFile; | ||
235 | QString mLastSaveFile; | ||
236 | QString mLastLoadFile; | ||
237 | QString mLastSyncedLocalFile; | ||
238 | |||
239 | |||
240 | QString mDefaultAlarmFile; | ||
241 | int mIMIPScheduler; | ||
242 | int mIMIPSend; | ||
243 | QStringList mAdditionalMails; | ||
244 | int mIMIPAutoRefresh; | ||
245 | int mIMIPAutoInsertReply; | ||
246 | int mIMIPAutoInsertRequest; | ||
247 | int mIMIPAutoFreeBusy; | ||
248 | int mIMIPAutoFreeBusyReply; | ||
249 | |||
250 | QStringList mTodoTemplates; | ||
251 | QStringList mEventTemplates; | ||
252 | |||
253 | int mDestination; | ||
254 | |||
255 | |||
256 | bool mEditOnDoubleClick; | ||
257 | bool mViewChangeHoldFullscreen; | ||
258 | bool mViewChangeHoldNonFullscreen; | ||
259 | bool mCenterOnCurrentTime; | ||
260 | bool mSetTimeToDayStartAt; | ||
261 | bool mHighlightCurrentDay; | ||
262 | bool mUseHighlightLightColor; | ||
263 | bool mListViewMonthTimespan; | ||
264 | bool mWNViewShowsParents; | ||
265 | bool mWNViewShowLocation; | ||
266 | bool mTodoViewShowsPercentage; | ||
267 | bool mTodoViewUsesCatColors; | ||
268 | bool mTodoViewUsesSmallFont; | ||
269 | bool mTodoViewUsesForegroundColor; | ||
270 | bool mMonthViewUsesForegroundColor; | ||
271 | |||
272 | bool mHightlightDateTimeEdit; | ||
273 | int mPreferredLanguage; | ||
274 | bool mUseQuicksave; | ||
275 | int mPreferredTime; | ||
276 | int mPreferredDate; | ||
277 | bool mWeekStartsOnSunday; | ||
278 | bool mShortDateInViewer; | ||
279 | QString mUserDateFormatLong; | ||
280 | QString mUserDateFormatShort; | ||
281 | |||
282 | QStringList mLocationDefaults; | ||
283 | QStringList mEventSummaryUser; | ||
284 | QStringList mTodoSummaryUser; | ||
285 | |||
286 | bool mUseInternalAlarmNotification; | ||
287 | int mAlarmPlayBeeps; | ||
288 | int mAlarmSuspendTime; | ||
289 | int mAlarmSuspendCount; | ||
290 | int mAlarmBeepInterval; | ||
291 | |||
292 | private: | ||
293 | QDict<QColor> mCategoryColors; | ||
294 | QColor mDefaultCategoryColor; | ||
295 | |||
296 | QFont mDefaultTimeBarFont; | ||
297 | QFont mDefaultViewFont; | ||
298 | QFont mDefaultMonthViewFont; | ||
299 | |||
300 | QString mName; | ||
301 | QString mEmail; | ||
302 | }; | ||
303 | |||
304 | #endif | ||
diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp new file mode 100644 index 0000000..87a6715 --- a/dev/null +++ b/kmicromail/koprefsdialog.cpp | |||
@@ -0,0 +1,1706 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | |||
24 | #include <qlayout.h> | ||
25 | #include <qlabel.h> | ||
26 | #include <qgroupbox.h> | ||
27 | #include <qbuttongroup.h> | ||
28 | #include <qlineedit.h> | ||
29 | #include <qfont.h> | ||
30 | #include <qslider.h> | ||
31 | #include <qfile.h> | ||
32 | #include <qtextstream.h> | ||
33 | #include <qcombobox.h> | ||
34 | #include <qvbox.h> | ||
35 | #include <qhbox.h> | ||
36 | #include <qregexp.h> | ||
37 | #include <qspinbox.h> | ||
38 | #include <qdatetime.h> | ||
39 | #include <qcheckbox.h> | ||
40 | #include <qradiobutton.h> | ||
41 | #include <qpushbutton.h> | ||
42 | #include <qstrlist.h> | ||
43 | #include <qapplication.h> | ||
44 | |||
45 | #include <kcolorbutton.h> | ||
46 | #include <kdebug.h> | ||
47 | #include <klocale.h> | ||
48 | #include <kglobal.h> | ||
49 | #include <kfontdialog.h> | ||
50 | #include <kfiledialog.h> | ||
51 | #include <kmessagebox.h> | ||
52 | #include <kcolordialog.h> | ||
53 | #include <kiconloader.h> | ||
54 | #include <kemailsettings.h> | ||
55 | #include <kstandarddirs.h> | ||
56 | |||
57 | #include <klineedit.h> | ||
58 | |||
59 | |||
60 | #include "koprefs.h" | ||
61 | |||
62 | #include "koprefsdialog.h" | ||
63 | |||
64 | |||
65 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : | ||
66 | KPrefsDialog(KOPrefs::instance(),parent,name,true) | ||
67 | { | ||
68 | |||
69 | setCaption( i18n("Settings - some need a restart (nr)")); | ||
70 | setupMainTab(); | ||
71 | setupMailTab();; | ||
72 | setupFontsTab(); | ||
73 | readConfig(); | ||
74 | |||
75 | #if 0 | ||
76 | |||
77 | setupMainTab(); | ||
78 | setupLocaleTab(); | ||
79 | setupTimeZoneTab(); | ||
80 | setupTimeTab(); | ||
81 | setupLocaleDateTab(); | ||
82 | setupFontsTab(); | ||
83 | setupColorsTab(); | ||
84 | setupViewsTab(); | ||
85 | //setupSyncTab(); | ||
86 | //setupSyncAlgTab(); | ||
87 | //setupPrinterTab(); | ||
88 | //setupGroupSchedulingTab(); | ||
89 | //setupGroupAutomationTab(); | ||
90 | #endif | ||
91 | } | ||
92 | |||
93 | |||
94 | KOPrefsDialog::~KOPrefsDialog() | ||
95 | { | ||
96 | } | ||
97 | |||
98 | void KOPrefsDialog::setupMainTab() | ||
99 | { | ||
100 | QFrame *topFrame = addPage(i18n("General"),0,0); | ||
101 | |||
102 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
103 | topLayout->setSpacing(spacingHint()); | ||
104 | topLayout->setMargin(marginHint()); | ||
105 | |||
106 | |||
107 | mNameEdit = new QLineEdit(topFrame); | ||
108 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | ||
109 | topLayout->addWidget(mNameLabel,0,0); | ||
110 | topLayout->addWidget(mNameEdit,0,1); | ||
111 | |||
112 | mEmailEdit = new QLineEdit(topFrame); | ||
113 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | ||
114 | topLayout->addWidget(mEmailLabel,1,0); | ||
115 | topLayout->addWidget(mEmailEdit,1,1); | ||
116 | QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); | ||
117 | topLayout->addMultiCellWidget(lab,2,2,0,1); | ||
118 | KPrefsWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), | ||
119 | &(KOPrefs::instance()->mUseKapi),topFrame); | ||
120 | topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); | ||
121 | } | ||
122 | |||
123 | void KOPrefsDialog::setupMailTab() | ||
124 | { | ||
125 | QFrame *topFrame = addPage(i18n("Mail"),0,0); | ||
126 | |||
127 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | ||
128 | topLayout->setSpacing(spacingHint()); | ||
129 | topLayout->setMargin(marginHint()); | ||
130 | |||
131 | KPrefsWidBool* ttt = addWidBool(i18n("View mail as html"), | ||
132 | &(KOPrefs::instance()->mViewAsHtml),topFrame); | ||
133 | topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); | ||
134 | |||
135 | |||
136 | ttt = addWidBool(i18n("Send mails later"), | ||
137 | &(KOPrefs::instance()->mSendLater),topFrame); | ||
138 | topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); | ||
139 | |||
140 | |||
141 | } | ||
142 | void KOPrefsDialog::setupFontsTab() | ||
143 | { | ||
144 | |||
145 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | ||
146 | // DesktopIcon("fonts",KIcon::SizeMedium)); | ||
147 | |||
148 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | ||
149 | topLayout->setSpacing(1); | ||
150 | topLayout->setMargin(3); | ||
151 | KPrefsWidFont * tVFont; | ||
152 | int i = 0; | ||
153 | KPrefsWidFont *timeLabelsFont = | ||
154 | addWidFont(i18n("OK"),i18n("Application(nr)"), | ||
155 | &(KOPrefs::instance()->mAppFont),topFrame); | ||
156 | topLayout->addWidget(timeLabelsFont->label(),i,0); | ||
157 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | ||
158 | topLayout->addWidget(timeLabelsFont->button(),i,2); | ||
159 | ++i; | ||
160 | |||
161 | |||
162 | timeLabelsFont = | ||
163 | addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), | ||
164 | &(KOPrefs::instance()->mComposeFont),topFrame); | ||
165 | topLayout->addWidget(timeLabelsFont->label(),i,0); | ||
166 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | ||
167 | topLayout->addWidget(timeLabelsFont->button(),i,2); | ||
168 | ++i; | ||
169 | |||
170 | KPrefsWidFont *timeBarFont = | ||
171 | addWidFont(i18n("Hello"),i18n("Read mail:"), | ||
172 | &(KOPrefs::instance()->mReadFont),topFrame); | ||
173 | topLayout->addWidget(timeBarFont->label(),i,0); | ||
174 | topLayout->addWidget(timeBarFont->preview(),i,1); | ||
175 | topLayout->addWidget(timeBarFont->button(),i,2); | ||
176 | ++i; | ||
177 | |||
178 | topLayout->setColStretch(1,1); | ||
179 | topLayout->setRowStretch(4,1); | ||
180 | |||
181 | } | ||
182 | void KOPrefsDialog::usrReadConfig() | ||
183 | { | ||
184 | qDebug("read "); | ||
185 | mNameEdit->setText(KOPrefs::instance()->mName); | ||
186 | mEmailEdit->setText(KOPrefs::instance()->mEmail); | ||
187 | } | ||
188 | void KOPrefsDialog::usrWriteConfig() | ||
189 | { | ||
190 | qDebug("write "); | ||
191 | KOPrefs::instance()->mName = mNameEdit->text(); | ||
192 | KOPrefs::instance()->mEmail = mEmailEdit->text(); | ||
193 | |||
194 | |||
195 | } | ||
196 | |||
197 | #if 0 | ||
198 | void KOPrefsDialog::setupLocaleDateTab() | ||
199 | { | ||
200 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); | ||
201 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); | ||
202 | topLayout->setSpacing(spacingHint()); | ||
203 | topLayout->setMargin(marginHint()); | ||
204 | int iii = 0; | ||
205 | |||
206 | |||
207 | KPrefsWidRadios *syncPrefsGroup = | ||
208 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); | ||
209 | QString format; | ||
210 | if ( QApplication::desktop()->width() < 480 ) | ||
211 | format = "(%d.%m.%Y)"; | ||
212 | else | ||
213 | format = "(%d.%m.%Y|%A %d %B %Y)"; | ||
214 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | ||
215 | if ( QApplication::desktop()->width() < 480 ) | ||
216 | format = "(%m.%d.%Y)"; | ||
217 | else | ||
218 | format = "(%m.%d.%Y|%A %B %d %Y)"; | ||
219 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | ||
220 | if ( QApplication::desktop()->width() < 480 ) | ||
221 | format = "(%Y-%m-%d)"; | ||
222 | else | ||
223 | format = "(%Y-%m-%d|%A %Y %B %d)"; | ||
224 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | ||
225 | syncPrefsGroup->addRadio(i18n("User defined")); | ||
226 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
227 | ++iii; | ||
228 | ++iii; | ||
229 | QLabel * lab; | ||
230 | mUserDateFormatLong = new QLineEdit(topFrame); | ||
231 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | ||
232 | topLayout->addWidget(lab ,iii,0); | ||
233 | topLayout->addWidget(mUserDateFormatLong,iii,1); | ||
234 | ++iii; | ||
235 | mUserDateFormatShort = new QLineEdit(topFrame); | ||
236 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | ||
237 | topLayout->addWidget(lab ,iii,0); | ||
238 | topLayout->addWidget(mUserDateFormatShort,iii,1); | ||
239 | ++iii; | ||
240 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | ||
241 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | ||
242 | ++iii; | ||
243 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | ||
244 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | ||
245 | ++iii; | ||
246 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | ||
247 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | ||
248 | ++iii; | ||
249 | |||
250 | } | ||
251 | |||
252 | void KOPrefsDialog::setupLocaleTab() | ||
253 | { | ||
254 | QFrame *topFrame = addPage(i18n("Locale"),0,0); | ||
255 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | ||
256 | topLayout->setSpacing(spacingHint()); | ||
257 | topLayout->setMargin(marginHint()); | ||
258 | int iii = 0; | ||
259 | KPrefsWidRadios *syncPrefsGroup = | ||
260 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); | ||
261 | syncPrefsGroup->addRadio(i18n("English")); | ||
262 | syncPrefsGroup->addRadio(i18n("German")); | ||
263 | syncPrefsGroup->addRadio(i18n("French")); | ||
264 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | ||
265 | if ( QApplication::desktop()->width() < 300 ) | ||
266 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | ||
267 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
268 | ++iii; | ||
269 | |||
270 | syncPrefsGroup = | ||
271 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); | ||
272 | if ( QApplication::desktop()->width() > 300 ) | ||
273 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | ||
274 | syncPrefsGroup->addRadio(i18n("24:00")); | ||
275 | syncPrefsGroup->addRadio(i18n("12:00am")); | ||
276 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | ||
277 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
278 | ++iii; | ||
279 | KPrefsWidBool *sb; | ||
280 | if ( QApplication::desktop()->width() < 300 ) { | ||
281 | sb = | ||
282 | addWidBool(i18n("Week starts on Sunday"), | ||
283 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); | ||
284 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
285 | ++iii; | ||
286 | sb = | ||
287 | addWidBool(i18n("Use short date in (WN/E) view"), | ||
288 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | ||
289 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
290 | } | ||
291 | else { | ||
292 | QWidget * hb = new QWidget( topFrame ); | ||
293 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); | ||
294 | sb = | ||
295 | addWidBool(i18n("Week starts on Sunday"), | ||
296 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); | ||
297 | hbLayout->addWidget(sb->checkBox() ); | ||
298 | sb = | ||
299 | addWidBool(i18n("Use short date in (WN/E) view"), | ||
300 | &(KOPrefs::instance()->mShortDateInViewer),hb); | ||
301 | hbLayout->addWidget(sb->checkBox() ); | ||
302 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); | ||
303 | |||
304 | } | ||
305 | //#ifndef DESKTOP_VERSION | ||
306 | #if 0 | ||
307 | ++iii; | ||
308 | sb = | ||
309 | addWidBool(i18n("Quick load/save (w/o Unicode)"), | ||
310 | &(KOPrefs::instance()->mUseQuicksave),topFrame); | ||
311 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
312 | #endif | ||
313 | } | ||
314 | void KOPrefsDialog::showSyncPage() | ||
315 | { | ||
316 | showPage ( 2 ) ; | ||
317 | |||
318 | } | ||
319 | void KOPrefsDialog::setupSyncAlgTab() | ||
320 | { | ||
321 | #if 0 | ||
322 | QLabel * lab; | ||
323 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); | ||
324 | mSetupSyncAlgTab = topFrame; | ||
325 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
326 | topLayout->setSpacing(spacingHint()); | ||
327 | topLayout->setMargin(marginHint()); | ||
328 | int iii = 0; | ||
329 | |||
330 | KPrefsWidBool *sb = | ||
331 | addWidBool(i18n("Ask for preferences before syncing"), | ||
332 | &(KOPrefs::instance()->mAskForPreferences),topFrame); | ||
333 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
334 | |||
335 | ++iii; | ||
336 | |||
337 | KPrefsWidRadios *syncPrefsGroup = | ||
338 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), | ||
339 | topFrame); | ||
340 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | ||
341 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | ||
342 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | ||
343 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | ||
344 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); | ||
345 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | ||
346 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
347 | ++iii; | ||
348 | sb = | ||
349 | addWidBool(i18n("Show summary after syncing"), | ||
350 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); | ||
351 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
352 | |||
353 | ++iii; | ||
354 | #endif | ||
355 | |||
356 | |||
357 | |||
358 | } | ||
359 | |||
360 | |||
361 | void KOPrefsDialog::setupSyncTab() | ||
362 | { | ||
363 | #if 0 | ||
364 | QLabel * lab; | ||
365 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); | ||
366 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
367 | topLayout->setSpacing(spacingHint()); | ||
368 | topLayout->setMargin(marginHint()); | ||
369 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); | ||
370 | int iii = 0; | ||
371 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); | ||
372 | ++iii; | ||
373 | |||
374 | mRemoteIPEdit = new QLineEdit(topFrame); | ||
375 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); | ||
376 | topLayout->addWidget(lab ,iii,0); | ||
377 | topLayout->addWidget(mRemoteIPEdit,iii,1); | ||
378 | ++iii; | ||
379 | mRemoteUser = new QLineEdit(topFrame); | ||
380 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); | ||
381 | topLayout->addWidget(lab ,iii,0); | ||
382 | topLayout->addWidget(mRemoteUser, iii,1); | ||
383 | ++iii; | ||
384 | |||
385 | mRemoteFile = new QLineEdit(topFrame); | ||
386 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); | ||
387 | topLayout->addWidget(lab ,iii,0); | ||
388 | topLayout->addWidget(mRemoteFile,iii,1); | ||
389 | ++iii; | ||
390 | |||
391 | mLocalTempFile = new QLineEdit(topFrame); | ||
392 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); | ||
393 | topLayout->addWidget(lab ,iii,0); | ||
394 | topLayout->addWidget(mLocalTempFile,iii,1); | ||
395 | ++iii; | ||
396 | |||
397 | KPrefsWidBool *wb = | ||
398 | addWidBool(i18n("Write back synced file"), | ||
399 | &(KOPrefs::instance()->mWriteBackFile),topFrame); | ||
400 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | ||
401 | ++iii; | ||
402 | wb = | ||
403 | addWidBool(i18n("Write back existing entries only"), | ||
404 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); | ||
405 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | ||
406 | ++iii; | ||
407 | |||
408 | #endif | ||
409 | } | ||
410 | |||
411 | void KOPrefsDialog::setupMainTab() | ||
412 | { | ||
413 | QFrame *topFrame = addPage(i18n("General"),0,0); | ||
414 | // DesktopIcon("identity",KIcon::SizeMedium)); | ||
415 | |||
416 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
417 | topLayout->setSpacing(spacingHint()); | ||
418 | topLayout->setMargin(marginHint()); | ||
419 | |||
420 | // KPrefsWidBool *emailControlCenter = | ||
421 | // addWidBool(i18n("&Use email settings from Control Center"), | ||
422 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); | ||
423 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); | ||
424 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), | ||
425 | // SLOT(toggleEmailSettings(bool))); | ||
426 | |||
427 | mNameEdit = new QLineEdit(topFrame); | ||
428 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | ||
429 | topLayout->addWidget(mNameLabel,0,0); | ||
430 | topLayout->addWidget(mNameEdit,0,1); | ||
431 | |||
432 | mEmailEdit = new QLineEdit(topFrame); | ||
433 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | ||
434 | topLayout->addWidget(mEmailLabel,1,0); | ||
435 | topLayout->addWidget(mEmailEdit,1,1); | ||
436 | KPrefsWidBool *wb; | ||
437 | QHBox *dummy; | ||
438 | if ( QApplication::desktop()->width() > 480 ) { | ||
439 | dummy = new QHBox(topFrame); | ||
440 | } else { | ||
441 | dummy = new QVBox(topFrame); | ||
442 | } | ||
443 | |||
444 | topLayout->addMultiCellWidget(dummy, 2,2,0,1); | ||
445 | addWidBool(i18n("Full menu bar(nr)"), | ||
446 | &(KOPrefs::instance()->mShowFullMenu),dummy); | ||
447 | |||
448 | |||
449 | addWidBool(i18n("Mini icons in toolbar(nr)"), | ||
450 | &(KOPrefs::instance()->mToolBarMiniIcons),dummy); | ||
451 | |||
452 | |||
453 | dummy = new QHBox(topFrame); | ||
454 | new QLabel(i18n("Days in What's Next:"),dummy); | ||
455 | mWhatsNextSpin = new QSpinBox(1,14,1,dummy); | ||
456 | |||
457 | topLayout->addMultiCellWidget(dummy,3,3,0,1); | ||
458 | |||
459 | |||
460 | |||
461 | dummy = new QHBox(topFrame); | ||
462 | new QLabel(i18n("Days in Next-X-Days:"),dummy); | ||
463 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); | ||
464 | |||
465 | topLayout->addMultiCellWidget(dummy,4,4,0,1); | ||
466 | |||
467 | QHBox *prioBox = new QHBox(topFrame); | ||
468 | // intervalBox->setSpacing(spacingHint()); | ||
469 | topLayout->addMultiCellWidget(prioBox,5,5,0,1); | ||
470 | QString messa = i18n("Show topmost todo prios in What's Next:"); | ||
471 | |||
472 | if ( QApplication::desktop()->width() < 300 ) | ||
473 | messa = i18n("Show topmost todo prios in What's N.:"); | ||
474 | QLabel *prioLabel = new QLabel(messa, prioBox); | ||
475 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | ||
476 | if ( QApplication::desktop()->width() < 300 ) | ||
477 | mPrioSpin->setFixedWidth( 40 ); | ||
478 | |||
479 | // KPrefsWidBool *bcc = | ||
480 | // addWidBool(i18n("Send copy to owner when mailing events"), | ||
481 | // &(KOPrefs::instance()->mBcc),topFrame); | ||
482 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); | ||
483 | |||
484 | |||
485 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); | ||
486 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); | ||
487 | |||
488 | // addWidBool(i18n("Enable automatic saving of calendar"), | ||
489 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); | ||
490 | |||
491 | QHBox *intervalBox = new QHBox(topFrame); | ||
492 | // intervalBox->setSpacing(spacingHint()); | ||
493 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); | ||
494 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); | ||
495 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); | ||
496 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); | ||
497 | /* | ||
498 | QHBox * agendasize = new QHBox ( topFrame ); | ||
499 | |||
500 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); | ||
501 | |||
502 | |||
503 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); | ||
504 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); | ||
505 | */ | ||
506 | KPrefsWidBool *verticalScreen = | ||
507 | addWidBool(i18n("Show vertical screen (Needs restart)"), | ||
508 | &(KOPrefs::instance()->mVerticalScreen),topFrame); | ||
509 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); | ||
510 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); | ||
511 | |||
512 | KPrefsWidBool *ask = | ||
513 | addWidBool(i18n("Ask for quit when closing KO/Pi"), | ||
514 | &(KOPrefs::instance()->mAskForQuit),topFrame); | ||
515 | topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); | ||
516 | |||
517 | |||
518 | /* | ||
519 | KPrefsWidBool *confirmCheck = | ||
520 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), | ||
521 | topFrame); | ||
522 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); | ||
523 | |||
524 | |||
525 | mEnableGroupScheduling = | ||
526 | addWidBool(i18n("Enable group scheduling"), | ||
527 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); | ||
528 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); | ||
529 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), | ||
530 | SLOT(warningGroupScheduling())); | ||
531 | |||
532 | mEnableProjectView = | ||
533 | addWidBool(i18n("Enable project view"), | ||
534 | &(KOPrefs::instance()->mEnableProjectView),topFrame); | ||
535 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); | ||
536 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), | ||
537 | SLOT(warningProjectView())); | ||
538 | |||
539 | // Can't be disabled anymore | ||
540 | mEnableGroupScheduling->checkBox()->hide(); | ||
541 | |||
542 | // Disable setting, because this feature now becomes stable | ||
543 | mEnableProjectView->checkBox()->hide(); | ||
544 | |||
545 | KPrefsWidRadios *defaultFormatGroup = | ||
546 | addWidRadios(i18n("Default Calendar Format"), | ||
547 | &(KOPrefs::instance()->mDefaultFormat),topFrame); | ||
548 | defaultFormatGroup->addRadio(i18n("vCalendar")); | ||
549 | defaultFormatGroup->addRadio(i18n("iCalendar")); | ||
550 | |||
551 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); | ||
552 | |||
553 | // Default format unconditionally is iCalendar | ||
554 | defaultFormatGroup->groupBox()->hide(); | ||
555 | |||
556 | KPrefsWidRadios *mailClientGroup = | ||
557 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), | ||
558 | topFrame); | ||
559 | mailClientGroup->addRadio(i18n("KMail")); | ||
560 | mailClientGroup->addRadio(i18n("Sendmail")); | ||
561 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); | ||
562 | |||
563 | KPrefsWidBool *htmlsave = | ||
564 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), | ||
565 | topFrame); | ||
566 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); | ||
567 | |||
568 | KPrefsWidRadios *destinationGroup = | ||
569 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), | ||
570 | topFrame); | ||
571 | destinationGroup->addRadio(i18n("be added to the standard resource")); | ||
572 | destinationGroup->addRadio(i18n("be asked which resource to use")); | ||
573 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); | ||
574 | |||
575 | topLayout->setRowStretch(14,1); | ||
576 | */ | ||
577 | } | ||
578 | |||
579 | |||
580 | void KOPrefsDialog::setupTimeTab() | ||
581 | { | ||
582 | QFrame *topFrame = addPage(i18n("Time"),0,0); | ||
583 | // DesktopIcon("clock",KIcon::SizeMedium)); | ||
584 | |||
585 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | ||
586 | topLayout->setSpacing(spacingHint()); | ||
587 | topLayout->setMargin(marginHint()); | ||
588 | |||
589 | QHBox *dummy = new QHBox(topFrame); | ||
590 | KPrefsWidTime *dayBegins = | ||
591 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | ||
592 | dummy); | ||
593 | //topLayout->addWidget(dayBegins->label(),2,0); | ||
594 | |||
595 | //topLayout->addWidget(dayBegins->spinBox(),2,1); | ||
596 | topLayout->addMultiCellWidget(dummy,0,0,0,1); | ||
597 | |||
598 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), | ||
599 | topFrame),1,0); | ||
600 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); | ||
601 | mStartTimeSpin->setSuffix(":00"); | ||
602 | topLayout->addWidget(mStartTimeSpin,1,1); | ||
603 | |||
604 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), | ||
605 | topFrame),2,0); | ||
606 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); | ||
607 | mDefaultDurationSpin->setSuffix(":00"); | ||
608 | topLayout->addWidget(mDefaultDurationSpin,2,1); | ||
609 | |||
610 | QStringList alarmList; | ||
611 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") | ||
612 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; | ||
613 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), | ||
614 | 3,0); | ||
615 | mAlarmTimeCombo = new QComboBox(topFrame); | ||
616 | mAlarmTimeCombo->insertStringList(alarmList); | ||
617 | topLayout->addWidget(mAlarmTimeCombo,3,1); | ||
618 | |||
619 | |||
620 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, | ||
621 | i18n("Working Hours"), | ||
622 | topFrame); | ||
623 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); | ||
624 | workingHoursGroup->layout()->setSpacing( 0 ); | ||
625 | workingHoursGroup->layout()->setMargin( 4 ); | ||
626 | QHBox *workStartBox = new QHBox(workingHoursGroup); | ||
627 | // workStartBox->setMargin( 0 ); | ||
628 | addWidTime(i18n("Daily starting hour:"), | ||
629 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); | ||
630 | |||
631 | QHBox *workEndBox = new QHBox(workingHoursGroup); | ||
632 | //workEndBox->setMargin( 0 ); | ||
633 | addWidTime(i18n("Daily ending hour:"), | ||
634 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); | ||
635 | QVBox *excludeBox = new QVBox(workingHoursGroup); | ||
636 | //excludeBox->setMargin( 0 ); | ||
637 | addWidBool(i18n("Exclude holidays"), | ||
638 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); | ||
639 | |||
640 | addWidBool(i18n("Exclude Saturdays"), | ||
641 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); | ||
642 | |||
643 | // KPrefsWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), | ||
644 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), | ||
645 | // topFrame); | ||
646 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); | ||
647 | |||
648 | // topLayout->setRowStretch(6,1); | ||
649 | } | ||
650 | |||
651 | |||
652 | void KOPrefsDialog::setupViewsTab() | ||
653 | { | ||
654 | |||
655 | QFrame *topFrame = addPage(i18n("Views"),0,0); | ||
656 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | ||
657 | |||
658 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); | ||
659 | topLayout->setSpacing(spacingHint()); | ||
660 | topLayout->setMargin(marginHint()); | ||
661 | |||
662 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; | ||
663 | // topLayout->addLayout(dayBeginsLayout,0,0); | ||
664 | |||
665 | // KPrefsWidTime *dayBegins = | ||
666 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | ||
667 | // topFrame); | ||
668 | // dayBeginsLayout->addWidget(dayBegins->label()); | ||
669 | // dayBeginsLayout->addStretch(1); | ||
670 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); | ||
671 | |||
672 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; | ||
673 | // topLayout->addLayout(nextDaysLayout,1,0); | ||
674 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); | ||
675 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); | ||
676 | // nextDaysLayout->addStretch(1); | ||
677 | // nextDaysLayout->addWidget(mNextXDaysSpin); | ||
678 | |||
679 | |||
680 | int ii = 0; | ||
681 | KPrefsWidBool *dummy = | ||
682 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), | ||
683 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); | ||
684 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
685 | |||
686 | dummy = | ||
687 | addWidBool(i18n("Highlight current day in agenda"), | ||
688 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); | ||
689 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
690 | |||
691 | dummy = | ||
692 | addWidBool(i18n("Use light color for highlight current day"), | ||
693 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); | ||
694 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
695 | |||
696 | KPrefsWidBool *dailyRecur = | ||
697 | addWidBool(i18n("Show events that recur daily in date nav."), | ||
698 | &(KOPrefs::instance()->mDailyRecur),topFrame); | ||
699 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | ||
700 | |||
701 | KPrefsWidBool *weeklyRecur = | ||
702 | addWidBool(i18n("Show ev. that recur weekly in date nav."), | ||
703 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); | ||
704 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); | ||
705 | if ( QApplication::desktop()->width() > 640 ) { | ||
706 | |||
707 | KPrefsWidBool *enableToolTips = | ||
708 | addWidBool(i18n("Enable tooltips displaying summary of ev."), | ||
709 | &(KOPrefs::instance()->mEnableToolTips),topFrame); | ||
710 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); | ||
711 | |||
712 | } | ||
713 | KPrefsWidBool *passwdk = | ||
714 | addWidBool(i18n("Show parent To-Do's in What's Next view"), | ||
715 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | ||
716 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | ||
717 | |||
718 | passwdk = | ||
719 | addWidBool(i18n("Show location in What's Next view"), | ||
720 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | ||
721 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | ||
722 | |||
723 | passwdk = | ||
724 | addWidBool(i18n("Show Sync Events in WN/Agenda view"), | ||
725 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | ||
726 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | ||
727 | |||
728 | |||
729 | KPrefsWidBool *marcusBainsEnabled = | ||
730 | addWidBool(i18n("Show Marcus Bains line"), | ||
731 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); | ||
732 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); | ||
733 | |||
734 | |||
735 | // topLayout->addWidget(hourSizeGroup,ii++,0); | ||
736 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); | ||
737 | //topLayout->setRowStretch(11,1); | ||
738 | |||
739 | |||
740 | |||
741 | |||
742 | |||
743 | |||
744 | topFrame = addPage(i18n("ViewChange"),0,0); | ||
745 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | ||
746 | |||
747 | topLayout = new QGridLayout(topFrame,6,1); | ||
748 | topLayout->setSpacing(spacingHint()); | ||
749 | topLayout->setMargin(marginHint()); | ||
750 | ii = 0; | ||
751 | |||
752 | |||
753 | dummy = | ||
754 | addWidBool(i18n("Hold fullscreen on view change"), | ||
755 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); | ||
756 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
757 | |||
758 | dummy = | ||
759 | addWidBool(i18n("Hold non-fullscreen on view change"), | ||
760 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); | ||
761 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
762 | |||
763 | |||
764 | KPrefsWidBool *fullViewTodo = | ||
765 | addWidBool(i18n("Event list view uses full window"), | ||
766 | &(KOPrefs::instance()->mFullViewTodo),topFrame); | ||
767 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); | ||
768 | |||
769 | KPrefsWidBool *fullViewMonth = | ||
770 | addWidBool(i18n("Next days view uses full window"), | ||
771 | &(KOPrefs::instance()->mFullViewMonth),topFrame); | ||
772 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); | ||
773 | |||
774 | dummy = | ||
775 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), | ||
776 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); | ||
777 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
778 | |||
779 | dummy = | ||
780 | addWidBool(i18n("Set agenda to current time on change"), | ||
781 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | ||
782 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
783 | |||
784 | dummy = | ||
785 | addWidBool(i18n("Listview uses monthly timespan"), | ||
786 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); | ||
787 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
788 | dummy = | ||
789 | addWidBool(i18n("Highlight selection in Time Edit"), | ||
790 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); | ||
791 | topLayout->addWidget( dummy->checkBox(), ii++,0); | ||
792 | |||
793 | |||
794 | |||
795 | |||
796 | |||
797 | topFrame = addPage(i18n("Month View"),0,0); | ||
798 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | ||
799 | |||
800 | topLayout = new QGridLayout(topFrame,5,1); | ||
801 | topLayout->setSpacing(spacingHint()); | ||
802 | topLayout->setMargin(marginHint()); | ||
803 | ii = 0; | ||
804 | QLabel *lab; | ||
805 | QHBox *habo = new QHBox( topFrame ); | ||
806 | if ( QApplication::desktop()->width() < 320 ) { | ||
807 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | ||
808 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | ||
809 | ii++; | ||
810 | |||
811 | } else { | ||
812 | new QLabel ( i18n("Show events that recur "), habo ); | ||
813 | |||
814 | } | ||
815 | dailyRecur = | ||
816 | addWidBool(i18n("daily"), | ||
817 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | ||
818 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | ||
819 | |||
820 | weeklyRecur = | ||
821 | addWidBool(i18n("weekly"), | ||
822 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | ||
823 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | ||
824 | ii++; | ||
825 | |||
826 | |||
827 | habo = new QHBox( topFrame ); | ||
828 | if ( QApplication::desktop()->width() < 320 ) { | ||
829 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | ||
830 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | ||
831 | ii++; | ||
832 | |||
833 | } else { | ||
834 | new QLabel ( i18n("Show in every cell "), habo ); | ||
835 | } | ||
836 | weeklyRecur = | ||
837 | addWidBool(i18n("short month"), | ||
838 | &(KOPrefs::instance()->mMonthShowShort),habo); | ||
839 | weeklyRecur = | ||
840 | addWidBool(i18n("icons"), | ||
841 | &(KOPrefs::instance()->mMonthShowIcons),habo); | ||
842 | |||
843 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | ||
844 | ii++; | ||
845 | #ifdef DESKTOP_VERSION | ||
846 | KPrefsWidBool *enableMonthScroll = | ||
847 | addWidBool(i18n("Enable scrollbars in month view cells"), | ||
848 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | ||
849 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | ||
850 | #endif | ||
851 | |||
852 | dummy = | ||
853 | addWidBool(i18n("Show Sat/Sun together"), | ||
854 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | ||
855 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
856 | |||
857 | KPrefsWidBool *coloredCategoriesInMonthView = | ||
858 | addWidBool(i18n("Month view uses category colors"), | ||
859 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | ||
860 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | ||
861 | |||
862 | dummy = | ||
863 | addWidBool(i18n("Categorie colors are applied to text"), | ||
864 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | ||
865 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
866 | coloredCategoriesInMonthView = | ||
867 | addWidBool(i18n("Month view uses day colors"), | ||
868 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | ||
869 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | ||
870 | |||
871 | KPrefsWidColor *holidayColor = | ||
872 | addWidColor(i18n("Day color odd months"), | ||
873 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | ||
874 | topLayout->addWidget(holidayColor->label(),ii,0); | ||
875 | topLayout->addWidget(holidayColor->button(),ii++,1); | ||
876 | |||
877 | holidayColor = | ||
878 | addWidColor(i18n("Day color even months"), | ||
879 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | ||
880 | topLayout->addWidget(holidayColor->label(),ii,0); | ||
881 | topLayout->addWidget(holidayColor->button(),ii++,1); | ||
882 | |||
883 | |||
884 | holidayColor = | ||
885 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | ||
886 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | ||
887 | topLayout->addWidget(holidayColor->label(),ii,0); | ||
888 | topLayout->addWidget(holidayColor->button(),ii++,1); | ||
889 | |||
890 | // *********************** Todo View | ||
891 | |||
892 | topFrame = addPage(i18n("Todo View"),0,0); | ||
893 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | ||
894 | |||
895 | topLayout = new QGridLayout(topFrame,4,1); | ||
896 | topLayout->setSpacing(spacingHint()); | ||
897 | topLayout->setMargin(marginHint()); | ||
898 | ii = 0; | ||
899 | |||
900 | KPrefsWidBool *showCompletedTodo = | ||
901 | addWidBool(i18n("To-do view shows completed Todos"), | ||
902 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | ||
903 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | ||
904 | dummy = | ||
905 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | ||
906 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | ||
907 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
908 | |||
909 | dummy = | ||
910 | addWidBool(i18n("Small To-do view uses smaller font"), | ||
911 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | ||
912 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
913 | |||
914 | |||
915 | |||
916 | dummy = | ||
917 | addWidBool(i18n("Todo view uses category colors"), | ||
918 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | ||
919 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
920 | |||
921 | |||
922 | QWidget* wid = new QWidget( topFrame ); | ||
923 | // Todo due today color | ||
924 | KPrefsWidColor *todoDueTodayColor = | ||
925 | addWidColor(i18n("Todo due today color:"), | ||
926 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | ||
927 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | ||
928 | widLayout->addWidget( todoDueTodayColor->label() ); | ||
929 | widLayout->addWidget( todoDueTodayColor->button() ); | ||
930 | topLayout->addWidget(wid,ii++,0); | ||
931 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | ||
932 | |||
933 | // Todo overdue color | ||
934 | wid = new QWidget( topFrame ); | ||
935 | widLayout = new QHBoxLayout(wid); | ||
936 | KPrefsWidColor *todoOverdueColor = | ||
937 | addWidColor(i18n("Todo overdue color:"), | ||
938 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | ||
939 | widLayout->addWidget(todoOverdueColor->label()); | ||
940 | widLayout->addWidget(todoOverdueColor->button()); | ||
941 | topLayout->addWidget(wid,ii++,0); | ||
942 | |||
943 | dummy = | ||
944 | addWidBool(i18n("Colors are applied to text"), | ||
945 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | ||
946 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
947 | |||
948 | dummy = | ||
949 | addWidBool(i18n("Allday Agenda view shows todos"), | ||
950 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | ||
951 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
952 | |||
953 | |||
954 | |||
955 | |||
956 | topFrame = addPage(i18n("Alarm"),0,0); | ||
957 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | ||
958 | |||
959 | topLayout = new QGridLayout(topFrame,2,1); | ||
960 | topLayout->setSpacing(spacingHint()); | ||
961 | topLayout->setMargin(marginHint()); | ||
962 | int iii = 0; | ||
963 | |||
964 | dummy = | ||
965 | addWidBool(i18n("Use internal alarm notification"), | ||
966 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | ||
967 | topLayout->addWidget(dummy->checkBox(),iii++,0); | ||
968 | 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); | ||
969 | |||
970 | topLayout->addWidget(lab ,iii++,0); | ||
971 | #ifndef DESKTOP_VERSION | ||
972 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | ||
973 | #else | ||
974 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | ||
975 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | ||
976 | #endif | ||
977 | |||
978 | QHBox* dummyBox = new QHBox(topFrame); | ||
979 | new QLabel(i18n("Play beeps count:"),dummyBox); | ||
980 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | ||
981 | topLayout->addWidget(dummyBox,iii++,0); | ||
982 | |||
983 | dummyBox = new QHBox(topFrame); | ||
984 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | ||
985 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | ||
986 | topLayout->addWidget(dummyBox,iii++,0); | ||
987 | |||
988 | dummyBox = new QHBox(topFrame); | ||
989 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | ||
990 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | ||
991 | topLayout->addWidget(dummyBox,iii++,0); | ||
992 | |||
993 | dummyBox = new QHBox(topFrame); | ||
994 | new QLabel(i18n("Auto suspend count:"),dummyBox); | ||
995 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | ||
996 | topLayout->addWidget(dummyBox,iii++,0); | ||
997 | |||
998 | |||
999 | |||
1000 | |||
1001 | |||
1002 | |||
1003 | |||
1004 | QHBox* hbo = new QHBox ( topFrame ); | ||
1005 | mDefaultAlarmFile = new QLineEdit(hbo); | ||
1006 | QPushButton * loadTemplate = new QPushButton(hbo); | ||
1007 | QPixmap icon; | ||
1008 | if ( QApplication::desktop()->width() < 321 ) | ||
1009 | icon = SmallIcon("fileimport16"); | ||
1010 | else | ||
1011 | icon = SmallIcon("fileimport"); | ||
1012 | loadTemplate->setIconSet (icon ) ; | ||
1013 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | ||
1014 | int size = loadTemplate->sizeHint().height(); | ||
1015 | loadTemplate->setFixedSize( size, size ); | ||
1016 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | ||
1017 | // topLayout->addWidget(lab ,iii++,0); | ||
1018 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | ||
1019 | topLayout->addWidget(lab ,iii++,0); | ||
1020 | topLayout->addWidget(hbo,iii++,0); | ||
1021 | // 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); | ||
1022 | |||
1023 | // topLayout->addWidget(lab ,iii++,0); | ||
1024 | // #ifndef DESKTOP_VERSION | ||
1025 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | ||
1026 | // #else | ||
1027 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | ||
1028 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | ||
1029 | // #endif | ||
1030 | |||
1031 | |||
1032 | } | ||
1033 | |||
1034 | void KOPrefsDialog::selectSoundFile() | ||
1035 | { | ||
1036 | QString fileName = mDefaultAlarmFile->text(); | ||
1037 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | ||
1038 | if ( fileName.length() > 0 ) | ||
1039 | mDefaultAlarmFile->setText( fileName ); | ||
1040 | } | ||
1041 | void KOPrefsDialog::setupFontsTab() | ||
1042 | { | ||
1043 | |||
1044 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | ||
1045 | // DesktopIcon("fonts",KIcon::SizeMedium)); | ||
1046 | |||
1047 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | ||
1048 | topLayout->setSpacing(1); | ||
1049 | topLayout->setMargin(3); | ||
1050 | KPrefsWidFont * tVFont; | ||
1051 | int i = 0; | ||
1052 | KPrefsWidFont *timeLabelsFont = | ||
1053 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | ||
1054 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | ||
1055 | topLayout->addWidget(timeLabelsFont->label(),i,0); | ||
1056 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | ||
1057 | topLayout->addWidget(timeLabelsFont->button(),i,2); | ||
1058 | ++i; | ||
1059 | |||
1060 | |||
1061 | timeLabelsFont = | ||
1062 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | ||
1063 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | ||
1064 | topLayout->addWidget(timeLabelsFont->label(),i,0); | ||
1065 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | ||
1066 | topLayout->addWidget(timeLabelsFont->button(),i,2); | ||
1067 | ++i; | ||
1068 | |||
1069 | KPrefsWidFont *timeBarFont = | ||
1070 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | ||
1071 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | ||
1072 | topLayout->addWidget(timeBarFont->label(),i,0); | ||
1073 | topLayout->addWidget(timeBarFont->preview(),i,1); | ||
1074 | topLayout->addWidget(timeBarFont->button(),i,2); | ||
1075 | ++i; | ||
1076 | |||
1077 | |||
1078 | KPrefsWidFont *marcusBainsFont = | ||
1079 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | ||
1080 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); | ||
1081 | topLayout->addWidget(marcusBainsFont->label(),i,0); | ||
1082 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | ||
1083 | topLayout->addWidget(marcusBainsFont->button(),i,2); | ||
1084 | ++i; | ||
1085 | |||
1086 | tVFont = | ||
1087 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | ||
1088 | &(KOPrefs::instance()->mEventViewFont),topFrame); | ||
1089 | topLayout->addWidget(tVFont->label(),i,0); | ||
1090 | topLayout->addWidget(tVFont->preview(),i,1); | ||
1091 | topLayout->addWidget(tVFont->button(),i,2); | ||
1092 | ++i; | ||
1093 | |||
1094 | |||
1095 | |||
1096 | tVFont = | ||
1097 | addWidFont(i18n("Details"),i18n("EditorBox:"), | ||
1098 | &(KOPrefs::instance()->mEditBoxFont),topFrame); | ||
1099 | topLayout->addWidget(tVFont->label(),i,0); | ||
1100 | topLayout->addWidget(tVFont->preview(),i,1); | ||
1101 | topLayout->addWidget(tVFont->button(),i,2); | ||
1102 | ++i; | ||
1103 | |||
1104 | |||
1105 | |||
1106 | topLayout->setColStretch(1,1); | ||
1107 | topLayout->setRowStretch(4,1); | ||
1108 | |||
1109 | |||
1110 | i = 0; | ||
1111 | topFrame = addPage(i18n("View Fonts"),0, | ||
1112 | DesktopIcon("fonts",KIcon::SizeMedium)); | ||
1113 | |||
1114 | topLayout = new QGridLayout(topFrame,7,3); | ||
1115 | topLayout->setSpacing(1); | ||
1116 | topLayout->setMargin(3); | ||
1117 | |||
1118 | tVFont = | ||
1119 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), | ||
1120 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); | ||
1121 | topLayout->addWidget(tVFont->label(),i,0); | ||
1122 | topLayout->addWidget(tVFont->preview(),i,1); | ||
1123 | topLayout->addWidget(tVFont->button(),i,2); | ||
1124 | ++i; | ||
1125 | KPrefsWidFont *agendaViewFont = | ||
1126 | addWidFont(i18n("Event text"),i18n("Agenda view:"), | ||
1127 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); | ||
1128 | topLayout->addWidget(agendaViewFont->label(),i,0); | ||
1129 | topLayout->addWidget(agendaViewFont->preview(),i,1); | ||
1130 | topLayout->addWidget(agendaViewFont->button(),i,2); | ||
1131 | ++i; | ||
1132 | |||
1133 | |||
1134 | KPrefsWidFont *monthViewFont = | ||
1135 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), | ||
1136 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); | ||
1137 | topLayout->addWidget(monthViewFont->label(),i,0); | ||
1138 | topLayout->addWidget(monthViewFont->preview(),i,1); | ||
1139 | topLayout->addWidget(monthViewFont->button(),i,2); | ||
1140 | ++i; | ||
1141 | |||
1142 | |||
1143 | KPrefsWidFont *lVFont = | ||
1144 | addWidFont(i18n("Event"),i18n("List View:"), | ||
1145 | &(KOPrefs::instance()->mListViewFont),topFrame); | ||
1146 | topLayout->addWidget(lVFont->label(),i,0); | ||
1147 | topLayout->addWidget(lVFont->preview(),i,1); | ||
1148 | topLayout->addWidget(lVFont->button(),i,2); | ||
1149 | ++i; | ||
1150 | |||
1151 | |||
1152 | tVFont = | ||
1153 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), | ||
1154 | &(KOPrefs::instance()->mTodoViewFont),topFrame); | ||
1155 | topLayout->addWidget(tVFont->label(),i,0); | ||
1156 | topLayout->addWidget(tVFont->preview(),i,1); | ||
1157 | topLayout->addWidget(tVFont->button(),i,2); | ||
1158 | ++i; | ||
1159 | |||
1160 | |||
1161 | tVFont = | ||
1162 | addWidFont(i18n("Today"),i18n("JournalView:"), | ||
1163 | &(KOPrefs::instance()->mJornalViewFont),topFrame); | ||
1164 | topLayout->addWidget(tVFont->label(),i,0); | ||
1165 | topLayout->addWidget(tVFont->preview(),i,1); | ||
1166 | topLayout->addWidget(tVFont->button(),i,2); | ||
1167 | ++i; | ||
1168 | |||
1169 | |||
1170 | |||
1171 | |||
1172 | topLayout->setColStretch(1,1); | ||
1173 | topLayout->setRowStretch(4,1); | ||
1174 | |||
1175 | |||
1176 | |||
1177 | |||
1178 | } | ||
1179 | |||
1180 | void KOPrefsDialog::setupColorsTab() | ||
1181 | { | ||
1182 | QFrame *topFrame = addPage(i18n("Colors"),0,0); | ||
1183 | // DesktopIcon("colorize",KIcon::SizeMedium)); | ||
1184 | |||
1185 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | ||
1186 | // topLayout->setSpacing(spacingHint()); | ||
1187 | // topLayout->setMargin(marginHint()); | ||
1188 | |||
1189 | topLayout->setSpacing(2); | ||
1190 | topLayout->setMargin(3); | ||
1191 | |||
1192 | int ii = 1; | ||
1193 | QGroupBox *categoryGroup ; | ||
1194 | |||
1195 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), | ||
1196 | topFrame); | ||
1197 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); | ||
1198 | |||
1199 | mCategoryCombo = new QComboBox(categoryGroup); | ||
1200 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | ||
1201 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); | ||
1202 | |||
1203 | mCategoryButton = new KColorButton(categoryGroup); | ||
1204 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); | ||
1205 | updateCategoryColor(); | ||
1206 | |||
1207 | |||
1208 | // Holiday Color | ||
1209 | |||
1210 | KPrefsWidColor *holidayColor = | ||
1211 | addWidColor(i18n("Holiday color:"), | ||
1212 | &(KOPrefs::instance()->mHolidayColor),topFrame); | ||
1213 | topLayout->addWidget(holidayColor->label(),ii,0); | ||
1214 | topLayout->addWidget(holidayColor->button(),ii++,1); | ||
1215 | |||
1216 | // Highlight Color | ||
1217 | KPrefsWidColor *highlightColor = | ||
1218 | addWidColor(i18n("Highlight color:"), | ||
1219 | &(KOPrefs::instance()->mHighlightColor),topFrame); | ||
1220 | topLayout->addWidget(highlightColor->label(),ii,0); | ||
1221 | topLayout->addWidget(highlightColor->button(),ii++,1); | ||
1222 | |||
1223 | // Event color | ||
1224 | KPrefsWidColor *eventColor = | ||
1225 | addWidColor(i18n("Default event color:"), | ||
1226 | &(KOPrefs::instance()->mEventColor),topFrame); | ||
1227 | topLayout->addWidget(eventColor->label(),ii,0); | ||
1228 | topLayout->addWidget(eventColor->button(),ii++,1); | ||
1229 | |||
1230 | // agenda view background color | ||
1231 | KPrefsWidColor *agendaBgColor = | ||
1232 | addWidColor(i18n("Agenda view background color:"), | ||
1233 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); | ||
1234 | topLayout->addWidget(agendaBgColor->label(),ii,0); | ||
1235 | topLayout->addWidget(agendaBgColor->button(),ii++,1); | ||
1236 | |||
1237 | // working hours color | ||
1238 | KPrefsWidColor *workingHoursColor = | ||
1239 | addWidColor(i18n("Working hours color:"), | ||
1240 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); | ||
1241 | topLayout->addWidget(workingHoursColor->label(),ii,0); | ||
1242 | topLayout->addWidget(workingHoursColor->button(),ii++,1); | ||
1243 | |||
1244 | KPrefsWidBool *sb = | ||
1245 | addWidBool(i18n("Use colors for application:"), | ||
1246 | &(KOPrefs::instance()->mUseAppColors),topFrame); | ||
1247 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); | ||
1248 | |||
1249 | ii++; | ||
1250 | KPrefsWidColor * workingHoursColor1 = | ||
1251 | addWidColor(i18n("Buttons, menus, etc.:"), | ||
1252 | &(KOPrefs::instance()->mAppColor1),topFrame); | ||
1253 | topLayout->addWidget(workingHoursColor1->label(),ii,0); | ||
1254 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); | ||
1255 | |||
1256 | KPrefsWidColor * workingHoursColor2 = | ||
1257 | addWidColor(i18n("Frames, labels, etc.:"), | ||
1258 | &(KOPrefs::instance()->mAppColor2),topFrame); | ||
1259 | topLayout->addWidget(workingHoursColor2->label(),ii,0); | ||
1260 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); | ||
1261 | |||
1262 | |||
1263 | |||
1264 | } | ||
1265 | |||
1266 | void KOPrefsDialog::setCategoryColor() | ||
1267 | { | ||
1268 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); | ||
1269 | } | ||
1270 | |||
1271 | void KOPrefsDialog::updateCategoryColor() | ||
1272 | { | ||
1273 | QString cat = mCategoryCombo->currentText(); | ||
1274 | QColor *color = mCategoryDict.find(cat); | ||
1275 | if (!color) { | ||
1276 | color = KOPrefs::instance()->categoryColor(cat); | ||
1277 | } | ||
1278 | if (color) { | ||
1279 | mCategoryButton->setColor(*color); | ||
1280 | } | ||
1281 | } | ||
1282 | |||
1283 | void KOPrefsDialog::setupPrinterTab() | ||
1284 | { | ||
1285 | mPrinterTab = addPage(i18n("Printing"),0, | ||
1286 | DesktopIcon("fileprint",KIcon::SizeMedium)); | ||
1287 | |||
1288 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); | ||
1289 | topLayout->setSpacing(spacingHint()); | ||
1290 | topLayout->setMargin(marginHint()); | ||
1291 | |||
1292 | topLayout->setRowStretch(4,1); | ||
1293 | } | ||
1294 | |||
1295 | void KOPrefsDialog::setupGroupSchedulingTab() | ||
1296 | { | ||
1297 | #if 0 | ||
1298 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, | ||
1299 | DesktopIcon("personal",KIcon::SizeMedium)); | ||
1300 | |||
1301 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
1302 | topLayout->setSpacing(spacingHint()); | ||
1303 | topLayout->setMargin(marginHint()); | ||
1304 | |||
1305 | #if 0 | ||
1306 | KPrefsWidRadios *schedulerGroup = | ||
1307 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), | ||
1308 | topFrame); | ||
1309 | schedulerGroup->addRadio("Dummy"); // Only for debugging | ||
1310 | schedulerGroup->addRadio(i18n("Mail client")); | ||
1311 | |||
1312 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); | ||
1313 | #endif | ||
1314 | |||
1315 | KPrefsWidRadios *sendGroup = | ||
1316 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), | ||
1317 | topFrame); | ||
1318 | sendGroup->addRadio(i18n("Send to outbox")); | ||
1319 | sendGroup->addRadio(i18n("Send directly")); | ||
1320 | |||
1321 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); | ||
1322 | |||
1323 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); | ||
1324 | mAMails = new QListView(topFrame); | ||
1325 | mAMails->addColumn(i18n("Email"),300); | ||
1326 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); | ||
1327 | |||
1328 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); | ||
1329 | aEmailsEdit = new QLineEdit(topFrame); | ||
1330 | aEmailsEdit->setEnabled(false); | ||
1331 | topLayout->addWidget(aEmailsEdit,4,1); | ||
1332 | |||
1333 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); | ||
1334 | topLayout->addWidget(add,5,0); | ||
1335 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); | ||
1336 | topLayout->addWidget(del,5,1); | ||
1337 | |||
1338 | //topLayout->setRowStretch(2,1); | ||
1339 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); | ||
1340 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); | ||
1341 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); | ||
1342 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); | ||
1343 | #endif | ||
1344 | } | ||
1345 | |||
1346 | void KOPrefsDialog::setupGroupAutomationTab() | ||
1347 | { | ||
1348 | return; | ||
1349 | QFrame *topFrame = addPage(i18n("Group Automation"),0, | ||
1350 | DesktopIcon("personal",KIcon::SizeMedium)); | ||
1351 | |||
1352 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); | ||
1353 | topLayout->setSpacing(spacingHint()); | ||
1354 | topLayout->setMargin(marginHint()); | ||
1355 | |||
1356 | KPrefsWidRadios *autoRefreshGroup = | ||
1357 | addWidRadios(i18n("Auto Send Refresh"), | ||
1358 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); | ||
1359 | autoRefreshGroup->addRadio(i18n("Never")); | ||
1360 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); | ||
1361 | //autoRefreshGroup->addRadio(i18n("selected emails")); | ||
1362 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); | ||
1363 | |||
1364 | KPrefsWidRadios *autoInsertGroup = | ||
1365 | addWidRadios(i18n("Auto Insert IMIP Replies"), | ||
1366 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); | ||
1367 | autoInsertGroup->addRadio(i18n("Never")); | ||
1368 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); | ||
1369 | //autoInsertGroup->addRadio(i18n("selected emails")); | ||
1370 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); | ||
1371 | |||
1372 | KPrefsWidRadios *autoRequestGroup = | ||
1373 | addWidRadios(i18n("Auto Insert IMIP Requests"), | ||
1374 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); | ||
1375 | autoRequestGroup->addRadio(i18n("Never")); | ||
1376 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); | ||
1377 | //autoInsertGroup->addRadio(i18n("selected emails")); | ||
1378 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); | ||
1379 | |||
1380 | KPrefsWidRadios *autoFreeBusyGroup = | ||
1381 | addWidRadios(i18n("Auto Send FreeBusy Information"), | ||
1382 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); | ||
1383 | autoFreeBusyGroup->addRadio(i18n("Never")); | ||
1384 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); | ||
1385 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | ||
1386 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); | ||
1387 | |||
1388 | KPrefsWidRadios *autoFreeBusyReplyGroup = | ||
1389 | addWidRadios(i18n("Auto Save FreeBusy Replies"), | ||
1390 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); | ||
1391 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); | ||
1392 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); | ||
1393 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | ||
1394 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); | ||
1395 | } | ||
1396 | |||
1397 | void KOPrefsDialog::showPrinterTab() | ||
1398 | { | ||
1399 | showPage(pageIndex(mPrinterTab)); | ||
1400 | } | ||
1401 | |||
1402 | |||
1403 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, | ||
1404 | const QStringList *tags) | ||
1405 | { | ||
1406 | if (tags) { | ||
1407 | int i = tags->findIndex(text); | ||
1408 | if (i > 0) combo->setCurrentItem(i); | ||
1409 | } else { | ||
1410 | for(int i=0;i<combo->count();++i) { | ||
1411 | if (combo->text(i) == text) { | ||
1412 | combo->setCurrentItem(i); | ||
1413 | break; | ||
1414 | } | ||
1415 | } | ||
1416 | } | ||
1417 | } | ||
1418 | |||
1419 | void KOPrefsDialog::usrReadConfig() | ||
1420 | { | ||
1421 | mNameEdit->setText(KOPrefs::instance()->fullName()); | ||
1422 | mEmailEdit->setText(KOPrefs::instance()->email()); | ||
1423 | |||
1424 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); | ||
1425 | QDate current ( 2001, 1,1); | ||
1426 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | ||
1427 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | ||
1428 | setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); | ||
1429 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | ||
1430 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); | ||
1431 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); | ||
1432 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); | ||
1433 | // if (KOPrefs::instance()->mAllDaySize > 47 ) | ||
1434 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; | ||
1435 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); | ||
1436 | |||
1437 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); | ||
1438 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); | ||
1439 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); | ||
1440 | // mAMails->clear(); | ||
1441 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); | ||
1442 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { | ||
1443 | // QListViewItem *item = new QListViewItem(mAMails); | ||
1444 | // item->setText(0,*it); | ||
1445 | // mAMails->insertItem(item); | ||
1446 | // } | ||
1447 | |||
1448 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); | ||
1449 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); | ||
1450 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); | ||
1451 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); | ||
1452 | |||
1453 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); | ||
1454 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); | ||
1455 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | ||
1456 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | ||
1457 | dummy = KOPrefs::instance()->mUserDateFormatShort; | ||
1458 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | ||
1459 | updateCategories(); | ||
1460 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); | ||
1461 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); | ||
1462 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); | ||
1463 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); | ||
1464 | } | ||
1465 | |||
1466 | |||
1467 | void KOPrefsDialog::usrWriteConfig() | ||
1468 | { | ||
1469 | |||
1470 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); | ||
1471 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); | ||
1472 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); | ||
1473 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); | ||
1474 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); | ||
1475 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); | ||
1476 | |||
1477 | KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | ||
1478 | KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | ||
1479 | KOPrefs::instance()->setFullName(mNameEdit->text()); | ||
1480 | KOPrefs::instance()->setEmail(mEmailEdit->text()); | ||
1481 | |||
1482 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); | ||
1483 | |||
1484 | KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); | ||
1485 | QDate date; | ||
1486 | date = mStartDateSavingEdit->date(); | ||
1487 | int sub = 0; | ||
1488 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | ||
1489 | sub = 1; | ||
1490 | KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; | ||
1491 | date = mEndDateSavingEdit->date(); | ||
1492 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | ||
1493 | sub = 1; | ||
1494 | else | ||
1495 | sub = 0; | ||
1496 | KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; | ||
1497 | // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); | ||
1498 | |||
1499 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); | ||
1500 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); | ||
1501 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); | ||
1502 | |||
1503 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); | ||
1504 | |||
1505 | QDictIterator<QColor> it(mCategoryDict); | ||
1506 | while (it.current()) { | ||
1507 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); | ||
1508 | ++it; | ||
1509 | } | ||
1510 | |||
1511 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); | ||
1512 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); | ||
1513 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); | ||
1514 | |||
1515 | KOPrefs::instance()->mAdditionalMails.clear(); | ||
1516 | // QListViewItem *item; | ||
1517 | // item = mAMails->firstChild(); | ||
1518 | // while (item) | ||
1519 | // { | ||
1520 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); | ||
1521 | // item = item->nextSibling(); | ||
1522 | // } | ||
1523 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); | ||
1524 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; | ||
1525 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; | ||
1526 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; | ||
1527 | |||
1528 | } | ||
1529 | |||
1530 | void KOPrefsDialog::updateCategories() | ||
1531 | { | ||
1532 | mCategoryCombo->clear(); | ||
1533 | mCategoryDict.clear(); | ||
1534 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | ||
1535 | updateCategoryColor(); | ||
1536 | } | ||
1537 | |||
1538 | void KOPrefsDialog::warningGroupScheduling() | ||
1539 | { | ||
1540 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); | ||
1541 | } | ||
1542 | |||
1543 | void KOPrefsDialog::warningProjectView() | ||
1544 | { | ||
1545 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); | ||
1546 | } | ||
1547 | |||
1548 | void KOPrefsDialog::warningExperimental(bool on) | ||
1549 | { | ||
1550 | if (on) { | ||
1551 | KMessageBox::information(this,i18n("This is an experimental feature. " | ||
1552 | "It may not work, it may do nothing useful and it may cause data loss. " | ||
1553 | "Use with care.\n" | ||
1554 | "You have to restart KOrganizer for this setting to take effect.")); | ||
1555 | } else { | ||
1556 | KMessageBox::information(this, | ||
1557 | i18n("You have to restart KOrganizer for this setting to take effect.")); | ||
1558 | } | ||
1559 | } | ||
1560 | |||
1561 | void KOPrefsDialog::toggleEmailSettings(bool on) | ||
1562 | { | ||
1563 | if (on) { | ||
1564 | mEmailEdit->setEnabled(false); | ||
1565 | mNameEdit->setEnabled(false); | ||
1566 | mEmailLabel->setEnabled(false); | ||
1567 | mNameLabel->setEnabled(false); | ||
1568 | |||
1569 | KEMailSettings settings; | ||
1570 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); | ||
1571 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); | ||
1572 | } else { | ||
1573 | mEmailEdit->setEnabled(true); | ||
1574 | mNameEdit->setEnabled(true); | ||
1575 | mEmailLabel->setEnabled(true); | ||
1576 | mNameLabel->setEnabled(true); | ||
1577 | } | ||
1578 | } | ||
1579 | |||
1580 | void KOPrefsDialog::addItem() | ||
1581 | { | ||
1582 | // aEmailsEdit->setEnabled(true); | ||
1583 | // QListViewItem *item = new QListViewItem(mAMails); | ||
1584 | // mAMails->insertItem(item); | ||
1585 | // mAMails->setSelected(item,true); | ||
1586 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); | ||
1587 | } | ||
1588 | |||
1589 | void KOPrefsDialog::removeItem() | ||
1590 | { | ||
1591 | // QListViewItem *item; | ||
1592 | // item = mAMails->selectedItem(); | ||
1593 | // if (!item) return; | ||
1594 | // mAMails->takeItem(item); | ||
1595 | // item = mAMails->selectedItem(); | ||
1596 | // if (!item) { | ||
1597 | // aEmailsEdit->setText(""); | ||
1598 | // aEmailsEdit->setEnabled(false); | ||
1599 | // } | ||
1600 | // if (mAMails->childCount() == 0) { | ||
1601 | // aEmailsEdit->setEnabled(false); | ||
1602 | // } | ||
1603 | } | ||
1604 | |||
1605 | void KOPrefsDialog::updateItem() | ||
1606 | { | ||
1607 | // QListViewItem *item; | ||
1608 | // item = mAMails->selectedItem(); | ||
1609 | // if (!item) return; | ||
1610 | // item->setText(0,aEmailsEdit->text()); | ||
1611 | } | ||
1612 | |||
1613 | void KOPrefsDialog::updateInput() | ||
1614 | { | ||
1615 | // QListViewItem *item; | ||
1616 | // item = mAMails->selectedItem(); | ||
1617 | // if (!item) return; | ||
1618 | // aEmailsEdit->setEnabled(true); | ||
1619 | // aEmailsEdit->setText(item->text(0)); | ||
1620 | } | ||
1621 | void KOPrefsDialog::updateTimezoneOffset( int index ) | ||
1622 | { | ||
1623 | /* | ||
1624 | qDebug("updateTimezoneOffset %d ", index); | ||
1625 | if ( index < 24 ) { | ||
1626 | mTimezoneOffsetSpin->setEnabled ( false ); | ||
1627 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); | ||
1628 | |||
1629 | |||
1630 | } else { | ||
1631 | if ( index == 24 ) { | ||
1632 | mTimezoneOffsetSpin->setEnabled ( true ); | ||
1633 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | ||
1634 | |||
1635 | } else { | ||
1636 | mTimezoneOffsetSpin->setEnabled ( false ); | ||
1637 | mTimezoneOffsetSpin->setValue( 0 ); | ||
1638 | } | ||
1639 | } | ||
1640 | */ | ||
1641 | } | ||
1642 | |||
1643 | void KOPrefsDialog::setupTimeZoneTab() | ||
1644 | { | ||
1645 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); | ||
1646 | // DesktopIcon("clock",KIcon::SizeMedium)); | ||
1647 | |||
1648 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | ||
1649 | topLayout->setSpacing(spacingHint()); | ||
1650 | topLayout->setMargin(marginHint()); | ||
1651 | |||
1652 | QHBox *timeZoneBox = new QHBox( topFrame ); | ||
1653 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | ||
1654 | |||
1655 | new QLabel( i18n("Timezone:"), timeZoneBox ); | ||
1656 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | ||
1657 | if ( QApplication::desktop()->width() < 300 ) { | ||
1658 | mTimeZoneCombo->setMaximumWidth(150); | ||
1659 | } | ||
1660 | |||
1661 | QStringList list; | ||
1662 | list = KGlobal::locale()->timeZoneList(); | ||
1663 | mTimeZoneCombo->insertStringList(list); | ||
1664 | |||
1665 | // find the currently set time zone and select it | ||
1666 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; | ||
1667 | int nCurrentlySet = 11; | ||
1668 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | ||
1669 | { | ||
1670 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | ||
1671 | { | ||
1672 | nCurrentlySet = i; | ||
1673 | break; | ||
1674 | } | ||
1675 | } | ||
1676 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | ||
1677 | int iii = 1; | ||
1678 | KPrefsWidBool *sb = | ||
1679 | addWidBool(i18n("Timezone has daylight saving"), | ||
1680 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); | ||
1681 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
1682 | ++iii; | ||
1683 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | ||
1684 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | ||
1685 | ++iii; | ||
1686 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | ||
1687 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | ||
1688 | ++iii; | ||
1689 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | ||
1690 | topLayout->addWidget(lab, iii,0); | ||
1691 | mStartDateSavingEdit = new KDateEdit(topFrame); | ||
1692 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | ||
1693 | ++iii; | ||
1694 | |||
1695 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | ||
1696 | topLayout->addWidget(lab, iii,0); | ||
1697 | mEndDateSavingEdit = new KDateEdit(topFrame); | ||
1698 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | ||
1699 | ++iii; | ||
1700 | QDate current ( 2001, 1,1); | ||
1701 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | ||
1702 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | ||
1703 | |||
1704 | |||
1705 | } | ||
1706 | #endif | ||
diff --git a/kmicromail/koprefsdialog.cpp~ b/kmicromail/koprefsdialog.cpp~ new file mode 100644 index 0000000..5ba4817 --- a/dev/null +++ b/kmicromail/koprefsdialog.cpp~ | |||
@@ -0,0 +1,1609 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | |||
24 | #include <qlayout.h> | ||
25 | #include <qlabel.h> | ||
26 | #include <qgroupbox.h> | ||
27 | #include <qbuttongroup.h> | ||
28 | #include <qlineedit.h> | ||
29 | #include <qfont.h> | ||
30 | #include <qslider.h> | ||
31 | #include <qfile.h> | ||
32 | #include <qtextstream.h> | ||
33 | #include <qcombobox.h> | ||
34 | #include <qvbox.h> | ||
35 | #include <qhbox.h> | ||
36 | #include <qregexp.h> | ||
37 | #include <qspinbox.h> | ||
38 | #include <qdatetime.h> | ||
39 | #include <qcheckbox.h> | ||
40 | #include <qradiobutton.h> | ||
41 | #include <qpushbutton.h> | ||
42 | #include <qstrlist.h> | ||
43 | #include <qapplication.h> | ||
44 | |||
45 | #include <kcolorbutton.h> | ||
46 | #include <kdebug.h> | ||
47 | #include <klocale.h> | ||
48 | #include <kglobal.h> | ||
49 | #include <kfontdialog.h> | ||
50 | #include <kfiledialog.h> | ||
51 | #include <kmessagebox.h> | ||
52 | #include <kcolordialog.h> | ||
53 | #include <kiconloader.h> | ||
54 | #include <kemailsettings.h> | ||
55 | #include <kstandarddirs.h> | ||
56 | |||
57 | #include <kurlrequester.h> | ||
58 | #include <klineedit.h> | ||
59 | |||
60 | #if defined(USE_SOLARIS) | ||
61 | #include <sys/param.h> | ||
62 | |||
63 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" | ||
64 | #define INITFILE "/etc/default/init" | ||
65 | #endif | ||
66 | |||
67 | #include "koprefs.h" | ||
68 | |||
69 | #include "koprefsdialog.h" | ||
70 | |||
71 | |||
72 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : | ||
73 | KPrefsDialog(KOPrefs::instance(),parent,name,true) | ||
74 | { | ||
75 | |||
76 | setCaption( i18n("Preferences - some settings need a restart (nr)")); | ||
77 | mCategoryDict.setAutoDelete(true); | ||
78 | |||
79 | KGlobal::locale()->insertCatalogue("timezones"); | ||
80 | |||
81 | setupMainTab(); | ||
82 | setupLocaleTab(); | ||
83 | setupTimeZoneTab(); | ||
84 | setupTimeTab(); | ||
85 | setupLocaleDateTab(); | ||
86 | setupFontsTab(); | ||
87 | setupColorsTab(); | ||
88 | setupViewsTab(); | ||
89 | //setupSyncTab(); | ||
90 | //setupSyncAlgTab(); | ||
91 | //setupPrinterTab(); | ||
92 | //setupGroupSchedulingTab(); | ||
93 | //setupGroupAutomationTab(); | ||
94 | } | ||
95 | |||
96 | |||
97 | KOPrefsDialog::~KOPrefsDialog() | ||
98 | { | ||
99 | } | ||
100 | |||
101 | void KOPrefsDialog::setupLocaleDateTab() | ||
102 | { | ||
103 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); | ||
104 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); | ||
105 | topLayout->setSpacing(spacingHint()); | ||
106 | topLayout->setMargin(marginHint()); | ||
107 | int iii = 0; | ||
108 | |||
109 | |||
110 | KPrefsWidRadios *syncPrefsGroup = | ||
111 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); | ||
112 | QString format; | ||
113 | if ( QApplication::desktop()->width() < 480 ) | ||
114 | format = "(%d.%m.%Y)"; | ||
115 | else | ||
116 | format = "(%d.%m.%Y|%A %d %B %Y)"; | ||
117 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | ||
118 | if ( QApplication::desktop()->width() < 480 ) | ||
119 | format = "(%m.%d.%Y)"; | ||
120 | else | ||
121 | format = "(%m.%d.%Y|%A %B %d %Y)"; | ||
122 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | ||
123 | if ( QApplication::desktop()->width() < 480 ) | ||
124 | format = "(%Y-%m-%d)"; | ||
125 | else | ||
126 | format = "(%Y-%m-%d|%A %Y %B %d)"; | ||
127 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | ||
128 | syncPrefsGroup->addRadio(i18n("User defined")); | ||
129 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
130 | ++iii; | ||
131 | ++iii; | ||
132 | QLabel * lab; | ||
133 | mUserDateFormatLong = new QLineEdit(topFrame); | ||
134 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | ||
135 | topLayout->addWidget(lab ,iii,0); | ||
136 | topLayout->addWidget(mUserDateFormatLong,iii,1); | ||
137 | ++iii; | ||
138 | mUserDateFormatShort = new QLineEdit(topFrame); | ||
139 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | ||
140 | topLayout->addWidget(lab ,iii,0); | ||
141 | topLayout->addWidget(mUserDateFormatShort,iii,1); | ||
142 | ++iii; | ||
143 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | ||
144 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | ||
145 | ++iii; | ||
146 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | ||
147 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | ||
148 | ++iii; | ||
149 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | ||
150 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | ||
151 | ++iii; | ||
152 | |||
153 | } | ||
154 | |||
155 | void KOPrefsDialog::setupLocaleTab() | ||
156 | { | ||
157 | QFrame *topFrame = addPage(i18n("Locale"),0,0); | ||
158 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | ||
159 | topLayout->setSpacing(spacingHint()); | ||
160 | topLayout->setMargin(marginHint()); | ||
161 | int iii = 0; | ||
162 | KPrefsWidRadios *syncPrefsGroup = | ||
163 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); | ||
164 | syncPrefsGroup->addRadio(i18n("English")); | ||
165 | syncPrefsGroup->addRadio(i18n("German")); | ||
166 | syncPrefsGroup->addRadio(i18n("French")); | ||
167 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | ||
168 | if ( QApplication::desktop()->width() < 300 ) | ||
169 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | ||
170 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
171 | ++iii; | ||
172 | |||
173 | syncPrefsGroup = | ||
174 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); | ||
175 | if ( QApplication::desktop()->width() > 300 ) | ||
176 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | ||
177 | syncPrefsGroup->addRadio(i18n("24:00")); | ||
178 | syncPrefsGroup->addRadio(i18n("12:00am")); | ||
179 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | ||
180 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
181 | ++iii; | ||
182 | KPrefsWidBool *sb; | ||
183 | if ( QApplication::desktop()->width() < 300 ) { | ||
184 | sb = | ||
185 | addWidBool(i18n("Week starts on Sunday"), | ||
186 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); | ||
187 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
188 | ++iii; | ||
189 | sb = | ||
190 | addWidBool(i18n("Use short date in (WN/E) view"), | ||
191 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | ||
192 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
193 | } | ||
194 | else { | ||
195 | QWidget * hb = new QWidget( topFrame ); | ||
196 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); | ||
197 | sb = | ||
198 | addWidBool(i18n("Week starts on Sunday"), | ||
199 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); | ||
200 | hbLayout->addWidget(sb->checkBox() ); | ||
201 | sb = | ||
202 | addWidBool(i18n("Use short date in (WN/E) view"), | ||
203 | &(KOPrefs::instance()->mShortDateInViewer),hb); | ||
204 | hbLayout->addWidget(sb->checkBox() ); | ||
205 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); | ||
206 | |||
207 | } | ||
208 | //#ifndef DESKTOP_VERSION | ||
209 | #if 0 | ||
210 | ++iii; | ||
211 | sb = | ||
212 | addWidBool(i18n("Quick load/save (w/o Unicode)"), | ||
213 | &(KOPrefs::instance()->mUseQuicksave),topFrame); | ||
214 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
215 | #endif | ||
216 | } | ||
217 | void KOPrefsDialog::showSyncPage() | ||
218 | { | ||
219 | showPage ( 2 ) ; | ||
220 | |||
221 | } | ||
222 | void KOPrefsDialog::setupSyncAlgTab() | ||
223 | { | ||
224 | #if 0 | ||
225 | QLabel * lab; | ||
226 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); | ||
227 | mSetupSyncAlgTab = topFrame; | ||
228 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
229 | topLayout->setSpacing(spacingHint()); | ||
230 | topLayout->setMargin(marginHint()); | ||
231 | int iii = 0; | ||
232 | |||
233 | KPrefsWidBool *sb = | ||
234 | addWidBool(i18n("Ask for preferences before syncing"), | ||
235 | &(KOPrefs::instance()->mAskForPreferences),topFrame); | ||
236 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
237 | |||
238 | ++iii; | ||
239 | |||
240 | KPrefsWidRadios *syncPrefsGroup = | ||
241 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), | ||
242 | topFrame); | ||
243 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | ||
244 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | ||
245 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | ||
246 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | ||
247 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); | ||
248 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | ||
249 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
250 | ++iii; | ||
251 | sb = | ||
252 | addWidBool(i18n("Show summary after syncing"), | ||
253 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); | ||
254 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
255 | |||
256 | ++iii; | ||
257 | #endif | ||
258 | |||
259 | |||
260 | |||
261 | } | ||
262 | |||
263 | |||
264 | void KOPrefsDialog::setupSyncTab() | ||
265 | { | ||
266 | #if 0 | ||
267 | QLabel * lab; | ||
268 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); | ||
269 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
270 | topLayout->setSpacing(spacingHint()); | ||
271 | topLayout->setMargin(marginHint()); | ||
272 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); | ||
273 | int iii = 0; | ||
274 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); | ||
275 | ++iii; | ||
276 | |||
277 | mRemoteIPEdit = new QLineEdit(topFrame); | ||
278 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); | ||
279 | topLayout->addWidget(lab ,iii,0); | ||
280 | topLayout->addWidget(mRemoteIPEdit,iii,1); | ||
281 | ++iii; | ||
282 | mRemoteUser = new QLineEdit(topFrame); | ||
283 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); | ||
284 | topLayout->addWidget(lab ,iii,0); | ||
285 | topLayout->addWidget(mRemoteUser, iii,1); | ||
286 | ++iii; | ||
287 | |||
288 | mRemoteFile = new QLineEdit(topFrame); | ||
289 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); | ||
290 | topLayout->addWidget(lab ,iii,0); | ||
291 | topLayout->addWidget(mRemoteFile,iii,1); | ||
292 | ++iii; | ||
293 | |||
294 | mLocalTempFile = new QLineEdit(topFrame); | ||
295 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); | ||
296 | topLayout->addWidget(lab ,iii,0); | ||
297 | topLayout->addWidget(mLocalTempFile,iii,1); | ||
298 | ++iii; | ||
299 | |||
300 | KPrefsWidBool *wb = | ||
301 | addWidBool(i18n("Write back synced file"), | ||
302 | &(KOPrefs::instance()->mWriteBackFile),topFrame); | ||
303 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | ||
304 | ++iii; | ||
305 | wb = | ||
306 | addWidBool(i18n("Write back existing entries only"), | ||
307 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); | ||
308 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | ||
309 | ++iii; | ||
310 | |||
311 | #endif | ||
312 | } | ||
313 | |||
314 | void KOPrefsDialog::setupMainTab() | ||
315 | { | ||
316 | QFrame *topFrame = addPage(i18n("General"),0,0); | ||
317 | // DesktopIcon("identity",KIcon::SizeMedium)); | ||
318 | |||
319 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
320 | topLayout->setSpacing(spacingHint()); | ||
321 | topLayout->setMargin(marginHint()); | ||
322 | |||
323 | // KPrefsWidBool *emailControlCenter = | ||
324 | // addWidBool(i18n("&Use email settings from Control Center"), | ||
325 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); | ||
326 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); | ||
327 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), | ||
328 | // SLOT(toggleEmailSettings(bool))); | ||
329 | |||
330 | mNameEdit = new QLineEdit(topFrame); | ||
331 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | ||
332 | topLayout->addWidget(mNameLabel,0,0); | ||
333 | topLayout->addWidget(mNameEdit,0,1); | ||
334 | |||
335 | mEmailEdit = new QLineEdit(topFrame); | ||
336 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | ||
337 | topLayout->addWidget(mEmailLabel,1,0); | ||
338 | topLayout->addWidget(mEmailEdit,1,1); | ||
339 | KPrefsWidBool *wb; | ||
340 | QHBox *dummy; | ||
341 | if ( QApplication::desktop()->width() > 480 ) { | ||
342 | dummy = new QHBox(topFrame); | ||
343 | } else { | ||
344 | dummy = new QVBox(topFrame); | ||
345 | } | ||
346 | |||
347 | topLayout->addMultiCellWidget(dummy, 2,2,0,1); | ||
348 | addWidBool(i18n("Full menu bar(nr)"), | ||
349 | &(KOPrefs::instance()->mShowFullMenu),dummy); | ||
350 | |||
351 | |||
352 | addWidBool(i18n("Mini icons in toolbar(nr)"), | ||
353 | &(KOPrefs::instance()->mToolBarMiniIcons),dummy); | ||
354 | |||
355 | |||
356 | dummy = new QHBox(topFrame); | ||
357 | new QLabel(i18n("Days in What's Next:"),dummy); | ||
358 | mWhatsNextSpin = new QSpinBox(1,14,1,dummy); | ||
359 | |||
360 | topLayout->addMultiCellWidget(dummy,3,3,0,1); | ||
361 | |||
362 | |||
363 | |||
364 | dummy = new QHBox(topFrame); | ||
365 | new QLabel(i18n("Days in Next-X-Days:"),dummy); | ||
366 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); | ||
367 | |||
368 | topLayout->addMultiCellWidget(dummy,4,4,0,1); | ||
369 | |||
370 | QHBox *prioBox = new QHBox(topFrame); | ||
371 | // intervalBox->setSpacing(spacingHint()); | ||
372 | topLayout->addMultiCellWidget(prioBox,5,5,0,1); | ||
373 | QString messa = i18n("Show topmost todo prios in What's Next:"); | ||
374 | |||
375 | if ( QApplication::desktop()->width() < 300 ) | ||
376 | messa = i18n("Show topmost todo prios in What's N.:"); | ||
377 | QLabel *prioLabel = new QLabel(messa, prioBox); | ||
378 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | ||
379 | if ( QApplication::desktop()->width() < 300 ) | ||
380 | mPrioSpin->setFixedWidth( 40 ); | ||
381 | |||
382 | // KPrefsWidBool *bcc = | ||
383 | // addWidBool(i18n("Send copy to owner when mailing events"), | ||
384 | // &(KOPrefs::instance()->mBcc),topFrame); | ||
385 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); | ||
386 | |||
387 | |||
388 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); | ||
389 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); | ||
390 | |||
391 | // addWidBool(i18n("Enable automatic saving of calendar"), | ||
392 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); | ||
393 | |||
394 | QHBox *intervalBox = new QHBox(topFrame); | ||
395 | // intervalBox->setSpacing(spacingHint()); | ||
396 | topLayout->addMultiCellWidget(intervalBox,6,6,0,1); | ||
397 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); | ||
398 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); | ||
399 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); | ||
400 | /* | ||
401 | QHBox * agendasize = new QHBox ( topFrame ); | ||
402 | |||
403 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); | ||
404 | |||
405 | |||
406 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); | ||
407 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); | ||
408 | */ | ||
409 | KPrefsWidBool *verticalScreen = | ||
410 | addWidBool(i18n("Show vertical screen (Needs restart)"), | ||
411 | &(KOPrefs::instance()->mVerticalScreen),topFrame); | ||
412 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); | ||
413 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); | ||
414 | |||
415 | KPrefsWidBool *ask = | ||
416 | addWidBool(i18n("Ask for quit when closing KO/Pi"), | ||
417 | &(KOPrefs::instance()->mAskForQuit),topFrame); | ||
418 | topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); | ||
419 | |||
420 | |||
421 | /* | ||
422 | KPrefsWidBool *confirmCheck = | ||
423 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), | ||
424 | topFrame); | ||
425 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); | ||
426 | |||
427 | |||
428 | mEnableGroupScheduling = | ||
429 | addWidBool(i18n("Enable group scheduling"), | ||
430 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); | ||
431 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); | ||
432 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), | ||
433 | SLOT(warningGroupScheduling())); | ||
434 | |||
435 | mEnableProjectView = | ||
436 | addWidBool(i18n("Enable project view"), | ||
437 | &(KOPrefs::instance()->mEnableProjectView),topFrame); | ||
438 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); | ||
439 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), | ||
440 | SLOT(warningProjectView())); | ||
441 | |||
442 | // Can't be disabled anymore | ||
443 | mEnableGroupScheduling->checkBox()->hide(); | ||
444 | |||
445 | // Disable setting, because this feature now becomes stable | ||
446 | mEnableProjectView->checkBox()->hide(); | ||
447 | |||
448 | KPrefsWidRadios *defaultFormatGroup = | ||
449 | addWidRadios(i18n("Default Calendar Format"), | ||
450 | &(KOPrefs::instance()->mDefaultFormat),topFrame); | ||
451 | defaultFormatGroup->addRadio(i18n("vCalendar")); | ||
452 | defaultFormatGroup->addRadio(i18n("iCalendar")); | ||
453 | |||
454 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); | ||
455 | |||
456 | // Default format unconditionally is iCalendar | ||
457 | defaultFormatGroup->groupBox()->hide(); | ||
458 | |||
459 | KPrefsWidRadios *mailClientGroup = | ||
460 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), | ||
461 | topFrame); | ||
462 | mailClientGroup->addRadio(i18n("KMail")); | ||
463 | mailClientGroup->addRadio(i18n("Sendmail")); | ||
464 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); | ||
465 | |||
466 | KPrefsWidBool *htmlsave = | ||
467 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), | ||
468 | topFrame); | ||
469 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); | ||
470 | |||
471 | KPrefsWidRadios *destinationGroup = | ||
472 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), | ||
473 | topFrame); | ||
474 | destinationGroup->addRadio(i18n("be added to the standard resource")); | ||
475 | destinationGroup->addRadio(i18n("be asked which resource to use")); | ||
476 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); | ||
477 | |||
478 | topLayout->setRowStretch(14,1); | ||
479 | */ | ||
480 | } | ||
481 | |||
482 | |||
483 | void KOPrefsDialog::setupTimeTab() | ||
484 | { | ||
485 | QFrame *topFrame = addPage(i18n("Time"),0,0); | ||
486 | // DesktopIcon("clock",KIcon::SizeMedium)); | ||
487 | |||
488 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | ||
489 | topLayout->setSpacing(spacingHint()); | ||
490 | topLayout->setMargin(marginHint()); | ||
491 | |||
492 | QHBox *dummy = new QHBox(topFrame); | ||
493 | KPrefsWidTime *dayBegins = | ||
494 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | ||
495 | dummy); | ||
496 | //topLayout->addWidget(dayBegins->label(),2,0); | ||
497 | |||
498 | //topLayout->addWidget(dayBegins->spinBox(),2,1); | ||
499 | topLayout->addMultiCellWidget(dummy,0,0,0,1); | ||
500 | |||
501 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), | ||
502 | topFrame),1,0); | ||
503 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); | ||
504 | mStartTimeSpin->setSuffix(":00"); | ||
505 | topLayout->addWidget(mStartTimeSpin,1,1); | ||
506 | |||
507 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), | ||
508 | topFrame),2,0); | ||
509 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); | ||
510 | mDefaultDurationSpin->setSuffix(":00"); | ||
511 | topLayout->addWidget(mDefaultDurationSpin,2,1); | ||
512 | |||
513 | QStringList alarmList; | ||
514 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") | ||
515 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; | ||
516 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), | ||
517 | 3,0); | ||
518 | mAlarmTimeCombo = new QComboBox(topFrame); | ||
519 | mAlarmTimeCombo->insertStringList(alarmList); | ||
520 | topLayout->addWidget(mAlarmTimeCombo,3,1); | ||
521 | |||
522 | |||
523 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, | ||
524 | i18n("Working Hours"), | ||
525 | topFrame); | ||
526 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); | ||
527 | workingHoursGroup->layout()->setSpacing( 0 ); | ||
528 | workingHoursGroup->layout()->setMargin( 4 ); | ||
529 | QHBox *workStartBox = new QHBox(workingHoursGroup); | ||
530 | // workStartBox->setMargin( 0 ); | ||
531 | addWidTime(i18n("Daily starting hour:"), | ||
532 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); | ||
533 | |||
534 | QHBox *workEndBox = new QHBox(workingHoursGroup); | ||
535 | //workEndBox->setMargin( 0 ); | ||
536 | addWidTime(i18n("Daily ending hour:"), | ||
537 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); | ||
538 | QVBox *excludeBox = new QVBox(workingHoursGroup); | ||
539 | //excludeBox->setMargin( 0 ); | ||
540 | addWidBool(i18n("Exclude holidays"), | ||
541 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); | ||
542 | |||
543 | addWidBool(i18n("Exclude Saturdays"), | ||
544 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); | ||
545 | |||
546 | // KPrefsWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), | ||
547 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), | ||
548 | // topFrame); | ||
549 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); | ||
550 | |||
551 | // topLayout->setRowStretch(6,1); | ||
552 | } | ||
553 | |||
554 | |||
555 | void KOPrefsDialog::setupViewsTab() | ||
556 | { | ||
557 | |||
558 | QFrame *topFrame = addPage(i18n("Views"),0,0); | ||
559 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | ||
560 | |||
561 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); | ||
562 | topLayout->setSpacing(spacingHint()); | ||
563 | topLayout->setMargin(marginHint()); | ||
564 | |||
565 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; | ||
566 | // topLayout->addLayout(dayBeginsLayout,0,0); | ||
567 | |||
568 | // KPrefsWidTime *dayBegins = | ||
569 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | ||
570 | // topFrame); | ||
571 | // dayBeginsLayout->addWidget(dayBegins->label()); | ||
572 | // dayBeginsLayout->addStretch(1); | ||
573 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); | ||
574 | |||
575 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; | ||
576 | // topLayout->addLayout(nextDaysLayout,1,0); | ||
577 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); | ||
578 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); | ||
579 | // nextDaysLayout->addStretch(1); | ||
580 | // nextDaysLayout->addWidget(mNextXDaysSpin); | ||
581 | |||
582 | |||
583 | int ii = 0; | ||
584 | KPrefsWidBool *dummy = | ||
585 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), | ||
586 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); | ||
587 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
588 | |||
589 | dummy = | ||
590 | addWidBool(i18n("Highlight current day in agenda"), | ||
591 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); | ||
592 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
593 | |||
594 | dummy = | ||
595 | addWidBool(i18n("Use light color for highlight current day"), | ||
596 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); | ||
597 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
598 | |||
599 | KPrefsWidBool *dailyRecur = | ||
600 | addWidBool(i18n("Show events that recur daily in date nav."), | ||
601 | &(KOPrefs::instance()->mDailyRecur),topFrame); | ||
602 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | ||
603 | |||
604 | KPrefsWidBool *weeklyRecur = | ||
605 | addWidBool(i18n("Show ev. that recur weekly in date nav."), | ||
606 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); | ||
607 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); | ||
608 | if ( QApplication::desktop()->width() > 640 ) { | ||
609 | |||
610 | KPrefsWidBool *enableToolTips = | ||
611 | addWidBool(i18n("Enable tooltips displaying summary of ev."), | ||
612 | &(KOPrefs::instance()->mEnableToolTips),topFrame); | ||
613 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); | ||
614 | |||
615 | } | ||
616 | KPrefsWidBool *passwdk = | ||
617 | addWidBool(i18n("Show parent To-Do's in What's Next view"), | ||
618 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | ||
619 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | ||
620 | |||
621 | passwdk = | ||
622 | addWidBool(i18n("Show location in What's Next view"), | ||
623 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | ||
624 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | ||
625 | |||
626 | passwdk = | ||
627 | addWidBool(i18n("Show Sync Events in WN/Agenda view"), | ||
628 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | ||
629 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | ||
630 | |||
631 | |||
632 | KPrefsWidBool *marcusBainsEnabled = | ||
633 | addWidBool(i18n("Show Marcus Bains line"), | ||
634 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); | ||
635 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); | ||
636 | |||
637 | |||
638 | // topLayout->addWidget(hourSizeGroup,ii++,0); | ||
639 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); | ||
640 | //topLayout->setRowStretch(11,1); | ||
641 | |||
642 | |||
643 | |||
644 | |||
645 | |||
646 | |||
647 | topFrame = addPage(i18n("ViewChange"),0,0); | ||
648 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | ||
649 | |||
650 | topLayout = new QGridLayout(topFrame,6,1); | ||
651 | topLayout->setSpacing(spacingHint()); | ||
652 | topLayout->setMargin(marginHint()); | ||
653 | ii = 0; | ||
654 | |||
655 | |||
656 | dummy = | ||
657 | addWidBool(i18n("Hold fullscreen on view change"), | ||
658 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); | ||
659 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
660 | |||
661 | dummy = | ||
662 | addWidBool(i18n("Hold non-fullscreen on view change"), | ||
663 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); | ||
664 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
665 | |||
666 | |||
667 | KPrefsWidBool *fullViewTodo = | ||
668 | addWidBool(i18n("Event list view uses full window"), | ||
669 | &(KOPrefs::instance()->mFullViewTodo),topFrame); | ||
670 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); | ||
671 | |||
672 | KPrefsWidBool *fullViewMonth = | ||
673 | addWidBool(i18n("Next days view uses full window"), | ||
674 | &(KOPrefs::instance()->mFullViewMonth),topFrame); | ||
675 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); | ||
676 | |||
677 | dummy = | ||
678 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), | ||
679 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); | ||
680 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
681 | |||
682 | dummy = | ||
683 | addWidBool(i18n("Set agenda to current time on change"), | ||
684 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | ||
685 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
686 | |||
687 | dummy = | ||
688 | addWidBool(i18n("Listview uses monthly timespan"), | ||
689 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); | ||
690 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
691 | dummy = | ||
692 | addWidBool(i18n("Highlight selection in Time Edit"), | ||
693 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); | ||
694 | topLayout->addWidget( dummy->checkBox(), ii++,0); | ||
695 | |||
696 | |||
697 | |||
698 | |||
699 | |||
700 | topFrame = addPage(i18n("Month View"),0,0); | ||
701 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | ||
702 | |||
703 | topLayout = new QGridLayout(topFrame,5,1); | ||
704 | topLayout->setSpacing(spacingHint()); | ||
705 | topLayout->setMargin(marginHint()); | ||
706 | ii = 0; | ||
707 | QLabel *lab; | ||
708 | QHBox *habo = new QHBox( topFrame ); | ||
709 | if ( QApplication::desktop()->width() < 320 ) { | ||
710 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | ||
711 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | ||
712 | ii++; | ||
713 | |||
714 | } else { | ||
715 | new QLabel ( i18n("Show events that recur "), habo ); | ||
716 | |||
717 | } | ||
718 | dailyRecur = | ||
719 | addWidBool(i18n("daily"), | ||
720 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | ||
721 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | ||
722 | |||
723 | weeklyRecur = | ||
724 | addWidBool(i18n("weekly"), | ||
725 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | ||
726 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | ||
727 | ii++; | ||
728 | |||
729 | |||
730 | habo = new QHBox( topFrame ); | ||
731 | if ( QApplication::desktop()->width() < 320 ) { | ||
732 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | ||
733 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | ||
734 | ii++; | ||
735 | |||
736 | } else { | ||
737 | new QLabel ( i18n("Show in every cell "), habo ); | ||
738 | } | ||
739 | weeklyRecur = | ||
740 | addWidBool(i18n("short month"), | ||
741 | &(KOPrefs::instance()->mMonthShowShort),habo); | ||
742 | weeklyRecur = | ||
743 | addWidBool(i18n("icons"), | ||
744 | &(KOPrefs::instance()->mMonthShowIcons),habo); | ||
745 | |||
746 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | ||
747 | ii++; | ||
748 | #ifdef DESKTOP_VERSION | ||
749 | KPrefsWidBool *enableMonthScroll = | ||
750 | addWidBool(i18n("Enable scrollbars in month view cells"), | ||
751 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | ||
752 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | ||
753 | #endif | ||
754 | |||
755 | dummy = | ||
756 | addWidBool(i18n("Show Sat/Sun together"), | ||
757 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | ||
758 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
759 | |||
760 | KPrefsWidBool *coloredCategoriesInMonthView = | ||
761 | addWidBool(i18n("Month view uses category colors"), | ||
762 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | ||
763 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | ||
764 | |||
765 | dummy = | ||
766 | addWidBool(i18n("Categorie colors are applied to text"), | ||
767 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | ||
768 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
769 | coloredCategoriesInMonthView = | ||
770 | addWidBool(i18n("Month view uses day colors"), | ||
771 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | ||
772 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | ||
773 | |||
774 | KPrefsWidColor *holidayColor = | ||
775 | addWidColor(i18n("Day color odd months"), | ||
776 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | ||
777 | topLayout->addWidget(holidayColor->label(),ii,0); | ||
778 | topLayout->addWidget(holidayColor->button(),ii++,1); | ||
779 | |||
780 | holidayColor = | ||
781 | addWidColor(i18n("Day color even months"), | ||
782 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | ||
783 | topLayout->addWidget(holidayColor->label(),ii,0); | ||
784 | topLayout->addWidget(holidayColor->button(),ii++,1); | ||
785 | |||
786 | |||
787 | holidayColor = | ||
788 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | ||
789 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | ||
790 | topLayout->addWidget(holidayColor->label(),ii,0); | ||
791 | topLayout->addWidget(holidayColor->button(),ii++,1); | ||
792 | |||
793 | // *********************** Todo View | ||
794 | |||
795 | topFrame = addPage(i18n("Todo View"),0,0); | ||
796 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | ||
797 | |||
798 | topLayout = new QGridLayout(topFrame,4,1); | ||
799 | topLayout->setSpacing(spacingHint()); | ||
800 | topLayout->setMargin(marginHint()); | ||
801 | ii = 0; | ||
802 | |||
803 | KPrefsWidBool *showCompletedTodo = | ||
804 | addWidBool(i18n("To-do view shows completed Todos"), | ||
805 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | ||
806 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | ||
807 | dummy = | ||
808 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | ||
809 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | ||
810 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
811 | |||
812 | dummy = | ||
813 | addWidBool(i18n("Small To-do view uses smaller font"), | ||
814 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | ||
815 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
816 | |||
817 | |||
818 | |||
819 | dummy = | ||
820 | addWidBool(i18n("Todo view uses category colors"), | ||
821 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | ||
822 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
823 | |||
824 | |||
825 | QWidget* wid = new QWidget( topFrame ); | ||
826 | // Todo due today color | ||
827 | KPrefsWidColor *todoDueTodayColor = | ||
828 | addWidColor(i18n("Todo due today color:"), | ||
829 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | ||
830 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | ||
831 | widLayout->addWidget( todoDueTodayColor->label() ); | ||
832 | widLayout->addWidget( todoDueTodayColor->button() ); | ||
833 | topLayout->addWidget(wid,ii++,0); | ||
834 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | ||
835 | |||
836 | // Todo overdue color | ||
837 | wid = new QWidget( topFrame ); | ||
838 | widLayout = new QHBoxLayout(wid); | ||
839 | KPrefsWidColor *todoOverdueColor = | ||
840 | addWidColor(i18n("Todo overdue color:"), | ||
841 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | ||
842 | widLayout->addWidget(todoOverdueColor->label()); | ||
843 | widLayout->addWidget(todoOverdueColor->button()); | ||
844 | topLayout->addWidget(wid,ii++,0); | ||
845 | |||
846 | dummy = | ||
847 | addWidBool(i18n("Colors are applied to text"), | ||
848 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | ||
849 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
850 | |||
851 | dummy = | ||
852 | addWidBool(i18n("Allday Agenda view shows todos"), | ||
853 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | ||
854 | topLayout->addWidget(dummy->checkBox(),ii++,0); | ||
855 | |||
856 | |||
857 | |||
858 | |||
859 | topFrame = addPage(i18n("Alarm"),0,0); | ||
860 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | ||
861 | |||
862 | topLayout = new QGridLayout(topFrame,2,1); | ||
863 | topLayout->setSpacing(spacingHint()); | ||
864 | topLayout->setMargin(marginHint()); | ||
865 | int iii = 0; | ||
866 | |||
867 | dummy = | ||
868 | addWidBool(i18n("Use internal alarm notification"), | ||
869 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | ||
870 | topLayout->addWidget(dummy->checkBox(),iii++,0); | ||
871 | 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); | ||
872 | |||
873 | topLayout->addWidget(lab ,iii++,0); | ||
874 | #ifndef DESKTOP_VERSION | ||
875 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | ||
876 | #else | ||
877 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | ||
878 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | ||
879 | #endif | ||
880 | |||
881 | QHBox* dummyBox = new QHBox(topFrame); | ||
882 | new QLabel(i18n("Play beeps count:"),dummyBox); | ||
883 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | ||
884 | topLayout->addWidget(dummyBox,iii++,0); | ||
885 | |||
886 | dummyBox = new QHBox(topFrame); | ||
887 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | ||
888 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | ||
889 | topLayout->addWidget(dummyBox,iii++,0); | ||
890 | |||
891 | dummyBox = new QHBox(topFrame); | ||
892 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | ||
893 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | ||
894 | topLayout->addWidget(dummyBox,iii++,0); | ||
895 | |||
896 | dummyBox = new QHBox(topFrame); | ||
897 | new QLabel(i18n("Auto suspend count:"),dummyBox); | ||
898 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | ||
899 | topLayout->addWidget(dummyBox,iii++,0); | ||
900 | |||
901 | |||
902 | |||
903 | |||
904 | |||
905 | |||
906 | |||
907 | QHBox* hbo = new QHBox ( topFrame ); | ||
908 | mDefaultAlarmFile = new QLineEdit(hbo); | ||
909 | QPushButton * loadTemplate = new QPushButton(hbo); | ||
910 | QPixmap icon; | ||
911 | if ( QApplication::desktop()->width() < 321 ) | ||
912 | icon = SmallIcon("fileimport16"); | ||
913 | else | ||
914 | icon = SmallIcon("fileimport"); | ||
915 | loadTemplate->setIconSet (icon ) ; | ||
916 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | ||
917 | int size = loadTemplate->sizeHint().height(); | ||
918 | loadTemplate->setFixedSize( size, size ); | ||
919 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | ||
920 | // topLayout->addWidget(lab ,iii++,0); | ||
921 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | ||
922 | topLayout->addWidget(lab ,iii++,0); | ||
923 | topLayout->addWidget(hbo,iii++,0); | ||
924 | // 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); | ||
925 | |||
926 | // topLayout->addWidget(lab ,iii++,0); | ||
927 | // #ifndef DESKTOP_VERSION | ||
928 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | ||
929 | // #else | ||
930 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | ||
931 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | ||
932 | // #endif | ||
933 | |||
934 | |||
935 | } | ||
936 | |||
937 | void KOPrefsDialog::selectSoundFile() | ||
938 | { | ||
939 | QString fileName = mDefaultAlarmFile->text(); | ||
940 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | ||
941 | if ( fileName.length() > 0 ) | ||
942 | mDefaultAlarmFile->setText( fileName ); | ||
943 | } | ||
944 | void KOPrefsDialog::setupFontsTab() | ||
945 | { | ||
946 | |||
947 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | ||
948 | // DesktopIcon("fonts",KIcon::SizeMedium)); | ||
949 | |||
950 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | ||
951 | topLayout->setSpacing(1); | ||
952 | topLayout->setMargin(3); | ||
953 | KPrefsWidFont * tVFont; | ||
954 | int i = 0; | ||
955 | KPrefsWidFont *timeLabelsFont = | ||
956 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | ||
957 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | ||
958 | topLayout->addWidget(timeLabelsFont->label(),i,0); | ||
959 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | ||
960 | topLayout->addWidget(timeLabelsFont->button(),i,2); | ||
961 | ++i; | ||
962 | |||
963 | |||
964 | timeLabelsFont = | ||
965 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | ||
966 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | ||
967 | topLayout->addWidget(timeLabelsFont->label(),i,0); | ||
968 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | ||
969 | topLayout->addWidget(timeLabelsFont->button(),i,2); | ||
970 | ++i; | ||
971 | |||
972 | KPrefsWidFont *timeBarFont = | ||
973 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | ||
974 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | ||
975 | topLayout->addWidget(timeBarFont->label(),i,0); | ||
976 | topLayout->addWidget(timeBarFont->preview(),i,1); | ||
977 | topLayout->addWidget(timeBarFont->button(),i,2); | ||
978 | ++i; | ||
979 | |||
980 | |||
981 | KPrefsWidFont *marcusBainsFont = | ||
982 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | ||
983 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); | ||
984 | topLayout->addWidget(marcusBainsFont->label(),i,0); | ||
985 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | ||
986 | topLayout->addWidget(marcusBainsFont->button(),i,2); | ||
987 | ++i; | ||
988 | |||
989 | tVFont = | ||
990 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | ||
991 | &(KOPrefs::instance()->mEventViewFont),topFrame); | ||
992 | topLayout->addWidget(tVFont->label(),i,0); | ||
993 | topLayout->addWidget(tVFont->preview(),i,1); | ||
994 | topLayout->addWidget(tVFont->button(),i,2); | ||
995 | ++i; | ||
996 | |||
997 | |||
998 | |||
999 | tVFont = | ||
1000 | addWidFont(i18n("Details"),i18n("EditorBox:"), | ||
1001 | &(KOPrefs::instance()->mEditBoxFont),topFrame); | ||
1002 | topLayout->addWidget(tVFont->label(),i,0); | ||
1003 | topLayout->addWidget(tVFont->preview(),i,1); | ||
1004 | topLayout->addWidget(tVFont->button(),i,2); | ||
1005 | ++i; | ||
1006 | |||
1007 | |||
1008 | |||
1009 | topLayout->setColStretch(1,1); | ||
1010 | topLayout->setRowStretch(4,1); | ||
1011 | |||
1012 | |||
1013 | i = 0; | ||
1014 | topFrame = addPage(i18n("View Fonts"),0, | ||
1015 | DesktopIcon("fonts",KIcon::SizeMedium)); | ||
1016 | |||
1017 | topLayout = new QGridLayout(topFrame,7,3); | ||
1018 | topLayout->setSpacing(1); | ||
1019 | topLayout->setMargin(3); | ||
1020 | |||
1021 | tVFont = | ||
1022 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), | ||
1023 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); | ||
1024 | topLayout->addWidget(tVFont->label(),i,0); | ||
1025 | topLayout->addWidget(tVFont->preview(),i,1); | ||
1026 | topLayout->addWidget(tVFont->button(),i,2); | ||
1027 | ++i; | ||
1028 | KPrefsWidFont *agendaViewFont = | ||
1029 | addWidFont(i18n("Event text"),i18n("Agenda view:"), | ||
1030 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); | ||
1031 | topLayout->addWidget(agendaViewFont->label(),i,0); | ||
1032 | topLayout->addWidget(agendaViewFont->preview(),i,1); | ||
1033 | topLayout->addWidget(agendaViewFont->button(),i,2); | ||
1034 | ++i; | ||
1035 | |||
1036 | |||
1037 | KPrefsWidFont *monthViewFont = | ||
1038 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), | ||
1039 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); | ||
1040 | topLayout->addWidget(monthViewFont->label(),i,0); | ||
1041 | topLayout->addWidget(monthViewFont->preview(),i,1); | ||
1042 | topLayout->addWidget(monthViewFont->button(),i,2); | ||
1043 | ++i; | ||
1044 | |||
1045 | |||
1046 | KPrefsWidFont *lVFont = | ||
1047 | addWidFont(i18n("Event"),i18n("List View:"), | ||
1048 | &(KOPrefs::instance()->mListViewFont),topFrame); | ||
1049 | topLayout->addWidget(lVFont->label(),i,0); | ||
1050 | topLayout->addWidget(lVFont->preview(),i,1); | ||
1051 | topLayout->addWidget(lVFont->button(),i,2); | ||
1052 | ++i; | ||
1053 | |||
1054 | |||
1055 | tVFont = | ||
1056 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), | ||
1057 | &(KOPrefs::instance()->mTodoViewFont),topFrame); | ||
1058 | topLayout->addWidget(tVFont->label(),i,0); | ||
1059 | topLayout->addWidget(tVFont->preview(),i,1); | ||
1060 | topLayout->addWidget(tVFont->button(),i,2); | ||
1061 | ++i; | ||
1062 | |||
1063 | |||
1064 | tVFont = | ||
1065 | addWidFont(i18n("Today"),i18n("JournalView:"), | ||
1066 | &(KOPrefs::instance()->mJornalViewFont),topFrame); | ||
1067 | topLayout->addWidget(tVFont->label(),i,0); | ||
1068 | topLayout->addWidget(tVFont->preview(),i,1); | ||
1069 | topLayout->addWidget(tVFont->button(),i,2); | ||
1070 | ++i; | ||
1071 | |||
1072 | |||
1073 | |||
1074 | |||
1075 | topLayout->setColStretch(1,1); | ||
1076 | topLayout->setRowStretch(4,1); | ||
1077 | |||
1078 | |||
1079 | |||
1080 | |||
1081 | } | ||
1082 | |||
1083 | void KOPrefsDialog::setupColorsTab() | ||
1084 | { | ||
1085 | QFrame *topFrame = addPage(i18n("Colors"),0,0); | ||
1086 | // DesktopIcon("colorize",KIcon::SizeMedium)); | ||
1087 | |||
1088 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | ||
1089 | // topLayout->setSpacing(spacingHint()); | ||
1090 | // topLayout->setMargin(marginHint()); | ||
1091 | |||
1092 | topLayout->setSpacing(2); | ||
1093 | topLayout->setMargin(3); | ||
1094 | |||
1095 | int ii = 1; | ||
1096 | QGroupBox *categoryGroup ; | ||
1097 | |||
1098 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), | ||
1099 | topFrame); | ||
1100 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); | ||
1101 | |||
1102 | mCategoryCombo = new QComboBox(categoryGroup); | ||
1103 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | ||
1104 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); | ||
1105 | |||
1106 | mCategoryButton = new KColorButton(categoryGroup); | ||
1107 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); | ||
1108 | updateCategoryColor(); | ||
1109 | |||
1110 | |||
1111 | // Holiday Color | ||
1112 | |||
1113 | KPrefsWidColor *holidayColor = | ||
1114 | addWidColor(i18n("Holiday color:"), | ||
1115 | &(KOPrefs::instance()->mHolidayColor),topFrame); | ||
1116 | topLayout->addWidget(holidayColor->label(),ii,0); | ||
1117 | topLayout->addWidget(holidayColor->button(),ii++,1); | ||
1118 | |||
1119 | // Highlight Color | ||
1120 | KPrefsWidColor *highlightColor = | ||
1121 | addWidColor(i18n("Highlight color:"), | ||
1122 | &(KOPrefs::instance()->mHighlightColor),topFrame); | ||
1123 | topLayout->addWidget(highlightColor->label(),ii,0); | ||
1124 | topLayout->addWidget(highlightColor->button(),ii++,1); | ||
1125 | |||
1126 | // Event color | ||
1127 | KPrefsWidColor *eventColor = | ||
1128 | addWidColor(i18n("Default event color:"), | ||
1129 | &(KOPrefs::instance()->mEventColor),topFrame); | ||
1130 | topLayout->addWidget(eventColor->label(),ii,0); | ||
1131 | topLayout->addWidget(eventColor->button(),ii++,1); | ||
1132 | |||
1133 | // agenda view background color | ||
1134 | KPrefsWidColor *agendaBgColor = | ||
1135 | addWidColor(i18n("Agenda view background color:"), | ||
1136 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); | ||
1137 | topLayout->addWidget(agendaBgColor->label(),ii,0); | ||
1138 | topLayout->addWidget(agendaBgColor->button(),ii++,1); | ||
1139 | |||
1140 | // working hours color | ||
1141 | KPrefsWidColor *workingHoursColor = | ||
1142 | addWidColor(i18n("Working hours color:"), | ||
1143 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); | ||
1144 | topLayout->addWidget(workingHoursColor->label(),ii,0); | ||
1145 | topLayout->addWidget(workingHoursColor->button(),ii++,1); | ||
1146 | |||
1147 | KPrefsWidBool *sb = | ||
1148 | addWidBool(i18n("Use colors for application:"), | ||
1149 | &(KOPrefs::instance()->mUseAppColors),topFrame); | ||
1150 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); | ||
1151 | |||
1152 | ii++; | ||
1153 | KPrefsWidColor * workingHoursColor1 = | ||
1154 | addWidColor(i18n("Buttons, menus, etc.:"), | ||
1155 | &(KOPrefs::instance()->mAppColor1),topFrame); | ||
1156 | topLayout->addWidget(workingHoursColor1->label(),ii,0); | ||
1157 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); | ||
1158 | |||
1159 | KPrefsWidColor * workingHoursColor2 = | ||
1160 | addWidColor(i18n("Frames, labels, etc.:"), | ||
1161 | &(KOPrefs::instance()->mAppColor2),topFrame); | ||
1162 | topLayout->addWidget(workingHoursColor2->label(),ii,0); | ||
1163 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); | ||
1164 | |||
1165 | |||
1166 | |||
1167 | } | ||
1168 | |||
1169 | void KOPrefsDialog::setCategoryColor() | ||
1170 | { | ||
1171 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); | ||
1172 | } | ||
1173 | |||
1174 | void KOPrefsDialog::updateCategoryColor() | ||
1175 | { | ||
1176 | QString cat = mCategoryCombo->currentText(); | ||
1177 | QColor *color = mCategoryDict.find(cat); | ||
1178 | if (!color) { | ||
1179 | color = KOPrefs::instance()->categoryColor(cat); | ||
1180 | } | ||
1181 | if (color) { | ||
1182 | mCategoryButton->setColor(*color); | ||
1183 | } | ||
1184 | } | ||
1185 | |||
1186 | void KOPrefsDialog::setupPrinterTab() | ||
1187 | { | ||
1188 | mPrinterTab = addPage(i18n("Printing"),0, | ||
1189 | DesktopIcon("fileprint",KIcon::SizeMedium)); | ||
1190 | |||
1191 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); | ||
1192 | topLayout->setSpacing(spacingHint()); | ||
1193 | topLayout->setMargin(marginHint()); | ||
1194 | |||
1195 | topLayout->setRowStretch(4,1); | ||
1196 | } | ||
1197 | |||
1198 | void KOPrefsDialog::setupGroupSchedulingTab() | ||
1199 | { | ||
1200 | #if 0 | ||
1201 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, | ||
1202 | DesktopIcon("personal",KIcon::SizeMedium)); | ||
1203 | |||
1204 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
1205 | topLayout->setSpacing(spacingHint()); | ||
1206 | topLayout->setMargin(marginHint()); | ||
1207 | |||
1208 | #if 0 | ||
1209 | KPrefsWidRadios *schedulerGroup = | ||
1210 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), | ||
1211 | topFrame); | ||
1212 | schedulerGroup->addRadio("Dummy"); // Only for debugging | ||
1213 | schedulerGroup->addRadio(i18n("Mail client")); | ||
1214 | |||
1215 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); | ||
1216 | #endif | ||
1217 | |||
1218 | KPrefsWidRadios *sendGroup = | ||
1219 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), | ||
1220 | topFrame); | ||
1221 | sendGroup->addRadio(i18n("Send to outbox")); | ||
1222 | sendGroup->addRadio(i18n("Send directly")); | ||
1223 | |||
1224 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); | ||
1225 | |||
1226 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); | ||
1227 | mAMails = new QListView(topFrame); | ||
1228 | mAMails->addColumn(i18n("Email"),300); | ||
1229 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); | ||
1230 | |||
1231 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); | ||
1232 | aEmailsEdit = new QLineEdit(topFrame); | ||
1233 | aEmailsEdit->setEnabled(false); | ||
1234 | topLayout->addWidget(aEmailsEdit,4,1); | ||
1235 | |||
1236 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); | ||
1237 | topLayout->addWidget(add,5,0); | ||
1238 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); | ||
1239 | topLayout->addWidget(del,5,1); | ||
1240 | |||
1241 | //topLayout->setRowStretch(2,1); | ||
1242 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); | ||
1243 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); | ||
1244 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); | ||
1245 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); | ||
1246 | #endif | ||
1247 | } | ||
1248 | |||
1249 | void KOPrefsDialog::setupGroupAutomationTab() | ||
1250 | { | ||
1251 | return; | ||
1252 | QFrame *topFrame = addPage(i18n("Group Automation"),0, | ||
1253 | DesktopIcon("personal",KIcon::SizeMedium)); | ||
1254 | |||
1255 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); | ||
1256 | topLayout->setSpacing(spacingHint()); | ||
1257 | topLayout->setMargin(marginHint()); | ||
1258 | |||
1259 | KPrefsWidRadios *autoRefreshGroup = | ||
1260 | addWidRadios(i18n("Auto Send Refresh"), | ||
1261 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); | ||
1262 | autoRefreshGroup->addRadio(i18n("Never")); | ||
1263 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); | ||
1264 | //autoRefreshGroup->addRadio(i18n("selected emails")); | ||
1265 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); | ||
1266 | |||
1267 | KPrefsWidRadios *autoInsertGroup = | ||
1268 | addWidRadios(i18n("Auto Insert IMIP Replies"), | ||
1269 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); | ||
1270 | autoInsertGroup->addRadio(i18n("Never")); | ||
1271 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); | ||
1272 | //autoInsertGroup->addRadio(i18n("selected emails")); | ||
1273 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); | ||
1274 | |||
1275 | KPrefsWidRadios *autoRequestGroup = | ||
1276 | addWidRadios(i18n("Auto Insert IMIP Requests"), | ||
1277 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); | ||
1278 | autoRequestGroup->addRadio(i18n("Never")); | ||
1279 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); | ||
1280 | //autoInsertGroup->addRadio(i18n("selected emails")); | ||
1281 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); | ||
1282 | |||
1283 | KPrefsWidRadios *autoFreeBusyGroup = | ||
1284 | addWidRadios(i18n("Auto Send FreeBusy Information"), | ||
1285 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); | ||
1286 | autoFreeBusyGroup->addRadio(i18n("Never")); | ||
1287 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); | ||
1288 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | ||
1289 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); | ||
1290 | |||
1291 | KPrefsWidRadios *autoFreeBusyReplyGroup = | ||
1292 | addWidRadios(i18n("Auto Save FreeBusy Replies"), | ||
1293 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); | ||
1294 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); | ||
1295 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); | ||
1296 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | ||
1297 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); | ||
1298 | } | ||
1299 | |||
1300 | void KOPrefsDialog::showPrinterTab() | ||
1301 | { | ||
1302 | showPage(pageIndex(mPrinterTab)); | ||
1303 | } | ||
1304 | |||
1305 | |||
1306 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, | ||
1307 | const QStringList *tags) | ||
1308 | { | ||
1309 | if (tags) { | ||
1310 | int i = tags->findIndex(text); | ||
1311 | if (i > 0) combo->setCurrentItem(i); | ||
1312 | } else { | ||
1313 | for(int i=0;i<combo->count();++i) { | ||
1314 | if (combo->text(i) == text) { | ||
1315 | combo->setCurrentItem(i); | ||
1316 | break; | ||
1317 | } | ||
1318 | } | ||
1319 | } | ||
1320 | } | ||
1321 | |||
1322 | void KOPrefsDialog::usrReadConfig() | ||
1323 | { | ||
1324 | mNameEdit->setText(KOPrefs::instance()->fullName()); | ||
1325 | mEmailEdit->setText(KOPrefs::instance()->email()); | ||
1326 | |||
1327 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); | ||
1328 | QDate current ( 2001, 1,1); | ||
1329 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | ||
1330 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | ||
1331 | setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); | ||
1332 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | ||
1333 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); | ||
1334 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); | ||
1335 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); | ||
1336 | // if (KOPrefs::instance()->mAllDaySize > 47 ) | ||
1337 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; | ||
1338 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); | ||
1339 | |||
1340 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); | ||
1341 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); | ||
1342 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); | ||
1343 | // mAMails->clear(); | ||
1344 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); | ||
1345 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { | ||
1346 | // QListViewItem *item = new QListViewItem(mAMails); | ||
1347 | // item->setText(0,*it); | ||
1348 | // mAMails->insertItem(item); | ||
1349 | // } | ||
1350 | |||
1351 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); | ||
1352 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); | ||
1353 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); | ||
1354 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); | ||
1355 | |||
1356 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); | ||
1357 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); | ||
1358 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | ||
1359 | mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | ||
1360 | dummy = KOPrefs::instance()->mUserDateFormatShort; | ||
1361 | mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | ||
1362 | updateCategories(); | ||
1363 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); | ||
1364 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); | ||
1365 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); | ||
1366 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); | ||
1367 | } | ||
1368 | |||
1369 | |||
1370 | void KOPrefsDialog::usrWriteConfig() | ||
1371 | { | ||
1372 | |||
1373 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); | ||
1374 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); | ||
1375 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); | ||
1376 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); | ||
1377 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); | ||
1378 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); | ||
1379 | |||
1380 | KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | ||
1381 | KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | ||
1382 | KOPrefs::instance()->setFullName(mNameEdit->text()); | ||
1383 | KOPrefs::instance()->setEmail(mEmailEdit->text()); | ||
1384 | |||
1385 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); | ||
1386 | |||
1387 | KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); | ||
1388 | QDate date; | ||
1389 | date = mStartDateSavingEdit->date(); | ||
1390 | int sub = 0; | ||
1391 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | ||
1392 | sub = 1; | ||
1393 | KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; | ||
1394 | date = mEndDateSavingEdit->date(); | ||
1395 | if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | ||
1396 | sub = 1; | ||
1397 | else | ||
1398 | sub = 0; | ||
1399 | KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; | ||
1400 | // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); | ||
1401 | |||
1402 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); | ||
1403 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); | ||
1404 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); | ||
1405 | |||
1406 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); | ||
1407 | |||
1408 | QDictIterator<QColor> it(mCategoryDict); | ||
1409 | while (it.current()) { | ||
1410 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); | ||
1411 | ++it; | ||
1412 | } | ||
1413 | |||
1414 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); | ||
1415 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); | ||
1416 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); | ||
1417 | |||
1418 | KOPrefs::instance()->mAdditionalMails.clear(); | ||
1419 | // QListViewItem *item; | ||
1420 | // item = mAMails->firstChild(); | ||
1421 | // while (item) | ||
1422 | // { | ||
1423 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); | ||
1424 | // item = item->nextSibling(); | ||
1425 | // } | ||
1426 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); | ||
1427 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; | ||
1428 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; | ||
1429 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; | ||
1430 | |||
1431 | } | ||
1432 | |||
1433 | void KOPrefsDialog::updateCategories() | ||
1434 | { | ||
1435 | mCategoryCombo->clear(); | ||
1436 | mCategoryDict.clear(); | ||
1437 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | ||
1438 | updateCategoryColor(); | ||
1439 | } | ||
1440 | |||
1441 | void KOPrefsDialog::warningGroupScheduling() | ||
1442 | { | ||
1443 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); | ||
1444 | } | ||
1445 | |||
1446 | void KOPrefsDialog::warningProjectView() | ||
1447 | { | ||
1448 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); | ||
1449 | } | ||
1450 | |||
1451 | void KOPrefsDialog::warningExperimental(bool on) | ||
1452 | { | ||
1453 | if (on) { | ||
1454 | KMessageBox::information(this,i18n("This is an experimental feature. " | ||
1455 | "It may not work, it may do nothing useful and it may cause data loss. " | ||
1456 | "Use with care.\n" | ||
1457 | "You have to restart KOrganizer for this setting to take effect.")); | ||
1458 | } else { | ||
1459 | KMessageBox::information(this, | ||
1460 | i18n("You have to restart KOrganizer for this setting to take effect.")); | ||
1461 | } | ||
1462 | } | ||
1463 | |||
1464 | void KOPrefsDialog::toggleEmailSettings(bool on) | ||
1465 | { | ||
1466 | if (on) { | ||
1467 | mEmailEdit->setEnabled(false); | ||
1468 | mNameEdit->setEnabled(false); | ||
1469 | mEmailLabel->setEnabled(false); | ||
1470 | mNameLabel->setEnabled(false); | ||
1471 | |||
1472 | KEMailSettings settings; | ||
1473 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); | ||
1474 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); | ||
1475 | } else { | ||
1476 | mEmailEdit->setEnabled(true); | ||
1477 | mNameEdit->setEnabled(true); | ||
1478 | mEmailLabel->setEnabled(true); | ||
1479 | mNameLabel->setEnabled(true); | ||
1480 | } | ||
1481 | } | ||
1482 | |||
1483 | void KOPrefsDialog::addItem() | ||
1484 | { | ||
1485 | // aEmailsEdit->setEnabled(true); | ||
1486 | // QListViewItem *item = new QListViewItem(mAMails); | ||
1487 | // mAMails->insertItem(item); | ||
1488 | // mAMails->setSelected(item,true); | ||
1489 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); | ||
1490 | } | ||
1491 | |||
1492 | void KOPrefsDialog::removeItem() | ||
1493 | { | ||
1494 | // QListViewItem *item; | ||
1495 | // item = mAMails->selectedItem(); | ||
1496 | // if (!item) return; | ||
1497 | // mAMails->takeItem(item); | ||
1498 | // item = mAMails->selectedItem(); | ||
1499 | // if (!item) { | ||
1500 | // aEmailsEdit->setText(""); | ||
1501 | // aEmailsEdit->setEnabled(false); | ||
1502 | // } | ||
1503 | // if (mAMails->childCount() == 0) { | ||
1504 | // aEmailsEdit->setEnabled(false); | ||
1505 | // } | ||
1506 | } | ||
1507 | |||
1508 | void KOPrefsDialog::updateItem() | ||
1509 | { | ||
1510 | // QListViewItem *item; | ||
1511 | // item = mAMails->selectedItem(); | ||
1512 | // if (!item) return; | ||
1513 | // item->setText(0,aEmailsEdit->text()); | ||
1514 | } | ||
1515 | |||
1516 | void KOPrefsDialog::updateInput() | ||
1517 | { | ||
1518 | // QListViewItem *item; | ||
1519 | // item = mAMails->selectedItem(); | ||
1520 | // if (!item) return; | ||
1521 | // aEmailsEdit->setEnabled(true); | ||
1522 | // aEmailsEdit->setText(item->text(0)); | ||
1523 | } | ||
1524 | void KOPrefsDialog::updateTimezoneOffset( int index ) | ||
1525 | { | ||
1526 | /* | ||
1527 | qDebug("updateTimezoneOffset %d ", index); | ||
1528 | if ( index < 24 ) { | ||
1529 | mTimezoneOffsetSpin->setEnabled ( false ); | ||
1530 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); | ||
1531 | |||
1532 | |||
1533 | } else { | ||
1534 | if ( index == 24 ) { | ||
1535 | mTimezoneOffsetSpin->setEnabled ( true ); | ||
1536 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | ||
1537 | |||
1538 | } else { | ||
1539 | mTimezoneOffsetSpin->setEnabled ( false ); | ||
1540 | mTimezoneOffsetSpin->setValue( 0 ); | ||
1541 | } | ||
1542 | } | ||
1543 | */ | ||
1544 | } | ||
1545 | |||
1546 | void KOPrefsDialog::setupTimeZoneTab() | ||
1547 | { | ||
1548 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); | ||
1549 | // DesktopIcon("clock",KIcon::SizeMedium)); | ||
1550 | |||
1551 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | ||
1552 | topLayout->setSpacing(spacingHint()); | ||
1553 | topLayout->setMargin(marginHint()); | ||
1554 | |||
1555 | QHBox *timeZoneBox = new QHBox( topFrame ); | ||
1556 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | ||
1557 | |||
1558 | new QLabel( i18n("Timezone:"), timeZoneBox ); | ||
1559 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | ||
1560 | if ( QApplication::desktop()->width() < 300 ) { | ||
1561 | mTimeZoneCombo->setMaximumWidth(150); | ||
1562 | } | ||
1563 | |||
1564 | QStringList list; | ||
1565 | list = KGlobal::locale()->timeZoneList(); | ||
1566 | mTimeZoneCombo->insertStringList(list); | ||
1567 | |||
1568 | // find the currently set time zone and select it | ||
1569 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; | ||
1570 | int nCurrentlySet = 11; | ||
1571 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | ||
1572 | { | ||
1573 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | ||
1574 | { | ||
1575 | nCurrentlySet = i; | ||
1576 | break; | ||
1577 | } | ||
1578 | } | ||
1579 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | ||
1580 | int iii = 1; | ||
1581 | KPrefsWidBool *sb = | ||
1582 | addWidBool(i18n("Timezone has daylight saving"), | ||
1583 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); | ||
1584 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
1585 | ++iii; | ||
1586 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | ||
1587 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | ||
1588 | ++iii; | ||
1589 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | ||
1590 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | ||
1591 | ++iii; | ||
1592 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | ||
1593 | topLayout->addWidget(lab, iii,0); | ||
1594 | mStartDateSavingEdit = new KDateEdit(topFrame); | ||
1595 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | ||
1596 | ++iii; | ||
1597 | |||
1598 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | ||
1599 | topLayout->addWidget(lab, iii,0); | ||
1600 | mEndDateSavingEdit = new KDateEdit(topFrame); | ||
1601 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | ||
1602 | ++iii; | ||
1603 | QDate current ( 2001, 1,1); | ||
1604 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | ||
1605 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | ||
1606 | |||
1607 | |||
1608 | } | ||
1609 | |||
diff --git a/kmicromail/koprefsdialog.h b/kmicromail/koprefsdialog.h new file mode 100644 index 0000000..4b6bd4b --- a/dev/null +++ b/kmicromail/koprefsdialog.h | |||
@@ -0,0 +1,176 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | #ifndef _KOPREFSDIALOG_H | ||
24 | #define _KOPREFSDIALOG_H | ||
25 | |||
26 | #include <qframe.h> | ||
27 | #include <qdict.h> | ||
28 | #include <qcolor.h> | ||
29 | #include <qlistview.h> | ||
30 | |||
31 | #include <kdialogbase.h> | ||
32 | |||
33 | #include <libkdepim/kprefsdialog.h> | ||
34 | #include <libkdepim/kdateedit.h> | ||
35 | |||
36 | class KColorButton; | ||
37 | class QSpinBox; | ||
38 | class QSlider; | ||
39 | class KURLRequester; | ||
40 | class QComboBox; | ||
41 | class QLineEdit; | ||
42 | class QStringList; | ||
43 | |||
44 | /** Dialog to change the korganizer configuration. | ||
45 | */ | ||
46 | class KOPrefsDialog : public KPrefsDialog | ||
47 | { | ||
48 | Q_OBJECT | ||
49 | public: | ||
50 | /** Initialize dialog and pages */ | ||
51 | KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); | ||
52 | ~KOPrefsDialog(); | ||
53 | |||
54 | protected: | ||
55 | void usrReadConfig(); | ||
56 | void usrWriteConfig(); | ||
57 | |||
58 | void setupMainTab(); | ||
59 | void setupMailTab(); | ||
60 | void setupFontsTab(); | ||
61 | private: | ||
62 | QLineEdit *mNameEdit; | ||
63 | QLineEdit *mEmailEdit; | ||
64 | QLabel *mNameLabel; | ||
65 | QLabel *mEmailLabel; | ||
66 | #if 0 | ||
67 | /* | ||
68 | public slots: | ||
69 | void showPrinterTab(); | ||
70 | |||
71 | |||
72 | void updateCategories(); | ||
73 | void showSyncPage(); | ||
74 | protected slots: | ||
75 | void selectSoundFile(); | ||
76 | void setCategoryColor(); | ||
77 | void updateCategoryColor(); | ||
78 | void updateTimezoneOffset( int ); | ||
79 | |||
80 | |||
81 | void warningExperimental(bool on); | ||
82 | void warningGroupScheduling(); | ||
83 | void warningProjectView(); | ||
84 | |||
85 | void toggleEmailSettings(bool); | ||
86 | |||
87 | //additional emails | ||
88 | void addItem(); | ||
89 | void removeItem(); | ||
90 | void updateItem(); | ||
91 | void updateInput(); | ||
92 | */ | ||
93 | protected: | ||
94 | void usrReadConfig(); | ||
95 | void usrWriteConfig(); | ||
96 | |||
97 | void setupMainTab(); | ||
98 | void setupTimeTab(); | ||
99 | void setupTimeZoneTab(); | ||
100 | void setupLocaleTab(); | ||
101 | void setupLocaleDateTab(); | ||
102 | void setupFontsTab(); | ||
103 | void setupColorsTab(); | ||
104 | void setupViewsTab(); | ||
105 | void setupDisplayTab(); | ||
106 | void setupPrinterTab(); | ||
107 | void setupGroupSchedulingTab(); | ||
108 | void setupGroupAutomationTab(); | ||
109 | void setupSyncTab(); | ||
110 | void setupSyncAlgTab(); | ||
111 | |||
112 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); | ||
113 | |||
114 | |||
115 | private: | ||
116 | KPrefsWidBool *mEnableGroupScheduling; | ||
117 | KPrefsWidBool *mEnableProjectView; | ||
118 | |||
119 | QFrame *mPrinterTab; | ||
120 | |||
121 | QLineEdit *nameEdit; | ||
122 | QLineEdit *emailEdit; | ||
123 | |||
124 | QComboBox *timeCombo; | ||
125 | QComboBox *tzCombo; | ||
126 | |||
127 | // widgets holding preferences data | ||
128 | QLineEdit *mNameEdit; | ||
129 | QLineEdit *mEmailEdit; | ||
130 | QLabel *mNameLabel; | ||
131 | QLabel *mEmailLabel; | ||
132 | QLineEdit *mAdditionalEdit; | ||
133 | QSpinBox *mAutoSaveIntervalSpin; | ||
134 | QSpinBox *mPrioSpin; | ||
135 | // QListView *mAMails; | ||
136 | QLineEdit *aEmailsEdit; | ||
137 | |||
138 | QComboBox *mTimeZoneCombo; | ||
139 | QStringList tzonenames; | ||
140 | QSpinBox *mStartTimeSpin; | ||
141 | QSpinBox *mDefaultDurationSpin; | ||
142 | QComboBox *mAlarmTimeCombo; | ||
143 | |||
144 | QComboBox *mCategoryCombo; | ||
145 | KColorButton *mCategoryButton; | ||
146 | QDict<QColor> mCategoryDict; | ||
147 | |||
148 | QSlider *mHourSizeSlider; | ||
149 | |||
150 | QSpinBox *mNextXDaysSpin; | ||
151 | QSpinBox *mWhatsNextSpin; | ||
152 | |||
153 | QLineEdit * mRemoteIPEdit; | ||
154 | QLineEdit * mRemoteUser; | ||
155 | QLineEdit * mRemotePassWd; | ||
156 | QLineEdit * mRemoteFile; | ||
157 | QLineEdit * mLocalTempFile; | ||
158 | QWidget* mSetupSyncAlgTab; | ||
159 | QLineEdit * mUserDateFormatLong; | ||
160 | QLineEdit * mUserDateFormatShort; | ||
161 | |||
162 | QSpinBox *mTimezoneOffsetSpin; | ||
163 | QSpinBox *mDaylightsavingStart; | ||
164 | QSpinBox *mDaylightsavingEnd; | ||
165 | KDateEdit* mStartDateSavingEdit; | ||
166 | KDateEdit* mEndDateSavingEdit; | ||
167 | QSpinBox * mAlarmPlayBeeps; | ||
168 | QSpinBox * mAlarmSuspendTime; | ||
169 | QSpinBox * mAlarmSuspendCount; | ||
170 | QSpinBox * mAlarmBeepInterval; | ||
171 | |||
172 | QLineEdit * mDefaultAlarmFile; | ||
173 | #endif | ||
174 | }; | ||
175 | |||
176 | #endif | ||
diff --git a/kmicromail/koprefsdialog.h~ b/kmicromail/koprefsdialog.h~ new file mode 100644 index 0000000..fd651d0 --- a/dev/null +++ b/kmicromail/koprefsdialog.h~ | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | ||
4 | |||
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 | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
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 | ||
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
18 | |||
19 | As a special exception, permission is given to link this program | ||
20 | with any edition of Qt, and distribute the resulting executable, | ||
21 | without including the source code for Qt in the source distribution. | ||
22 | */ | ||
23 | #ifndef _KOPREFSDIALOG_H | ||
24 | #define _KOPREFSDIALOG_H | ||
25 | |||
26 | #include <qframe.h> | ||
27 | #include <qdict.h> | ||
28 | #include <qcolor.h> | ||
29 | #include <qlistview.h> | ||
30 | |||
31 | #include <kdialogbase.h> | ||
32 | |||
33 | #include <libkdepim/kprefsdialog.h> | ||
34 | #include <libkdepim/kdateedit.h> | ||
35 | |||
36 | class KColorButton; | ||
37 | class QSpinBox; | ||
38 | class QSlider; | ||
39 | class KURLRequester; | ||
40 | class QComboBox; | ||
41 | class QLineEdit; | ||
42 | class QStringList; | ||
43 | |||
44 | /** Dialog to change the korganizer configuration. | ||
45 | */ | ||
46 | class KOPrefsDialog : public KPrefsDialog | ||
47 | { | ||
48 | Q_OBJECT | ||
49 | public: | ||
50 | /** Initialize dialog and pages */ | ||
51 | KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); | ||
52 | ~KOPrefsDialog(); | ||
53 | |||
54 | public slots: | ||
55 | void showPrinterTab(); | ||
56 | |||
57 | /** Update controls for categories */ | ||
58 | void updateCategories(); | ||
59 | void showSyncPage(); | ||
60 | protected slots: | ||
61 | void selectSoundFile(); | ||
62 | void setCategoryColor(); | ||
63 | void updateCategoryColor(); | ||
64 | void updateTimezoneOffset( int ); | ||
65 | |||
66 | |||
67 | void warningExperimental(bool on); | ||
68 | void warningGroupScheduling(); | ||
69 | void warningProjectView(); | ||
70 | |||
71 | void toggleEmailSettings(bool); | ||
72 | |||
73 | //additional emails | ||
74 | void addItem(); | ||
75 | void removeItem(); | ||
76 | void updateItem(); | ||
77 | void updateInput(); | ||
78 | |||
79 | protected: | ||
80 | void usrReadConfig(); | ||
81 | void usrWriteConfig(); | ||
82 | |||
83 | void setupMainTab(); | ||
84 | void setupTimeTab(); | ||
85 | void setupTimeZoneTab(); | ||
86 | void setupLocaleTab(); | ||
87 | void setupLocaleDateTab(); | ||
88 | void setupFontsTab(); | ||
89 | void setupColorsTab(); | ||
90 | void setupViewsTab(); | ||
91 | void setupDisplayTab(); | ||
92 | void setupPrinterTab(); | ||
93 | void setupGroupSchedulingTab(); | ||
94 | void setupGroupAutomationTab(); | ||
95 | void setupSyncTab(); | ||
96 | void setupSyncAlgTab(); | ||
97 | |||
98 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); | ||
99 | |||
100 | |||
101 | private: | ||
102 | KPrefsWidBool *mEnableGroupScheduling; | ||
103 | KPrefsWidBool *mEnableProjectView; | ||
104 | |||
105 | QFrame *mPrinterTab; | ||
106 | |||
107 | QLineEdit *nameEdit; | ||
108 | QLineEdit *emailEdit; | ||
109 | |||
110 | QComboBox *timeCombo; | ||
111 | QComboBox *tzCombo; | ||
112 | |||
113 | // widgets holding preferences data | ||
114 | QLineEdit *mNameEdit; | ||
115 | QLineEdit *mEmailEdit; | ||
116 | QLabel *mNameLabel; | ||
117 | QLabel *mEmailLabel; | ||
118 | QLineEdit *mAdditionalEdit; | ||
119 | QSpinBox *mAutoSaveIntervalSpin; | ||
120 | QSpinBox *mPrioSpin; | ||
121 | // QListView *mAMails; | ||
122 | QLineEdit *aEmailsEdit; | ||
123 | |||
124 | QComboBox *mTimeZoneCombo; | ||
125 | QStringList tzonenames; | ||
126 | QSpinBox *mStartTimeSpin; | ||
127 | QSpinBox *mDefaultDurationSpin; | ||
128 | QComboBox *mAlarmTimeCombo; | ||
129 | |||
130 | QComboBox *mCategoryCombo; | ||
131 | KColorButton *mCategoryButton; | ||
132 | QDict<QColor> mCategoryDict; | ||
133 | |||
134 | QSlider *mHourSizeSlider; | ||
135 | |||
136 | QSpinBox *mNextXDaysSpin; | ||
137 | QSpinBox *mWhatsNextSpin; | ||
138 | |||
139 | QLineEdit * mRemoteIPEdit; | ||
140 | QLineEdit * mRemoteUser; | ||
141 | QLineEdit * mRemotePassWd; | ||
142 | QLineEdit * mRemoteFile; | ||
143 | QLineEdit * mLocalTempFile; | ||
144 | QWidget* mSetupSyncAlgTab; | ||
145 | QLineEdit * mUserDateFormatLong; | ||
146 | QLineEdit * mUserDateFormatShort; | ||
147 | |||
148 | QSpinBox *mTimezoneOffsetSpin; | ||
149 | QSpinBox *mDaylightsavingStart; | ||
150 | QSpinBox *mDaylightsavingEnd; | ||
151 | KDateEdit* mStartDateSavingEdit; | ||
152 | KDateEdit* mEndDateSavingEdit; | ||
153 | QSpinBox * mAlarmPlayBeeps; | ||
154 | QSpinBox * mAlarmSuspendTime; | ||
155 | QSpinBox * mAlarmSuspendCount; | ||
156 | QSpinBox * mAlarmBeepInterval; | ||
157 | |||
158 | QLineEdit * mDefaultAlarmFile; | ||
159 | }; | ||
160 | |||
161 | #endif | ||
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index db29ff3..5362f08 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp | |||
@@ -1,61 +1,62 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | 3 | ||
4 | #ifndef DESKTOP_VERSION | 4 | #ifndef DESKTOP_VERSION |
5 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
6 | #include <libkdepim/externalapphandler.h> | 6 | #include <libkdepim/externalapphandler.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #else | 8 | #else |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qwindowsstyle.h> | 11 | #include <qwindowsstyle.h> |
12 | #include <qplatinumstyle.h> | 12 | #include <qplatinumstyle.h> |
13 | #include <qsgistyle.h> | 13 | #include <qsgistyle.h> |
14 | #endif | 14 | #endif |
15 | #include "opiemail.h" | 15 | #include "opiemail.h" |
16 | #include <qdir.h> | 16 | #include <qdir.h> |
17 | #include <kstandarddirs.h> | 17 | #include <kstandarddirs.h> |
18 | #include <kglobal.h> | 18 | #include <kglobal.h> |
19 | #include <stdio.h> | 19 | #include <stdio.h> |
20 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
21 | #include "koprefs.h" | ||
21 | 22 | ||
22 | //using namespace Opie::Core; | 23 | //using namespace Opie::Core; |
23 | int main( int argc, char **argv ) { | 24 | int main( int argc, char **argv ) { |
24 | 25 | ||
25 | #ifndef DESKTOP_VERSION | 26 | #ifndef DESKTOP_VERSION |
26 | QPEApplication a( argc, argv ); | 27 | QPEApplication a( argc, argv ); |
27 | a.setKeepRunning (); | 28 | a.setKeepRunning (); |
28 | #else | 29 | #else |
29 | QApplication a( argc, argv ); | 30 | QApplication a( argc, argv ); |
30 | QApplication::setStyle( new QPlatinumStyle ()); | 31 | QApplication::setStyle( new QPlatinumStyle ()); |
31 | #endif | 32 | #endif |
32 | 33 | a.setFont( KOPrefs::instance()->mAppFont ); | |
33 | KGlobal::setAppName( "kopiemail" ); | 34 | KGlobal::setAppName( "kopiemail" ); |
34 | QString fileName ; | 35 | QString fileName ; |
35 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
36 | fileName = getenv("QPEDIR"); | 37 | fileName = getenv("QPEDIR"); |
37 | if ( QApplication::desktop()->width() > 320 ) | 38 | if ( QApplication::desktop()->width() > 320 ) |
38 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); | 39 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); |
39 | else | 40 | else |
40 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); | 41 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); |
41 | #else | 42 | #else |
42 | fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/"; | 43 | fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/"; |
43 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 44 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
44 | #endif | 45 | #endif |
45 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); | 46 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); |
46 | OpieMail mw; | 47 | OpieMail mw; |
47 | #ifndef DESKTOP_VERSION | 48 | #ifndef DESKTOP_VERSION |
48 | //qDebug("CONNECT "); | 49 | //qDebug("CONNECT "); |
49 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); | 50 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); |
50 | // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 51 | // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
51 | a.showMainWidget(&mw ); | 52 | a.showMainWidget(&mw ); |
52 | #else | 53 | #else |
53 | a.setMainWidget(&mw ); | 54 | a.setMainWidget(&mw ); |
54 | mw.show(); | 55 | mw.show(); |
55 | //m.resize( 800, 600 ); | 56 | //m.resize( 800, 600 ); |
56 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 57 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
57 | #endif | 58 | #endif |
58 | int rv = a.exec(); | 59 | int rv = a.exec(); |
59 | return rv; | 60 | return rv; |
60 | 61 | ||
61 | } | 62 | } |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 19ffdb3..4e7c6be 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,449 +1,457 @@ | |||
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 "settingsdialog.h" | 4 | #include "settingsdialog.h" |
5 | #include "opiemail.h" | 5 | #include "opiemail.h" |
6 | #include "editaccounts.h" | 6 | #include "editaccounts.h" |
7 | #include "composemail.h" | 7 | #include "composemail.h" |
8 | #include "mailistviewitem.h" | 8 | #include "mailistviewitem.h" |
9 | #include "viewmail.h" | 9 | #include "viewmail.h" |
10 | #include "selectstore.h" | 10 | #include "selectstore.h" |
11 | #include "selectsmtp.h" | 11 | #include "selectsmtp.h" |
12 | #include "accountitem.h" | 12 | #include "accountitem.h" |
13 | #include "koprefsdialog.h" | ||
13 | 14 | ||
14 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
15 | #include <qtimer.h> | 16 | #include <qtimer.h> |
16 | #include <libkdepim/externalapphandler.h> | 17 | #include <libkdepim/externalapphandler.h> |
17 | 18 | ||
18 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
19 | #include <libmailwrapper/smtpwrapper.h> | 20 | #include <libmailwrapper/smtpwrapper.h> |
20 | #include <libmailwrapper/mailtypes.h> | 21 | #include <libmailwrapper/mailtypes.h> |
21 | #include <libmailwrapper/abstractmail.h> | 22 | #include <libmailwrapper/abstractmail.h> |
22 | /* OPIE */ | 23 | /* OPIE */ |
23 | //#include <qpe/resource.h> | 24 | //#include <qpe/resource.h> |
24 | //#include <qpe/qpeapplication.h> | 25 | //#include <qpe/qpeapplication.h> |
25 | 26 | ||
26 | /* QT */ | 27 | /* QT */ |
27 | 28 | ||
28 | //using namespace Opie::Core; | 29 | //using namespace Opie::Core; |
29 | 30 | ||
30 | OpieMail::OpieMail( QWidget *parent, const char *name ) | 31 | OpieMail::OpieMail( QWidget *parent, const char *name ) |
31 | : MainWindow( parent, name) //, WStyle_ContextHelp ) | 32 | : MainWindow( parent, name) //, WStyle_ContextHelp ) |
32 | { | 33 | { |
33 | settings = new Settings(); | 34 | settings = new Settings(); |
34 | 35 | ||
35 | folderView->populate( settings->getAccounts() ); | 36 | folderView->populate( settings->getAccounts() ); |
36 | 37 | ||
37 | } | 38 | } |
38 | 39 | ||
39 | OpieMail::~OpieMail() | 40 | OpieMail::~OpieMail() |
40 | { | 41 | { |
41 | if (settings) delete settings; | 42 | if (settings) delete settings; |
42 | } | 43 | } |
43 | 44 | ||
44 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 45 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
45 | { | 46 | { |
46 | 47 | ||
47 | } | 48 | } |
48 | #include <stdlib.h> | 49 | #include <stdlib.h> |
49 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 50 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
50 | { | 51 | { |
51 | // copied from old mail2 | 52 | // copied from old mail2 |
52 | static int ii = 0; | 53 | static int ii = 0; |
53 | //qDebug("QCOP CALL ############################# %d ", ii); | 54 | //qDebug("QCOP CALL ############################# %d ", ii); |
54 | //QString mess ( msg ); | 55 | //QString mess ( msg ); |
55 | //qDebug("Message = %s ",mess.latin1()); | 56 | //qDebug("Message = %s ",mess.latin1()); |
56 | ++ii; | 57 | ++ii; |
57 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 58 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
58 | 59 | ||
59 | mPendingEmail = QString::null; | 60 | mPendingEmail = QString::null; |
60 | mPendingName = QString::null; | 61 | mPendingName = QString::null; |
61 | if (msg == "writeMail(QString,QString)") | 62 | if (msg == "writeMail(QString,QString)") |
62 | { | 63 | { |
63 | //qDebug("writeMail(QString,QString) "); | 64 | //qDebug("writeMail(QString,QString) "); |
64 | QDataStream stream(data,IO_ReadOnly); | 65 | QDataStream stream(data,IO_ReadOnly); |
65 | stream >> mPendingName >> mPendingEmail; | 66 | stream >> mPendingName >> mPendingEmail; |
66 | // removing the whitespaces at beginning and end is needed! | 67 | // removing the whitespaces at beginning and end is needed! |
67 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 68 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
68 | } | 69 | } |
69 | else if (msg == "newMail()") | 70 | else if (msg == "newMail()") |
70 | { | 71 | { |
71 | //qDebug("slotComposeMail() "); | 72 | //qDebug("slotComposeMail() "); |
72 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call | 73 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call |
73 | // and a QCOP call does not like a processevents in his execution | 74 | // and a QCOP call does not like a processevents in his execution |
74 | // with the Qtimer we call slotComposeMail() after we reached the main event loop | 75 | // with the Qtimer we call slotComposeMail() after we reached the main event loop |
75 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 76 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
76 | // slotComposeMail(); | 77 | // slotComposeMail(); |
77 | } | 78 | } |
78 | else if (msg == "newMail(QString)") | 79 | else if (msg == "newMail(QString)") |
79 | { | 80 | { |
80 | //qDebug(" newMail(QString)"); | 81 | //qDebug(" newMail(QString)"); |
81 | QDataStream stream(data,IO_ReadOnly); | 82 | QDataStream stream(data,IO_ReadOnly); |
82 | stream >> mPendingName; | 83 | stream >> mPendingName; |
83 | // the format is | 84 | // the format is |
84 | // NAME <EMAIL>:SUBJECT | 85 | // NAME <EMAIL>:SUBJECT |
85 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 86 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
86 | } else { | 87 | } else { |
87 | if ( ii == 1 ) { | 88 | mPendingData = data; |
88 | qDebug("Kopiemail::Error:: Initial QCOP call for ExternalAppHandler not supported "); | 89 | mPendingMessage = msg; |
89 | return; | 90 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); |
90 | } | ||
91 | ExternalAppHandler::instance()->appMessage ( msg, data); | ||
92 | } | 91 | } |
93 | 92 | ||
94 | //qDebug("END OpieMail::message "); | 93 | //qDebug("END OpieMail::message "); |
95 | } | 94 | } |
95 | void OpieMail::slotExtAppHandler() | ||
96 | { | ||
97 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); | ||
98 | } | ||
96 | void OpieMail::slotwriteMail2(const QString& namemail ) | 99 | void OpieMail::slotwriteMail2(const QString& namemail ) |
97 | { | 100 | { |
98 | //qDebug("OpieMail::slotwriteMail2 "); | 101 | //qDebug("OpieMail::slotwriteMail2 "); |
99 | //qApp->processEvents(); | 102 | //qApp->processEvents(); |
100 | ComposeMail compose( settings, this, 0, true ); | 103 | ComposeMail compose( settings, this, 0, true ); |
101 | if ( !namemail.isEmpty() ) { | 104 | if ( !namemail.isEmpty() ) { |
102 | QString to = namemail; | 105 | QString to = namemail; |
103 | if ( namemail.find( " <") > 1 ) { | 106 | if ( namemail.find( " <") > 1 ) { |
104 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 107 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
105 | } else | 108 | } else |
106 | if ( namemail.find( "<") > 1 ) { | 109 | if ( namemail.find( "<") > 1 ) { |
107 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 110 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
108 | } | 111 | } |
109 | int sub = to.find( ">:"); | 112 | int sub = to.find( ">:"); |
110 | if ( sub > 0 ) { | 113 | if ( sub > 0 ) { |
111 | compose.setTo( to.left(sub+1) ); | 114 | compose.setTo( to.left(sub+1) ); |
112 | compose.setSubject( to.mid(sub+2) ); | 115 | compose.setSubject( to.mid(sub+2) ); |
113 | } else | 116 | } else |
114 | compose.setTo( to ); | 117 | compose.setTo( to ); |
115 | } | 118 | } |
116 | compose.slotAdjustColumns(); | 119 | compose.slotAdjustColumns(); |
117 | compose.showMaximized(); | 120 | compose.showMaximized(); |
118 | compose.exec(); | 121 | compose.exec(); |
119 | raise(); | 122 | raise(); |
120 | //qDebug("retttich "); | 123 | //qDebug("retttich "); |
121 | } | 124 | } |
122 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 125 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
123 | { | 126 | { |
124 | // qDebug("OpieMail::slotwriteMail "); | 127 | // qDebug("OpieMail::slotwriteMail "); |
125 | ComposeMail compose( settings, this, 0, true ); | 128 | ComposeMail compose( settings, this, 0, true ); |
126 | if (!email.isEmpty()) | 129 | if (!email.isEmpty()) |
127 | { | 130 | { |
128 | if (!name.isEmpty()) | 131 | if (!name.isEmpty()) |
129 | { | 132 | { |
130 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 133 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
131 | } | 134 | } |
132 | else | 135 | else |
133 | { | 136 | { |
134 | compose.setTo(email); | 137 | compose.setTo(email); |
135 | } | 138 | } |
136 | } | 139 | } |
137 | compose.slotAdjustColumns(); | 140 | compose.slotAdjustColumns(); |
138 | compose.showMaximized(); | 141 | compose.showMaximized(); |
139 | compose.exec(); | 142 | compose.exec(); |
140 | raise(); | 143 | raise(); |
141 | } | 144 | } |
142 | 145 | ||
143 | void OpieMail::slotComposeMail() | 146 | void OpieMail::slotComposeMail() |
144 | { | 147 | { |
145 | if ( mPendingEmail == QString::null && mPendingName == QString::null) | 148 | if ( mPendingEmail == QString::null && mPendingName == QString::null) |
146 | slotwriteMail2( QString () ); | 149 | slotwriteMail2( QString () ); |
147 | else { | 150 | else { |
148 | if ( mPendingEmail == QString::null ) | 151 | if ( mPendingEmail == QString::null ) |
149 | slotwriteMail2( mPendingName ); | 152 | slotwriteMail2( mPendingName ); |
150 | else | 153 | else |
151 | slotwriteMail( mPendingName, mPendingEmail ); | 154 | slotwriteMail( mPendingName, mPendingEmail ); |
152 | } | 155 | } |
153 | //slotwriteMail(0l,0l); | 156 | //slotwriteMail(0l,0l); |
154 | } | 157 | } |
155 | 158 | ||
156 | void OpieMail::slotSendQueued() | 159 | void OpieMail::slotSendQueued() |
157 | { | 160 | { |
158 | SMTPaccount *smtp = 0; | 161 | SMTPaccount *smtp = 0; |
159 | 162 | ||
160 | QList<Account> list = settings->getAccounts(); | 163 | QList<Account> list = settings->getAccounts(); |
161 | QList<SMTPaccount> smtpList; | 164 | QList<SMTPaccount> smtpList; |
162 | smtpList.setAutoDelete(false); | 165 | smtpList.setAutoDelete(false); |
163 | Account *it; | 166 | Account *it; |
164 | for ( it = list.first(); it; it = list.next() ) | 167 | for ( it = list.first(); it; it = list.next() ) |
165 | { | 168 | { |
166 | if ( it->getType() == MAILLIB::A_SMTP ) | 169 | if ( it->getType() == MAILLIB::A_SMTP ) |
167 | { | 170 | { |
168 | smtp = static_cast<SMTPaccount *>(it); | 171 | smtp = static_cast<SMTPaccount *>(it); |
169 | smtpList.append(smtp); | 172 | smtpList.append(smtp); |
170 | } | 173 | } |
171 | } | 174 | } |
172 | if (smtpList.count()==0) | 175 | if (smtpList.count()==0) |
173 | { | 176 | { |
174 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); | 177 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); |
175 | return; | 178 | return; |
176 | } | 179 | } |
177 | if (smtpList.count()==1) | 180 | if (smtpList.count()==1) |
178 | { | 181 | { |
179 | smtp = smtpList.at(0); | 182 | smtp = smtpList.at(0); |
180 | } | 183 | } |
181 | else | 184 | else |
182 | { | 185 | { |
183 | smtp = 0; | 186 | smtp = 0; |
184 | selectsmtp selsmtp; | 187 | selectsmtp selsmtp; |
185 | selsmtp.setSelectionlist(&smtpList); | 188 | selsmtp.setSelectionlist(&smtpList); |
186 | selsmtp.showMaximized(); | 189 | selsmtp.showMaximized(); |
187 | if ( selsmtp.exec() == QDialog::Accepted ) | 190 | if ( selsmtp.exec() == QDialog::Accepted ) |
188 | { | 191 | { |
189 | smtp = selsmtp.selected_smtp(); | 192 | smtp = selsmtp.selected_smtp(); |
190 | } | 193 | } |
191 | } | 194 | } |
192 | if (smtp) | 195 | if (smtp) |
193 | { | 196 | { |
194 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 197 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
195 | if ( wrap->flushOutbox() ) | 198 | if ( wrap->flushOutbox() ) |
196 | { | 199 | { |
197 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 200 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
198 | } | 201 | } |
199 | delete wrap; | 202 | delete wrap; |
200 | } | 203 | } |
201 | } | 204 | } |
202 | 205 | ||
203 | void OpieMail::slotSearchMails() | 206 | void OpieMail::slotSearchMails() |
204 | { | 207 | { |
205 | qDebug("OpieMail::slotSearchMails():not implemented "); | 208 | qDebug("OpieMail::slotSearchMails():not implemented "); |
206 | } | 209 | } |
207 | 210 | ||
208 | void OpieMail::slotEditSettings() | 211 | void OpieMail::slotEditSettings() |
209 | { | 212 | { |
213 | #if 0 | ||
210 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 214 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
211 | settingsDialog.showMaximized(); | 215 | settingsDialog.showMaximized(); |
212 | settingsDialog.exec(); | 216 | settingsDialog.exec(); |
217 | #endif | ||
218 | KOPrefsDialog settingsDialog( this, "koprefs", true ); | ||
219 | settingsDialog.showMaximized(); | ||
220 | settingsDialog.exec(); | ||
213 | } | 221 | } |
214 | 222 | ||
215 | void OpieMail::slotEditAccounts() | 223 | void OpieMail::slotEditAccounts() |
216 | { | 224 | { |
217 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 225 | EditAccounts eaDialog( settings, this, 0, true ); |
218 | eaDialog.slotAdjustColumns(); | 226 | eaDialog.slotAdjustColumns(); |
219 | eaDialog.showMaximized(); | 227 | eaDialog.showMaximized(); |
220 | eaDialog.exec(); | 228 | eaDialog.exec(); |
221 | if ( settings ) delete settings; | 229 | if ( settings ) delete settings; |
222 | settings = new Settings(); | 230 | settings = new Settings(); |
223 | 231 | ||
224 | folderView->populate( settings->getAccounts() ); | 232 | folderView->populate( settings->getAccounts() ); |
225 | } | 233 | } |
226 | 234 | ||
227 | void OpieMail::displayMail() | 235 | void OpieMail::displayMail() |
228 | { | 236 | { |
229 | QListViewItem*item = mailView->currentItem(); | 237 | QListViewItem*item = mailView->currentItem(); |
230 | if (!item) return; | 238 | if (!item) return; |
231 | RecMailP mail = ((MailListViewItem*)item)->data(); | 239 | RecMailP mail = ((MailListViewItem*)item)->data(); |
232 | RecBodyP body = folderView->fetchBody(mail); | 240 | RecBodyP body = folderView->fetchBody(mail); |
233 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 241 | ViewMail readMail( this,"", Qt::WType_Modal ); |
234 | readMail.setBody( body ); | 242 | readMail.setBody( body ); |
235 | readMail.setMail( mail ); | 243 | readMail.setMail( mail ); |
236 | readMail.showMaximized(); | 244 | readMail.showMaximized(); |
237 | readMail.exec(); | 245 | readMail.exec(); |
238 | 246 | ||
239 | if ( readMail.deleted ) | 247 | if ( readMail.deleted ) |
240 | { | 248 | { |
241 | folderView->refreshCurrent(); | 249 | folderView->refreshCurrent(); |
242 | } | 250 | } |
243 | else | 251 | else |
244 | { | 252 | { |
245 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 253 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
246 | } | 254 | } |
247 | } | 255 | } |
248 | void OpieMail::slotGetMail() | 256 | void OpieMail::slotGetMail() |
249 | { | 257 | { |
250 | QListViewItem * item = folderView->currentItem(); | 258 | QListViewItem * item = folderView->currentItem(); |
251 | if ( ! item ) return; | 259 | if ( ! item ) return; |
252 | while ( item->parent () ) | 260 | while ( item->parent () ) |
253 | item = item->parent (); | 261 | item = item->parent (); |
254 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 262 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
255 | } | 263 | } |
256 | void OpieMail::slotDeleteMail() | 264 | void OpieMail::slotDeleteMail() |
257 | { | 265 | { |
258 | if (!mailView->currentItem()) return; | 266 | if (!mailView->currentItem()) return; |
259 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 267 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
260 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 268 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
261 | { | 269 | { |
262 | mail->Wrapper()->deleteMail( mail ); | 270 | mail->Wrapper()->deleteMail( mail ); |
263 | folderView->refreshCurrent(); | 271 | folderView->refreshCurrent(); |
264 | } | 272 | } |
265 | } | 273 | } |
266 | void OpieMail::slotDeleteAllMail() | 274 | void OpieMail::slotDeleteAllMail() |
267 | { | 275 | { |
268 | 276 | ||
269 | QValueList<RecMailP> t; | 277 | QValueList<RecMailP> t; |
270 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 278 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
271 | { | 279 | { |
272 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 280 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
273 | while ( item ) { | 281 | while ( item ) { |
274 | if ( item->isSelected() ) { | 282 | if ( item->isSelected() ) { |
275 | t.append( item->data() ); | 283 | t.append( item->data() ); |
276 | } | 284 | } |
277 | item = (MailListViewItem*)item->nextSibling(); | 285 | item = (MailListViewItem*)item->nextSibling(); |
278 | } | 286 | } |
279 | } | 287 | } |
280 | else | 288 | else |
281 | return; | 289 | return; |
282 | if ( t.count() == 0 ) | 290 | if ( t.count() == 0 ) |
283 | return; | 291 | return; |
284 | RecMailP mail = t.first(); | 292 | RecMailP mail = t.first(); |
285 | mail->Wrapper()->deleteMailList(t); | 293 | mail->Wrapper()->deleteMailList(t); |
286 | folderView->refreshCurrent(); | 294 | folderView->refreshCurrent(); |
287 | 295 | ||
288 | 296 | ||
289 | } | 297 | } |
290 | void OpieMail::clearSelection() | 298 | void OpieMail::clearSelection() |
291 | { | 299 | { |
292 | mailView->clearSelection(); | 300 | mailView->clearSelection(); |
293 | 301 | ||
294 | } | 302 | } |
295 | 303 | ||
296 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 304 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
297 | { | 305 | { |
298 | if (!mailView->currentItem()) return; | 306 | if (!mailView->currentItem()) return; |
299 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 307 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
300 | /* just the RIGHT button - or hold on pda */ | 308 | /* just the RIGHT button - or hold on pda */ |
301 | if (button!=2) {return;} | 309 | if (button!=2) {return;} |
302 | if (!item) return; | 310 | if (!item) return; |
303 | QPopupMenu *m = new QPopupMenu(0); | 311 | QPopupMenu *m = new QPopupMenu(0); |
304 | if (m) | 312 | if (m) |
305 | { | 313 | { |
306 | if (mailtype==MAILLIB::A_NNTP) { | 314 | if (mailtype==MAILLIB::A_NNTP) { |
307 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 315 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
308 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 316 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
309 | } else { | 317 | } else { |
310 | if (folderView->currentisDraft()) { | 318 | if (folderView->currentisDraft()) { |
311 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 319 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
312 | } | 320 | } |
313 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 321 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
314 | m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 322 | m->insertItem(tr("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
315 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 323 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
316 | m->insertSeparator(); | 324 | m->insertSeparator(); |
317 | m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 325 | m->insertItem(tr("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
318 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 326 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
319 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); | 327 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); |
320 | } | 328 | } |
321 | m->setFocus(); | 329 | m->setFocus(); |
322 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 330 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
323 | delete m; | 331 | delete m; |
324 | } | 332 | } |
325 | } | 333 | } |
326 | 334 | ||
327 | void OpieMail::slotShowFolders( bool show ) | 335 | void OpieMail::slotShowFolders( bool show ) |
328 | { | 336 | { |
329 | if ( show && folderView->isHidden() ) | 337 | if ( show && folderView->isHidden() ) |
330 | { | 338 | { |
331 | folderView->show(); | 339 | folderView->show(); |
332 | } | 340 | } |
333 | else if ( !show && !folderView->isHidden() ) | 341 | else if ( !show && !folderView->isHidden() ) |
334 | { | 342 | { |
335 | folderView->hide(); | 343 | folderView->hide(); |
336 | } | 344 | } |
337 | } | 345 | } |
338 | 346 | ||
339 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 347 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
340 | { | 348 | { |
341 | MailListViewItem*item = 0; | 349 | MailListViewItem*item = 0; |
342 | mailView->clear(); | 350 | mailView->clear(); |
343 | 351 | ||
344 | QValueList<RecMailP>::ConstIterator it; | 352 | QValueList<RecMailP>::ConstIterator it; |
345 | for (it = list.begin(); it != list.end();++it) | 353 | for (it = list.begin(); it != list.end();++it) |
346 | { | 354 | { |
347 | item = new MailListViewItem(mailView,item); | 355 | item = new MailListViewItem(mailView,item); |
348 | item->storeData((*it)); | 356 | item->storeData((*it)); |
349 | item->showEntry(); | 357 | item->showEntry(); |
350 | } | 358 | } |
351 | } | 359 | } |
352 | 360 | ||
353 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 361 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
354 | { | 362 | { |
355 | mailView->clearSelection(); | 363 | mailView->clearSelection(); |
356 | /* just LEFT button - or tap with stylus on pda */ | 364 | /* just LEFT button - or tap with stylus on pda */ |
357 | //if (button!=1) return; | 365 | //if (button!=1) return; |
358 | if (!item) return; | 366 | if (!item) return; |
359 | if (folderView->currentisDraft()) { | 367 | if (folderView->currentisDraft()) { |
360 | reEditMail(); | 368 | reEditMail(); |
361 | } else { | 369 | } else { |
362 | displayMail(); | 370 | displayMail(); |
363 | } | 371 | } |
364 | } | 372 | } |
365 | 373 | ||
366 | void OpieMail::slotMoveCopyMail() | 374 | void OpieMail::slotMoveCopyMail() |
367 | { | 375 | { |
368 | if (!mailView->currentItem()) return; | 376 | if (!mailView->currentItem()) return; |
369 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 377 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
370 | AbstractMail*targetMail = 0; | 378 | AbstractMail*targetMail = 0; |
371 | QString targetFolder = ""; | 379 | QString targetFolder = ""; |
372 | Selectstore sels; | 380 | Selectstore sels; |
373 | folderView->setupFolderselect(&sels); | 381 | folderView->setupFolderselect(&sels); |
374 | if (!sels.exec()) return; | 382 | if (!sels.exec()) return; |
375 | targetMail = sels.currentMail(); | 383 | targetMail = sels.currentMail(); |
376 | targetFolder = sels.currentFolder(); | 384 | targetFolder = sels.currentFolder(); |
377 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 385 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
378 | targetFolder.isEmpty()) | 386 | targetFolder.isEmpty()) |
379 | { | 387 | { |
380 | return; | 388 | return; |
381 | } | 389 | } |
382 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 390 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
383 | { | 391 | { |
384 | QMessageBox::critical(0,tr("Error creating new Folder"), | 392 | QMessageBox::critical(0,tr("Error creating new Folder"), |
385 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 393 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
386 | return; | 394 | return; |
387 | } | 395 | } |
388 | sels.hide(); | 396 | sels.hide(); |
389 | qApp->processEvents(); | 397 | qApp->processEvents(); |
390 | // qDebug("hiding sels "); | 398 | // qDebug("hiding sels "); |
391 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 399 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
392 | folderView->refreshCurrent(); | 400 | folderView->refreshCurrent(); |
393 | } | 401 | } |
394 | 402 | ||
395 | void OpieMail::slotMoveCopyAllMail() | 403 | void OpieMail::slotMoveCopyAllMail() |
396 | { | 404 | { |
397 | 405 | ||
398 | if (!mailView->currentItem()) return; | 406 | if (!mailView->currentItem()) return; |
399 | QValueList<RecMailP> t; | 407 | QValueList<RecMailP> t; |
400 | // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 408 | // if ( QMessageBox::warning(this, tr("Move/Copy all selected mails"), tr("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
401 | { | 409 | { |
402 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 410 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
403 | while ( item ) { | 411 | while ( item ) { |
404 | if ( item->isSelected() ) { | 412 | if ( item->isSelected() ) { |
405 | t.append( item->data() ); | 413 | t.append( item->data() ); |
406 | } | 414 | } |
407 | item = (MailListViewItem*)item->nextSibling(); | 415 | item = (MailListViewItem*)item->nextSibling(); |
408 | } | 416 | } |
409 | } | 417 | } |
410 | // else | 418 | // else |
411 | // return; | 419 | // return; |
412 | if ( t.count() == 0 ) | 420 | if ( t.count() == 0 ) |
413 | return; | 421 | return; |
414 | RecMailP mail = t.first(); | 422 | RecMailP mail = t.first(); |
415 | AbstractMail*targetMail = 0; | 423 | AbstractMail*targetMail = 0; |
416 | QString targetFolder = ""; | 424 | QString targetFolder = ""; |
417 | Selectstore sels; | 425 | Selectstore sels; |
418 | folderView->setupFolderselect(&sels); | 426 | folderView->setupFolderselect(&sels); |
419 | if (!sels.exec()) return; | 427 | if (!sels.exec()) return; |
420 | targetMail = sels.currentMail(); | 428 | targetMail = sels.currentMail(); |
421 | targetFolder = sels.currentFolder(); | 429 | targetFolder = sels.currentFolder(); |
422 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 430 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
423 | targetFolder.isEmpty()) | 431 | targetFolder.isEmpty()) |
424 | { | 432 | { |
425 | return; | 433 | return; |
426 | } | 434 | } |
427 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 435 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
428 | { | 436 | { |
429 | QMessageBox::critical(0,tr("Error creating new Folder"), | 437 | QMessageBox::critical(0,tr("Error creating new Folder"), |
430 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 438 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
431 | return; | 439 | return; |
432 | } | 440 | } |
433 | sels.hide(); | 441 | sels.hide(); |
434 | qApp->processEvents(); | 442 | qApp->processEvents(); |
435 | //qDebug("hiding sels "); | 443 | //qDebug("hiding sels "); |
436 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); | 444 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); |
437 | folderView->refreshCurrent(); | 445 | folderView->refreshCurrent(); |
438 | } | 446 | } |
439 | 447 | ||
440 | void OpieMail::reEditMail() | 448 | void OpieMail::reEditMail() |
441 | { | 449 | { |
442 | if (!mailView->currentItem()) return; | 450 | if (!mailView->currentItem()) return; |
443 | 451 | ||
444 | ComposeMail compose( settings, this, 0, true ); | 452 | ComposeMail compose( settings, this, 0, true ); |
445 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 453 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
446 | compose.slotAdjustColumns(); | 454 | compose.slotAdjustColumns(); |
447 | compose.showMaximized(); | 455 | compose.showMaximized(); |
448 | compose.exec(); | 456 | compose.exec(); |
449 | } | 457 | } |
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index e054b9e..47264e4 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h | |||
@@ -1,51 +1,54 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef OPIEMAIL_H | 2 | #ifndef OPIEMAIL_H |
3 | #define OPIEMAIL_H | 3 | #define OPIEMAIL_H |
4 | 4 | ||
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | 7 | ||
8 | #include <opie2/osmartpointer.h> | 8 | #include <opie2/osmartpointer.h> |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | 10 | ||
11 | class OpieMail : public MainWindow | 11 | class OpieMail : public MainWindow |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | 14 | ||
15 | public: | 15 | public: |
16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); | 16 | OpieMail( QWidget *parent = 0, const char *name = 0 ); |
17 | virtual ~OpieMail(); | 17 | virtual ~OpieMail(); |
18 | static QString appName() { return QString::fromLatin1("kopiemail"); } | 18 | static QString appName() { return QString::fromLatin1("kopiemail"); } |
19 | 19 | ||
20 | public slots: | 20 | public slots: |
21 | virtual void slotwriteMail(const QString&name,const QString&email); | 21 | virtual void slotwriteMail(const QString&name,const QString&email); |
22 | virtual void slotwriteMail2(const QString&nameemail); | 22 | virtual void slotwriteMail2(const QString&nameemail); |
23 | virtual void slotComposeMail(); | 23 | virtual void slotComposeMail(); |
24 | virtual void slotExtAppHandler(); | ||
24 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 25 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
25 | virtual void message(const QCString &msg, const QByteArray &data); | 26 | virtual void message(const QCString &msg, const QByteArray &data); |
26 | protected slots: | 27 | protected slots: |
27 | virtual void slotSendQueued(); | 28 | virtual void slotSendQueued(); |
28 | virtual void slotSearchMails(); | 29 | virtual void slotSearchMails(); |
29 | virtual void slotEditSettings(); | 30 | virtual void slotEditSettings(); |
30 | virtual void slotEditAccounts(); | 31 | virtual void slotEditAccounts(); |
31 | virtual void displayMail(); | 32 | virtual void displayMail(); |
32 | virtual void slotDeleteMail(); | 33 | virtual void slotDeleteMail(); |
33 | virtual void slotGetMail(); | 34 | virtual void slotGetMail(); |
34 | virtual void slotDeleteAllMail(); | 35 | virtual void slotDeleteAllMail(); |
35 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 36 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
36 | virtual void slotShowFolders( bool show ); | 37 | virtual void slotShowFolders( bool show ); |
37 | virtual void refreshMailView(const QValueList<RecMailP>&); | 38 | virtual void refreshMailView(const QValueList<RecMailP>&); |
38 | virtual void mailLeftClicked( QListViewItem * ); | 39 | virtual void mailLeftClicked( QListViewItem * ); |
39 | virtual void slotMoveCopyMail(); | 40 | virtual void slotMoveCopyMail(); |
40 | virtual void slotMoveCopyAllMail(); | 41 | virtual void slotMoveCopyAllMail(); |
41 | virtual void reEditMail(); | 42 | virtual void reEditMail(); |
42 | void clearSelection(); | 43 | void clearSelection(); |
43 | 44 | ||
44 | private: | 45 | private: |
45 | QString mPendingEmail; | 46 | QString mPendingEmail; |
46 | QString mPendingName; | 47 | QString mPendingName; |
48 | QByteArray mPendingData; | ||
49 | QCString mPendingMessage; | ||
47 | Settings *settings; | 50 | Settings *settings; |
48 | 51 | ||
49 | }; | 52 | }; |
50 | 53 | ||
51 | #endif | 54 | #endif |
diff --git a/kmicromail/settingsdialog.cpp b/kmicromail/settingsdialog.cpp index 061ea72..c593b48 100644 --- a/kmicromail/settingsdialog.cpp +++ b/kmicromail/settingsdialog.cpp | |||
@@ -1,49 +1,89 @@ | |||
1 | #include <qcheckbox.h> | 1 | #include <qcheckbox.h> |
2 | #include <qspinbox.h> | 2 | #include <qspinbox.h> |
3 | #include <qlayout.h> | ||
4 | #include <qtabwidget.h> | ||
3 | 5 | ||
4 | #include <qpe/config.h> | 6 | #include <kconfig.h> |
7 | #include <kprefs.h> | ||
8 | #include <klocale.h> | ||
9 | #include <kglobal.h> | ||
10 | #include <kfontdialog.h> | ||
5 | 11 | ||
6 | #include "settingsdialog.h" | 12 | #include "settingsdialog.h" |
7 | 13 | ||
8 | 14 | ||
9 | SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 15 | SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
10 | : SettingsDialogUI( parent, name, modal, fl ) { | 16 | : SettingsDialogUI( parent, name, modal, fl ) { |
11 | 17 | ||
12 | readConfig(); | 18 | #if 0 |
19 | QTabWidget *topFrame = TabWidget2; | ||
20 | |||
21 | QGridLayout *topLayout = new QGridLayout(topFrame,3,3); | ||
22 | topLayout->setSpacing(2); | ||
23 | topLayout->setMargin(3); | ||
24 | KPrefsWidFont * tVFont; | ||
25 | int i = 0; | ||
26 | KPrefsWidFont *timeLabelsFont = | ||
27 | addWidFont(i18n("OK"),i18n("Application(nr):"), | ||
28 | &(mAppFont),topFrame); | ||
29 | topLayout->addWidget(timeLabelsFont->label(),i,0); | ||
30 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | ||
31 | topLayout->addWidget(timeLabelsFont->button(),i,2); | ||
32 | ++i; | ||
33 | |||
34 | |||
35 | timeLabelsFont = | ||
36 | addWidFont(i18n("Mon 15"),i18n("Compose Mail:"), | ||
37 | &(mComposeFont),topFrame); | ||
38 | topLayout->addWidget(timeLabelsFont->label(),i,0); | ||
39 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | ||
40 | topLayout->addWidget(timeLabelsFont->button(),i,2); | ||
41 | ++i; | ||
42 | |||
43 | KPrefsWidFont *timeBarFont = | ||
44 | addWidFont(i18n("Mon 15"),i18n("Read Mail:"), | ||
45 | &(mReadFont),topFrame); | ||
46 | topLayout->addWidget(timeBarFont->label(),i,0); | ||
47 | topLayout->addWidget(timeBarFont->preview(),i,1); | ||
48 | topLayout->addWidget(timeBarFont->button(),i,2); | ||
49 | ++i; | ||
50 | |||
51 | readConfig(); | ||
52 | #endif | ||
13 | } | 53 | } |
14 | 54 | ||
15 | SettingsDialog::~SettingsDialog() { | 55 | SettingsDialog::~SettingsDialog() { |
16 | 56 | ||
17 | } | 57 | } |
18 | 58 | ||
19 | void SettingsDialog::readConfig() { | 59 | void SettingsDialog::readConfig() { |
20 | Config cfg("mail"); | 60 | KConfig cfg = ( locateLocal("config","kopiemailrc" )); |
21 | cfg.setGroup( "Settings" ); | 61 | cfg.setGroup( "Settings" ); |
22 | showHtmlButton->setChecked( cfg.readBoolEntry( "showHtml", false ) ); | 62 | showHtmlButton->setChecked( cfg.readBoolEntry( "showHtml", false ) ); |
23 | cfg.setGroup( "Compose" ); | 63 | cfg.setGroup( "Compose" ); |
24 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 64 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
25 | cfg.setGroup( "Applet" ); | 65 | cfg.setGroup( "Applet" ); |
26 | cbEnableTaskbarApplet->setChecked( cfg.readBoolEntry( "Disabled", false ) ); | 66 | cbEnableTaskbarApplet->setChecked( cfg.readBoolEntry( "Disabled", false ) ); |
27 | spCheckOften->setValue( cfg.readNumEntry( "CheckEvery", 5 ) ); | 67 | spCheckOften->setValue( cfg.readNumEntry( "CheckEvery", 5 ) ); |
28 | cbBlinkLed->setChecked( cfg.readBoolEntry( "BlinkLed", true ) ); | 68 | cbBlinkLed->setChecked( cfg.readBoolEntry( "BlinkLed", true ) ); |
29 | cbPlaySound->setChecked( cfg.readBoolEntry( "PlaySound", false ) ); | 69 | cbPlaySound->setChecked( cfg.readBoolEntry( "PlaySound", false ) ); |
30 | 70 | ||
31 | } | 71 | } |
32 | 72 | ||
33 | void SettingsDialog::writeConfig() { | 73 | void SettingsDialog::writeConfig() { |
34 | Config cfg( "mail" ); | 74 | KConfig cfg ( locateLocal("config","kopiemailrc" )); |
35 | cfg.setGroup( "Settings" ); | 75 | cfg.setGroup( "Settings" ); |
36 | cfg.writeEntry( "showHtml", showHtmlButton->isChecked() ); | 76 | cfg.writeEntry( "showHtml", showHtmlButton->isChecked() ); |
37 | cfg.setGroup( "Compose" ); | 77 | cfg.setGroup( "Compose" ); |
38 | cfg.writeEntry( "sendLater", checkBoxLater->isChecked() ); | 78 | cfg.writeEntry( "sendLater", checkBoxLater->isChecked() ); |
39 | cfg.setGroup( "Applet" ); | 79 | cfg.setGroup( "Applet" ); |
40 | cfg.writeEntry( "Disabled", cbEnableTaskbarApplet->isChecked() ); | 80 | cfg.writeEntry( "Disabled", cbEnableTaskbarApplet->isChecked() ); |
41 | cfg.writeEntry( "CheckEvery", spCheckOften->value() ); | 81 | cfg.writeEntry( "CheckEvery", spCheckOften->value() ); |
42 | cfg.writeEntry( "BlinkLed", cbBlinkLed->isChecked() ); | 82 | cfg.writeEntry( "BlinkLed", cbBlinkLed->isChecked() ); |
43 | cfg.writeEntry( "PlaySound", cbPlaySound->isChecked() ); | 83 | cfg.writeEntry( "PlaySound", cbPlaySound->isChecked() ); |
44 | } | 84 | } |
45 | 85 | ||
46 | void SettingsDialog::accept() { | 86 | void SettingsDialog::accept() { |
47 | writeConfig(); | 87 | writeConfig(); |
48 | QDialog::accept(); | 88 | QDialog::accept(); |
49 | } | 89 | } |
diff --git a/kmicromail/settingsdialog.h b/kmicromail/settingsdialog.h index 6b4d456..042b69f 100644 --- a/kmicromail/settingsdialog.h +++ b/kmicromail/settingsdialog.h | |||
@@ -1,29 +1,30 @@ | |||
1 | #ifndef SETTINGS_DIALOG_H | 1 | #ifndef SETTINGS_DIALOG_H |
2 | #define SETTINGS_DIALOG_H | 2 | #define SETTINGS_DIALOG_H |
3 | 3 | ||
4 | #include <qwidget.h> | 4 | #include <qwidget.h> |
5 | #include <qfont.h> | ||
5 | 6 | ||
6 | #include "settingsdialogui.h" | 7 | #include "settingsdialogui.h" |
7 | 8 | ||
8 | class SettingsDialog : public SettingsDialogUI { | 9 | class SettingsDialog : public SettingsDialogUI { |
9 | 10 | ||
10 | Q_OBJECT | 11 | Q_OBJECT |
11 | 12 | ||
12 | public: | 13 | public: |
13 | SettingsDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 14 | SettingsDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
14 | ~SettingsDialog(); | 15 | ~SettingsDialog(); |
15 | 16 | ||
16 | private: | 17 | private: |
17 | void readConfig(); | 18 | void readConfig(); |
18 | void writeConfig(); | 19 | void writeConfig(); |
19 | 20 | QFont mAppFont, mComposeFont, mReadFont; | |
20 | 21 | ||
21 | private slots: | 22 | private slots: |
22 | void accept(); | 23 | void accept(); |
23 | 24 | ||
24 | 25 | ||
25 | }; | 26 | }; |
26 | 27 | ||
27 | 28 | ||
28 | 29 | ||
29 | #endif | 30 | #endif |
diff --git a/kmicromail/settingsdialogui.ui b/kmicromail/settingsdialogui.ui index b503667..f1d48a4 100644 --- a/kmicromail/settingsdialogui.ui +++ b/kmicromail/settingsdialogui.ui | |||
@@ -1,296 +1,265 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>SettingsDialogUI</class> | 2 | <class>SettingsDialogUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>SettingsDialogUI</cstring> | 7 | <cstring>SettingsDialogUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>312</width> | 14 | <width>261</width> |
15 | <height>379</height> | 15 | <height>298</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Settings Dialog</string> | 20 | <string>Settings Dialog</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>3</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>3</number> | 35 | <number>3</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>TabWidget2</cstring> | 41 | <cstring>TabWidget2</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>enabled</name> | 44 | <name>enabled</name> |
45 | <bool>true</bool> | 45 | <bool>true</bool> |
46 | </property> | 46 | </property> |
47 | <property> | 47 | <property> |
48 | <name>layoutMargin</name> | 48 | <name>layoutMargin</name> |
49 | </property> | 49 | </property> |
50 | <property> | 50 | <property> |
51 | <name>layoutSpacing</name> | 51 | <name>layoutSpacing</name> |
52 | </property> | 52 | </property> |
53 | <widget> | 53 | <widget> |
54 | <class>QWidget</class> | 54 | <class>QWidget</class> |
55 | <property stdset="1"> | 55 | <property stdset="1"> |
56 | <name>name</name> | 56 | <name>name</name> |
57 | <cstring>tab</cstring> | 57 | <cstring>tab</cstring> |
58 | </property> | 58 | </property> |
59 | <attribute> | 59 | <attribute> |
60 | <name>title</name> | 60 | <name>title</name> |
61 | <string>View Mail</string> | 61 | <string>Mail</string> |
62 | </attribute> | 62 | </attribute> |
63 | <vbox> | 63 | <vbox> |
64 | <property stdset="1"> | 64 | <property stdset="1"> |
65 | <name>margin</name> | 65 | <name>margin</name> |
66 | <number>3</number> | 66 | <number>11</number> |
67 | </property> | 67 | </property> |
68 | <property stdset="1"> | 68 | <property stdset="1"> |
69 | <name>spacing</name> | 69 | <name>spacing</name> |
70 | <number>3</number> | 70 | <number>6</number> |
71 | </property> | 71 | </property> |
72 | <widget> | 72 | <widget> |
73 | <class>QCheckBox</class> | 73 | <class>QCheckBox</class> |
74 | <property stdset="1"> | 74 | <property stdset="1"> |
75 | <name>name</name> | 75 | <name>name</name> |
76 | <cstring>showHtmlButton</cstring> | 76 | <cstring>showHtmlButton</cstring> |
77 | </property> | 77 | </property> |
78 | <property stdset="1"> | 78 | <property stdset="1"> |
79 | <name>text</name> | 79 | <name>text</name> |
80 | <string>View mail as Html</string> | 80 | <string>View mail as Html</string> |
81 | </property> | 81 | </property> |
82 | </widget> | 82 | </widget> |
83 | <spacer> | ||
84 | <property> | ||
85 | <name>name</name> | ||
86 | <cstring>Spacer1</cstring> | ||
87 | </property> | ||
88 | <property stdset="1"> | ||
89 | <name>orientation</name> | ||
90 | <enum>Vertical</enum> | ||
91 | </property> | ||
92 | <property stdset="1"> | ||
93 | <name>sizeType</name> | ||
94 | <enum>Expanding</enum> | ||
95 | </property> | ||
96 | <property> | ||
97 | <name>sizeHint</name> | ||
98 | <size> | ||
99 | <width>20</width> | ||
100 | <height>20</height> | ||
101 | </size> | ||
102 | </property> | ||
103 | </spacer> | ||
104 | </vbox> | ||
105 | </widget> | ||
106 | <widget> | ||
107 | <class>QWidget</class> | ||
108 | <property stdset="1"> | ||
109 | <name>name</name> | ||
110 | <cstring>tab</cstring> | ||
111 | </property> | ||
112 | <attribute> | ||
113 | <name>title</name> | ||
114 | <string>Compose Mail</string> | ||
115 | </attribute> | ||
116 | <vbox> | ||
117 | <property stdset="1"> | ||
118 | <name>margin</name> | ||
119 | <number>3</number> | ||
120 | </property> | ||
121 | <property stdset="1"> | ||
122 | <name>spacing</name> | ||
123 | <number>3</number> | ||
124 | </property> | ||
125 | <widget> | 83 | <widget> |
126 | <class>QCheckBox</class> | 84 | <class>QCheckBox</class> |
127 | <property stdset="1"> | 85 | <property stdset="1"> |
128 | <name>name</name> | 86 | <name>name</name> |
129 | <cstring>checkBoxLater</cstring> | 87 | <cstring>checkBoxLater</cstring> |
130 | </property> | 88 | </property> |
131 | <property stdset="1"> | 89 | <property stdset="1"> |
132 | <name>text</name> | 90 | <name>text</name> |
133 | <string>Send mails later ( enqueue in outbox )</string> | 91 | <string>Send mails later ( enqueue in outbox )</string> |
134 | </property> | 92 | </property> |
135 | </widget> | 93 | </widget> |
136 | <spacer> | 94 | <spacer> |
137 | <property> | 95 | <property> |
138 | <name>name</name> | 96 | <name>name</name> |
139 | <cstring>Spacer2</cstring> | 97 | <cstring>Spacer1</cstring> |
140 | </property> | 98 | </property> |
141 | <property stdset="1"> | 99 | <property stdset="1"> |
142 | <name>orientation</name> | 100 | <name>orientation</name> |
143 | <enum>Vertical</enum> | 101 | <enum>Vertical</enum> |
144 | </property> | 102 | </property> |
145 | <property stdset="1"> | 103 | <property stdset="1"> |
146 | <name>sizeType</name> | 104 | <name>sizeType</name> |
147 | <enum>Expanding</enum> | 105 | <enum>Expanding</enum> |
148 | </property> | 106 | </property> |
149 | <property> | 107 | <property> |
150 | <name>sizeHint</name> | 108 | <name>sizeHint</name> |
151 | <size> | 109 | <size> |
152 | <width>20</width> | 110 | <width>20</width> |
153 | <height>20</height> | 111 | <height>20</height> |
154 | </size> | 112 | </size> |
155 | </property> | 113 | </property> |
156 | </spacer> | 114 | </spacer> |
157 | </vbox> | 115 | </vbox> |
158 | </widget> | 116 | </widget> |
159 | <widget> | 117 | <widget> |
160 | <class>QWidget</class> | 118 | <class>QWidget</class> |
161 | <property stdset="1"> | 119 | <property stdset="1"> |
162 | <name>name</name> | 120 | <name>name</name> |
163 | <cstring>tab</cstring> | 121 | <cstring>tab</cstring> |
164 | </property> | 122 | </property> |
165 | <attribute> | 123 | <attribute> |
166 | <name>title</name> | 124 | <name>title</name> |
125 | <string>Fonts</string> | ||
126 | </attribute> | ||
127 | </widget> | ||
128 | <widget> | ||
129 | <class>QWidget</class> | ||
130 | <property stdset="1"> | ||
131 | <name>name</name> | ||
132 | <cstring>tab</cstring> | ||
133 | </property> | ||
134 | <attribute> | ||
135 | <name>title</name> | ||
167 | <string>Taskbar Applet</string> | 136 | <string>Taskbar Applet</string> |
168 | </attribute> | 137 | </attribute> |
169 | <vbox> | 138 | <vbox> |
170 | <property stdset="1"> | 139 | <property stdset="1"> |
171 | <name>margin</name> | 140 | <name>margin</name> |
172 | <number>3</number> | 141 | <number>3</number> |
173 | </property> | 142 | </property> |
174 | <property stdset="1"> | 143 | <property stdset="1"> |
175 | <name>spacing</name> | 144 | <name>spacing</name> |
176 | <number>3</number> | 145 | <number>3</number> |
177 | </property> | 146 | </property> |
178 | <widget> | 147 | <widget> |
179 | <class>QCheckBox</class> | 148 | <class>QCheckBox</class> |
180 | <property stdset="1"> | 149 | <property stdset="1"> |
181 | <name>name</name> | 150 | <name>name</name> |
182 | <cstring>cbEnableTaskbarApplet</cstring> | 151 | <cstring>cbEnableTaskbarApplet</cstring> |
183 | </property> | 152 | </property> |
184 | <property stdset="1"> | 153 | <property stdset="1"> |
185 | <name>enabled</name> | 154 | <name>enabled</name> |
186 | <bool>false</bool> | 155 | <bool>false</bool> |
187 | </property> | 156 | </property> |
188 | <property stdset="1"> | 157 | <property stdset="1"> |
189 | <name>text</name> | 158 | <name>text</name> |
190 | <string>Disable Taskbar Applet</string> | 159 | <string>Disable Taskbar Applet</string> |
191 | </property> | 160 | </property> |
192 | </widget> | 161 | </widget> |
193 | <widget> | 162 | <widget> |
194 | <class>QLayoutWidget</class> | 163 | <class>QLayoutWidget</class> |
195 | <property stdset="1"> | 164 | <property stdset="1"> |
196 | <name>name</name> | 165 | <name>name</name> |
197 | <cstring>Layout2</cstring> | 166 | <cstring>Layout2</cstring> |
198 | </property> | 167 | </property> |
199 | <hbox> | 168 | <hbox> |
200 | <property stdset="1"> | 169 | <property stdset="1"> |
201 | <name>margin</name> | 170 | <name>margin</name> |
202 | <number>0</number> | 171 | <number>0</number> |
203 | </property> | 172 | </property> |
204 | <property stdset="1"> | 173 | <property stdset="1"> |
205 | <name>spacing</name> | 174 | <name>spacing</name> |
206 | <number>6</number> | 175 | <number>6</number> |
207 | </property> | 176 | </property> |
208 | <widget> | 177 | <widget> |
209 | <class>QSpinBox</class> | 178 | <class>QSpinBox</class> |
210 | <property stdset="1"> | 179 | <property stdset="1"> |
211 | <name>name</name> | 180 | <name>name</name> |
212 | <cstring>spCheckOften</cstring> | 181 | <cstring>spCheckOften</cstring> |
213 | </property> | 182 | </property> |
214 | <property stdset="1"> | 183 | <property stdset="1"> |
215 | <name>enabled</name> | 184 | <name>enabled</name> |
216 | <bool>false</bool> | 185 | <bool>false</bool> |
217 | </property> | 186 | </property> |
218 | <property stdset="1"> | 187 | <property stdset="1"> |
219 | <name>suffix</name> | 188 | <name>suffix</name> |
220 | <string> min</string> | 189 | <string> min</string> |
221 | </property> | 190 | </property> |
222 | <property stdset="1"> | 191 | <property stdset="1"> |
223 | <name>value</name> | 192 | <name>value</name> |
224 | <number>5</number> | 193 | <number>5</number> |
225 | </property> | 194 | </property> |
226 | </widget> | 195 | </widget> |
227 | <widget> | 196 | <widget> |
228 | <class>QLabel</class> | 197 | <class>QLabel</class> |
229 | <property stdset="1"> | 198 | <property stdset="1"> |
230 | <name>name</name> | 199 | <name>name</name> |
231 | <cstring>TextLabel1</cstring> | 200 | <cstring>TextLabel1</cstring> |
232 | </property> | 201 | </property> |
233 | <property stdset="1"> | 202 | <property stdset="1"> |
234 | <name>text</name> | 203 | <name>text</name> |
235 | <string>Check how often</string> | 204 | <string>Check how often</string> |
236 | </property> | 205 | </property> |
237 | </widget> | 206 | </widget> |
238 | </hbox> | 207 | </hbox> |
239 | </widget> | 208 | </widget> |
240 | <widget> | 209 | <widget> |
241 | <class>QCheckBox</class> | 210 | <class>QCheckBox</class> |
242 | <property stdset="1"> | 211 | <property stdset="1"> |
243 | <name>name</name> | 212 | <name>name</name> |
244 | <cstring>cbBlinkLed</cstring> | 213 | <cstring>cbBlinkLed</cstring> |
245 | </property> | 214 | </property> |
246 | <property stdset="1"> | 215 | <property stdset="1"> |
247 | <name>enabled</name> | 216 | <name>enabled</name> |
248 | <bool>false</bool> | 217 | <bool>false</bool> |
249 | </property> | 218 | </property> |
250 | <property stdset="1"> | 219 | <property stdset="1"> |
251 | <name>text</name> | 220 | <name>text</name> |
252 | <string>Blink Led when new mails arrive</string> | 221 | <string>Blink Led when new mails arrive</string> |
253 | </property> | 222 | </property> |
254 | </widget> | 223 | </widget> |
255 | <widget> | 224 | <widget> |
256 | <class>QCheckBox</class> | 225 | <class>QCheckBox</class> |
257 | <property stdset="1"> | 226 | <property stdset="1"> |
258 | <name>name</name> | 227 | <name>name</name> |
259 | <cstring>cbPlaySound</cstring> | 228 | <cstring>cbPlaySound</cstring> |
260 | </property> | 229 | </property> |
261 | <property stdset="1"> | 230 | <property stdset="1"> |
262 | <name>enabled</name> | 231 | <name>enabled</name> |
263 | <bool>false</bool> | 232 | <bool>false</bool> |
264 | </property> | 233 | </property> |
265 | <property stdset="1"> | 234 | <property stdset="1"> |
266 | <name>text</name> | 235 | <name>text</name> |
267 | <string>Play Sound when new mails arrive</string> | 236 | <string>Play Sound when new mails arrive</string> |
268 | </property> | 237 | </property> |
269 | </widget> | 238 | </widget> |
270 | <spacer> | 239 | <spacer> |
271 | <property> | 240 | <property> |
272 | <name>name</name> | 241 | <name>name</name> |
273 | <cstring>Spacer3</cstring> | 242 | <cstring>Spacer3</cstring> |
274 | </property> | 243 | </property> |
275 | <property stdset="1"> | 244 | <property stdset="1"> |
276 | <name>orientation</name> | 245 | <name>orientation</name> |
277 | <enum>Vertical</enum> | 246 | <enum>Vertical</enum> |
278 | </property> | 247 | </property> |
279 | <property stdset="1"> | 248 | <property stdset="1"> |
280 | <name>sizeType</name> | 249 | <name>sizeType</name> |
281 | <enum>Expanding</enum> | 250 | <enum>Expanding</enum> |
282 | </property> | 251 | </property> |
283 | <property> | 252 | <property> |
284 | <name>sizeHint</name> | 253 | <name>sizeHint</name> |
285 | <size> | 254 | <size> |
286 | <width>20</width> | 255 | <width>20</width> |
287 | <height>20</height> | 256 | <height>20</height> |
288 | </size> | 257 | </size> |
289 | </property> | 258 | </property> |
290 | </spacer> | 259 | </spacer> |
291 | </vbox> | 260 | </vbox> |
292 | </widget> | 261 | </widget> |
293 | </widget> | 262 | </widget> |
294 | </vbox> | 263 | </vbox> |
295 | </widget> | 264 | </widget> |
296 | </UI> | 265 | </UI> |
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 67b77f8..6e560d7 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -1,527 +1,527 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | #include "composemail.h" | 2 | #include "composemail.h" |
3 | #include "viewmail.h" | 3 | #include "viewmail.h" |
4 | 4 | ||
5 | #include <libmailwrapper/settings.h> | 5 | #include <libmailwrapper/settings.h> |
6 | #include <libmailwrapper/abstractmail.h> | 6 | #include <libmailwrapper/abstractmail.h> |
7 | #include <libmailwrapper/mailtypes.h> | 7 | #include <libmailwrapper/mailtypes.h> |
8 | #include <kapplication.h> | 8 | #include <kapplication.h> |
9 | 9 | ||
10 | /* OPIE */ | 10 | /* OPIE */ |
11 | //#include <opie2/odebug.h> | 11 | //#include <opie2/odebug.h> |
12 | //#include <opie2/ofiledialog.h> | 12 | //#include <opie2/ofiledialog.h> |
13 | //#include <opie2/oimagescrollview.h> | 13 | //#include <opie2/oimagescrollview.h> |
14 | 14 | ||
15 | #include <kfiledialog.h> | 15 | #include <kfiledialog.h> |
16 | #include <kdialog.h> | 16 | #include <kdialog.h> |
17 | 17 | ||
18 | #include <qpe/config.h> | ||
19 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
20 | 19 | ||
21 | /* QT */ | 20 | /* QT */ |
22 | #include <qtextbrowser.h> | 21 | #include <qtextbrowser.h> |
23 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
24 | #include <qtextstream.h> | 23 | #include <qtextstream.h> |
25 | #include <qaction.h> | 24 | #include <qaction.h> |
26 | #include <qpopupmenu.h> | 25 | #include <qpopupmenu.h> |
27 | #include <qfile.h> | 26 | #include <qfile.h> |
28 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include "koprefs.h" | ||
29 | 29 | ||
30 | //using namespace Opie::Ui; | 30 | //using namespace Opie::Ui; |
31 | //using namespace Opie::Core; | 31 | //using namespace Opie::Core; |
32 | 32 | ||
33 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 33 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
34 | const QString&fsize,int num,const QValueList<int>&path) | 34 | const QString&fsize,int num,const QValueList<int>&path) |
35 | : QListViewItem(parent,after),_partNum(num) | 35 | : QListViewItem(parent,after),_partNum(num) |
36 | { | 36 | { |
37 | _path=path; | 37 | _path=path; |
38 | setText(0, mime); | 38 | setText(0, mime); |
39 | setText(1, desc); | 39 | setText(1, desc); |
40 | setText(2, file); | 40 | setText(2, file); |
41 | setText(3, fsize); | 41 | setText(3, fsize); |
42 | } | 42 | } |
43 | 43 | ||
44 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 44 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
45 | const QString&fsize,int num,const QValueList<int>&path) | 45 | const QString&fsize,int num,const QValueList<int>&path) |
46 | : QListViewItem(parent,after),_partNum(num) | 46 | : QListViewItem(parent,after),_partNum(num) |
47 | { | 47 | { |
48 | _path=path; | 48 | _path=path; |
49 | setText(0, mime); | 49 | setText(0, mime); |
50 | setText(1, desc); | 50 | setText(1, desc); |
51 | setText(2, file); | 51 | setText(2, file); |
52 | setText(3, fsize); | 52 | setText(3, fsize); |
53 | } | 53 | } |
54 | 54 | ||
55 | bool AttachItem::isParentof(const QValueList<int>&path) | 55 | bool AttachItem::isParentof(const QValueList<int>&path) |
56 | { | 56 | { |
57 | /* if not set, then no parent */ | 57 | /* if not set, then no parent */ |
58 | if (path.count()==0||_path.count()==0) return false; | 58 | if (path.count()==0||_path.count()==0) return false; |
59 | /* the parent must have one digit less then a child */ | 59 | /* the parent must have one digit less then a child */ |
60 | if (path.count()!=_path.count()+1) return false; | 60 | if (path.count()!=_path.count()+1) return false; |
61 | for (unsigned int i=0; i < _path.count();++i) | 61 | for (unsigned int i=0; i < _path.count();++i) |
62 | { | 62 | { |
63 | if (_path[i]!=path[i]) return false; | 63 | if (_path[i]!=path[i]) return false; |
64 | } | 64 | } |
65 | return true; | 65 | return true; |
66 | } | 66 | } |
67 | 67 | ||
68 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) | 68 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) |
69 | { | 69 | { |
70 | QListViewItemIterator it( attachments ); | 70 | QListViewItemIterator it( attachments ); |
71 | for ( ; it.current(); ++it ) | 71 | for ( ; it.current(); ++it ) |
72 | { | 72 | { |
73 | AttachItem*ati = (AttachItem*)it.current(); | 73 | AttachItem*ati = (AttachItem*)it.current(); |
74 | if (ati->isParentof(path)) return ati; | 74 | if (ati->isParentof(path)) return ati; |
75 | } | 75 | } |
76 | return 0; | 76 | return 0; |
77 | } | 77 | } |
78 | 78 | ||
79 | AttachItem* ViewMail::lastChild(AttachItem*parent) | 79 | AttachItem* ViewMail::lastChild(AttachItem*parent) |
80 | { | 80 | { |
81 | if (!parent) return 0; | 81 | if (!parent) return 0; |
82 | AttachItem* item = (AttachItem*)parent->firstChild(); | 82 | AttachItem* item = (AttachItem*)parent->firstChild(); |
83 | if (!item) return item; | 83 | if (!item) return item; |
84 | AttachItem*temp=0; | 84 | AttachItem*temp=0; |
85 | while( (temp=(AttachItem*)item->nextSibling())) | 85 | while( (temp=(AttachItem*)item->nextSibling())) |
86 | { | 86 | { |
87 | item = temp; | 87 | item = temp; |
88 | } | 88 | } |
89 | return item; | 89 | return item; |
90 | } | 90 | } |
91 | 91 | ||
92 | void ViewMail::setBody(const RecBodyP&body ) | 92 | void ViewMail::setBody(const RecBodyP&body ) |
93 | { | 93 | { |
94 | 94 | ||
95 | m_body = body; | 95 | m_body = body; |
96 | m_mail[2] = body->Bodytext(); | 96 | m_mail[2] = body->Bodytext(); |
97 | attachbutton->setEnabled(body->Parts().count()>0); | 97 | attachbutton->setEnabled(body->Parts().count()>0); |
98 | attachments->setEnabled(body->Parts().count()>0); | 98 | attachments->setEnabled(body->Parts().count()>0); |
99 | if (body->Parts().count()==0) | 99 | if (body->Parts().count()==0) |
100 | { | 100 | { |
101 | return; | 101 | return; |
102 | } | 102 | } |
103 | AttachItem * curItem=0; | 103 | AttachItem * curItem=0; |
104 | AttachItem * parentItem = 0; | 104 | AttachItem * parentItem = 0; |
105 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); | 105 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); |
106 | QString desc,fsize; | 106 | QString desc,fsize; |
107 | double s = body->Description()->Size(); | 107 | double s = body->Description()->Size(); |
108 | int w; | 108 | int w; |
109 | w=0; | 109 | w=0; |
110 | 110 | ||
111 | while (s>1024) | 111 | while (s>1024) |
112 | { | 112 | { |
113 | s/=1024; | 113 | s/=1024; |
114 | ++w; | 114 | ++w; |
115 | if (w>=2) break; | 115 | if (w>=2) break; |
116 | } | 116 | } |
117 | 117 | ||
118 | QString q=""; | 118 | QString q=""; |
119 | switch(w) | 119 | switch(w) |
120 | { | 120 | { |
121 | case 1: | 121 | case 1: |
122 | q="k"; | 122 | q="k"; |
123 | break; | 123 | break; |
124 | case 2: | 124 | case 2: |
125 | q="M"; | 125 | q="M"; |
126 | break; | 126 | break; |
127 | default: | 127 | default: |
128 | break; | 128 | break; |
129 | } | 129 | } |
130 | 130 | ||
131 | { | 131 | { |
132 | /* I did not found a method to make a CONTENT reset on a QTextStream | 132 | /* I did not found a method to make a CONTENT reset on a QTextStream |
133 | so I use this construct that the stream will re-constructed in each | 133 | so I use this construct that the stream will re-constructed in each |
134 | loop. To let it work, the textstream is packed into a own area of | 134 | loop. To let it work, the textstream is packed into a own area of |
135 | code is it will be destructed after finishing its small job. | 135 | code is it will be destructed after finishing its small job. |
136 | */ | 136 | */ |
137 | QTextOStream o(&fsize); | 137 | QTextOStream o(&fsize); |
138 | if (w>0) o.precision(2); else o.precision(0); | 138 | if (w>0) o.precision(2); else o.precision(0); |
139 | o.setf(QTextStream::fixed); | 139 | o.setf(QTextStream::fixed); |
140 | o << s << " " << q << "Byte"; | 140 | o << s << " " << q << "Byte"; |
141 | } | 141 | } |
142 | 142 | ||
143 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); | 143 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); |
144 | QString filename = ""; | 144 | QString filename = ""; |
145 | 145 | ||
146 | for (unsigned int i = 0; i < body->Parts().count();++i) | 146 | for (unsigned int i = 0; i < body->Parts().count();++i) |
147 | { | 147 | { |
148 | filename = ""; | 148 | filename = ""; |
149 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); | 149 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); |
150 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); | 150 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); |
151 | for (;it!=body->Parts()[i]->Parameters().end();++it) | 151 | for (;it!=body->Parts()[i]->Parameters().end();++it) |
152 | { | 152 | { |
153 | if (it.key().lower()=="name") | 153 | if (it.key().lower()=="name") |
154 | { | 154 | { |
155 | filename=it.data(); | 155 | filename=it.data(); |
156 | } | 156 | } |
157 | } | 157 | } |
158 | s = body->Parts()[i]->Size(); | 158 | s = body->Parts()[i]->Size(); |
159 | w = 0; | 159 | w = 0; |
160 | while (s>1024) | 160 | while (s>1024) |
161 | { | 161 | { |
162 | s/=1024; | 162 | s/=1024; |
163 | ++w; | 163 | ++w; |
164 | if (w>=2) break; | 164 | if (w>=2) break; |
165 | } | 165 | } |
166 | switch(w) | 166 | switch(w) |
167 | { | 167 | { |
168 | case 1: | 168 | case 1: |
169 | q="k"; | 169 | q="k"; |
170 | break; | 170 | break; |
171 | case 2: | 171 | case 2: |
172 | q="M"; | 172 | q="M"; |
173 | break; | 173 | break; |
174 | default: | 174 | default: |
175 | q=""; | 175 | q=""; |
176 | break; | 176 | break; |
177 | } | 177 | } |
178 | QTextOStream o(&fsize); | 178 | QTextOStream o(&fsize); |
179 | if (w>0) o.precision(2); else o.precision(0); | 179 | if (w>0) o.precision(2); else o.precision(0); |
180 | o.setf(QTextStream::fixed); | 180 | o.setf(QTextStream::fixed); |
181 | o << s << " " << q << "Byte"; | 181 | o << s << " " << q << "Byte"; |
182 | desc = body->Parts()[i]->Description(); | 182 | desc = body->Parts()[i]->Description(); |
183 | parentItem = searchParent(body->Parts()[i]->Positionlist()); | 183 | parentItem = searchParent(body->Parts()[i]->Positionlist()); |
184 | if (parentItem) | 184 | if (parentItem) |
185 | { | 185 | { |
186 | AttachItem*temp = lastChild(parentItem); | 186 | AttachItem*temp = lastChild(parentItem); |
187 | if (temp) curItem = temp; | 187 | if (temp) curItem = temp; |
188 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 188 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
189 | attachments->setRootIsDecorated(true); | 189 | attachments->setRootIsDecorated(true); |
190 | curItem = parentItem; | 190 | curItem = parentItem; |
191 | } | 191 | } |
192 | else | 192 | else |
193 | { | 193 | { |
194 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 194 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | 199 | ||
200 | void ViewMail::slotShowHtml( bool state ) | 200 | void ViewMail::slotShowHtml( bool state ) |
201 | { | 201 | { |
202 | m_showHtml = state; | 202 | m_showHtml = state; |
203 | setText(); | 203 | setText(); |
204 | } | 204 | } |
205 | 205 | ||
206 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) | 206 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) |
207 | { | 207 | { |
208 | if (!item ) | 208 | if (!item ) |
209 | return; | 209 | return; |
210 | 210 | ||
211 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 211 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
212 | { | 212 | { |
213 | setText(); | 213 | setText(); |
214 | return; | 214 | return; |
215 | } | 215 | } |
216 | QPopupMenu *menu = new QPopupMenu(); | 216 | QPopupMenu *menu = new QPopupMenu(); |
217 | int ret=0; | 217 | int ret=0; |
218 | 218 | ||
219 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) | 219 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) |
220 | { | 220 | { |
221 | menu->insertItem( tr( "Show Text" ), 1 ); | 221 | menu->insertItem( tr( "Show Text" ), 1 ); |
222 | } | 222 | } |
223 | if (item->text(0).left(6)=="image/") { | 223 | if (item->text(0).left(6)=="image/") { |
224 | menu->insertItem(tr("Display image preview"),2); | 224 | menu->insertItem(tr("Display image preview"),2); |
225 | } | 225 | } |
226 | menu->insertItem( tr( "Save Attachment" ), 0 ); | 226 | menu->insertItem( tr( "Save Attachment" ), 0 ); |
227 | menu->insertSeparator(1); | 227 | menu->insertSeparator(1); |
228 | 228 | ||
229 | ret = menu->exec( point, 0 ); | 229 | ret = menu->exec( point, 0 ); |
230 | 230 | ||
231 | switch(ret) | 231 | switch(ret) |
232 | { | 232 | { |
233 | case 0: | 233 | case 0: |
234 | { | 234 | { |
235 | //MimeTypes types; | 235 | //MimeTypes types; |
236 | //types.insert( "all", "*" ); | 236 | //types.insert( "all", "*" ); |
237 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); | 237 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); |
238 | 238 | ||
239 | if( !str.isEmpty() ) | 239 | if( !str.isEmpty() ) |
240 | { | 240 | { |
241 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 241 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
242 | if (content) | 242 | if (content) |
243 | { | 243 | { |
244 | QFile output(str); | 244 | QFile output(str); |
245 | output.open(IO_WriteOnly); | 245 | output.open(IO_WriteOnly); |
246 | output.writeBlock(content->Content(),content->Length()); | 246 | output.writeBlock(content->Content(),content->Length()); |
247 | output.close(); | 247 | output.close(); |
248 | delete content; | 248 | delete content; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | } | 251 | } |
252 | break ; | 252 | break ; |
253 | 253 | ||
254 | case 2: | 254 | case 2: |
255 | { | 255 | { |
256 | QString tmpfile = "/tmp/opiemail-image"; | 256 | QString tmpfile = "/tmp/opiemail-image"; |
257 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 257 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
258 | if (content) { | 258 | if (content) { |
259 | QFile output(tmpfile); | 259 | QFile output(tmpfile); |
260 | output.open(IO_WriteOnly); | 260 | output.open(IO_WriteOnly); |
261 | output.writeBlock(content->Content(),content->Length()); | 261 | output.writeBlock(content->Content(),content->Length()); |
262 | output.close(); | 262 | output.close(); |
263 | delete content; | 263 | delete content; |
264 | MailImageDlg iview(""); | 264 | MailImageDlg iview(""); |
265 | iview.setName(tmpfile); | 265 | iview.setName(tmpfile); |
266 | KApplication::execDialog(&iview); | 266 | KApplication::execDialog(&iview); |
267 | output.remove(); | 267 | output.remove(); |
268 | } | 268 | } |
269 | } | 269 | } |
270 | break; | 270 | break; |
271 | case 1: | 271 | case 1: |
272 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 272 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
273 | { | 273 | { |
274 | setText(); | 274 | setText(); |
275 | } | 275 | } |
276 | else | 276 | else |
277 | { | 277 | { |
278 | if ( m_recMail->Wrapper() != 0l ) | 278 | if ( m_recMail->Wrapper() != 0l ) |
279 | { // make sure that there is a wrapper , even after delete or simular actions | 279 | { // make sure that there is a wrapper , even after delete or simular actions |
280 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 280 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | break; | 283 | break; |
284 | } | 284 | } |
285 | delete menu; | 285 | delete menu; |
286 | } | 286 | } |
287 | 287 | ||
288 | 288 | ||
289 | void ViewMail::setMail(const RecMailP&mail ) | 289 | void ViewMail::setMail(const RecMailP&mail ) |
290 | { | 290 | { |
291 | 291 | ||
292 | m_recMail = mail; | 292 | m_recMail = mail; |
293 | 293 | ||
294 | m_mail[0] = mail->getFrom(); | 294 | m_mail[0] = mail->getFrom(); |
295 | m_mail[1] = mail->getSubject(); | 295 | m_mail[1] = mail->getSubject(); |
296 | m_mail[3] = mail->getDate(); | 296 | m_mail[3] = mail->getDate(); |
297 | m_mail[4] = mail->Msgid(); | 297 | m_mail[4] = mail->Msgid(); |
298 | 298 | ||
299 | m_mail2[0] = mail->To(); | 299 | m_mail2[0] = mail->To(); |
300 | m_mail2[1] = mail->CC(); | 300 | m_mail2[1] = mail->CC(); |
301 | m_mail2[2] = mail->Bcc(); | 301 | m_mail2[2] = mail->Bcc(); |
302 | 302 | ||
303 | setText(); | 303 | setText(); |
304 | } | 304 | } |
305 | 305 | ||
306 | 306 | ||
307 | 307 | ||
308 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 308 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
309 | : ViewMailBase(parent, name, fl), _inLoop(false) | 309 | : ViewMailBase(parent, name, fl), _inLoop(false) |
310 | { | 310 | { |
311 | m_gotBody = false; | 311 | m_gotBody = false; |
312 | deleted = false; | 312 | deleted = false; |
313 | 313 | ||
314 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); | 314 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); |
315 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); | 315 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); |
316 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); | 316 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); |
317 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); | 317 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); |
318 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 318 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
319 | 319 | ||
320 | attachments->setEnabled(m_gotBody); | 320 | attachments->setEnabled(m_gotBody); |
321 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); | 321 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); |
322 | 322 | ||
323 | readConfig(); | 323 | readConfig(); |
324 | attachments->setSorting(-1); | 324 | attachments->setSorting(-1); |
325 | } | 325 | } |
326 | 326 | ||
327 | void ViewMail::readConfig() | 327 | void ViewMail::readConfig() |
328 | { | 328 | { |
329 | Config cfg( "mail" ); | 329 | |
330 | cfg.setGroup( "Settings" ); | 330 | setFont ( KOPrefs::instance()->mReadFont ); |
331 | m_showHtml = cfg.readBoolEntry( "showHtml", false ); | 331 | m_showHtml = KOPrefs::instance()->mViewAsHtml; |
332 | showHtml->setOn( m_showHtml ); | 332 | showHtml->setOn( m_showHtml ); |
333 | } | 333 | } |
334 | 334 | ||
335 | void ViewMail::setText() | 335 | void ViewMail::setText() |
336 | { | 336 | { |
337 | 337 | ||
338 | QString toString; | 338 | QString toString; |
339 | QString ccString; | 339 | QString ccString; |
340 | QString bccString; | 340 | QString bccString; |
341 | 341 | ||
342 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) | 342 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) |
343 | { | 343 | { |
344 | toString += (*it); | 344 | toString += (*it); |
345 | } | 345 | } |
346 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) | 346 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) |
347 | { | 347 | { |
348 | ccString += (*it); | 348 | ccString += (*it); |
349 | } | 349 | } |
350 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) | 350 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) |
351 | { | 351 | { |
352 | bccString += (*it); | 352 | bccString += (*it); |
353 | } | 353 | } |
354 | 354 | ||
355 | setCaption( tr("E-Mail by %1").arg( m_mail[0] ) ); | 355 | setCaption( tr("E-Mail by %1").arg( m_mail[0] ) ); |
356 | 356 | ||
357 | m_mailHtml = "<html><body>" | 357 | m_mailHtml = "<html><body>" |
358 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" | 358 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" |
359 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" | 359 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" |
360 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" | 360 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" |
361 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" | 361 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" |
362 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + | 362 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + |
363 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" | 363 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" |
364 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + | 364 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + |
365 | "</td></tr></table><font face=fixed>"; | 365 | "</td></tr></table><font>"; |
366 | 366 | ||
367 | if ( !m_showHtml ) | 367 | if ( !m_showHtml ) |
368 | { | 368 | { |
369 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); | 369 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); |
370 | } | 370 | } |
371 | else | 371 | else |
372 | { | 372 | { |
373 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | 373 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); |
374 | } | 374 | } |
375 | // remove later in favor of a real handling | 375 | // remove later in favor of a real handling |
376 | m_gotBody = true; | 376 | m_gotBody = true; |
377 | } | 377 | } |
378 | 378 | ||
379 | 379 | ||
380 | ViewMail::~ViewMail() | 380 | ViewMail::~ViewMail() |
381 | { | 381 | { |
382 | m_recMail->Wrapper()->cleanMimeCache(); | 382 | m_recMail->Wrapper()->cleanMimeCache(); |
383 | hide(); | 383 | hide(); |
384 | } | 384 | } |
385 | 385 | ||
386 | void ViewMail::hide() | 386 | void ViewMail::hide() |
387 | { | 387 | { |
388 | QWidget::hide(); | 388 | QWidget::hide(); |
389 | 389 | ||
390 | if (_inLoop) | 390 | if (_inLoop) |
391 | { | 391 | { |
392 | _inLoop = false; | 392 | _inLoop = false; |
393 | qApp->exit_loop(); | 393 | qApp->exit_loop(); |
394 | 394 | ||
395 | } | 395 | } |
396 | 396 | ||
397 | } | 397 | } |
398 | 398 | ||
399 | void ViewMail::exec() | 399 | void ViewMail::exec() |
400 | { | 400 | { |
401 | show(); | 401 | show(); |
402 | 402 | ||
403 | if (!_inLoop) | 403 | if (!_inLoop) |
404 | { | 404 | { |
405 | _inLoop = true; | 405 | _inLoop = true; |
406 | qApp->enter_loop(); | 406 | qApp->enter_loop(); |
407 | } | 407 | } |
408 | 408 | ||
409 | } | 409 | } |
410 | 410 | ||
411 | QString ViewMail::deHtml(const QString &string) | 411 | QString ViewMail::deHtml(const QString &string) |
412 | { | 412 | { |
413 | QString string_ = string; | 413 | QString string_ = string; |
414 | string_.replace(QRegExp("&"), "&"); | 414 | string_.replace(QRegExp("&"), "&"); |
415 | string_.replace(QRegExp("<"), "<"); | 415 | string_.replace(QRegExp("<"), "<"); |
416 | string_.replace(QRegExp(">"), ">"); | 416 | string_.replace(QRegExp(">"), ">"); |
417 | string_.replace(QRegExp("\\n"), "<br>"); | 417 | string_.replace(QRegExp("\\n"), "<br>"); |
418 | return string_; | 418 | return string_; |
419 | } | 419 | } |
420 | 420 | ||
421 | void ViewMail::slotReply() | 421 | void ViewMail::slotReply() |
422 | { | 422 | { |
423 | if (!m_gotBody) | 423 | if (!m_gotBody) |
424 | { | 424 | { |
425 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); | 425 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); |
426 | return; | 426 | return; |
427 | } | 427 | } |
428 | 428 | ||
429 | QString rtext; | 429 | QString rtext; |
430 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 430 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
431 | .arg( m_mail[0] ) | 431 | .arg( m_mail[0] ) |
432 | .arg( m_mail[3] ); | 432 | .arg( m_mail[3] ); |
433 | 433 | ||
434 | QString text = m_mail[2]; | 434 | QString text = m_mail[2]; |
435 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 435 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
436 | QStringList::Iterator it; | 436 | QStringList::Iterator it; |
437 | for (it = lines.begin(); it != lines.end(); it++) | 437 | for (it = lines.begin(); it != lines.end(); it++) |
438 | { | 438 | { |
439 | rtext += "> " + *it + "\n"; | 439 | rtext += "> " + *it + "\n"; |
440 | } | 440 | } |
441 | rtext += "\n"; | 441 | rtext += "\n"; |
442 | 442 | ||
443 | QString prefix; | 443 | QString prefix; |
444 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 444 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
445 | else prefix = "Re: "; // no i18n on purpose | 445 | else prefix = "Re: "; // no i18n on purpose |
446 | 446 | ||
447 | Settings *settings = new Settings(); | 447 | Settings *settings = new Settings(); |
448 | ComposeMail composer( settings ,this, 0, true); | 448 | ComposeMail composer( settings ,this, 0, true); |
449 | if (m_recMail->Replyto().isEmpty()) { | 449 | if (m_recMail->Replyto().isEmpty()) { |
450 | composer.setTo( m_recMail->getFrom()); | 450 | composer.setTo( m_recMail->getFrom()); |
451 | } else { | 451 | } else { |
452 | composer.setTo( m_recMail->Replyto()); | 452 | composer.setTo( m_recMail->Replyto()); |
453 | } | 453 | } |
454 | composer.setSubject( prefix + m_mail[1] ); | 454 | composer.setSubject( prefix + m_mail[1] ); |
455 | composer.setMessage( rtext ); | 455 | composer.setMessage( rtext ); |
456 | composer.setInReplyTo(m_recMail->Msgid()); | 456 | composer.setInReplyTo(m_recMail->Msgid()); |
457 | 457 | ||
458 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 458 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
459 | { | 459 | { |
460 | m_recMail->Wrapper()->answeredMail(m_recMail); | 460 | m_recMail->Wrapper()->answeredMail(m_recMail); |
461 | } | 461 | } |
462 | } | 462 | } |
463 | 463 | ||
464 | void ViewMail::slotForward() | 464 | void ViewMail::slotForward() |
465 | { | 465 | { |
466 | if (!m_gotBody) | 466 | if (!m_gotBody) |
467 | { | 467 | { |
468 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); | 468 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("Ok")); |
469 | return; | 469 | return; |
470 | } | 470 | } |
471 | 471 | ||
472 | QString ftext; | 472 | QString ftext; |
473 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") | 473 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") |
474 | .arg( m_mail[0] ); | 474 | .arg( m_mail[0] ); |
475 | if (!m_mail[3].isNull()) | 475 | if (!m_mail[3].isNull()) |
476 | ftext += QString("Date: %1\n") | 476 | ftext += QString("Date: %1\n") |
477 | .arg( m_mail[3] ); | 477 | .arg( m_mail[3] ); |
478 | if (!m_mail[0].isNull()) | 478 | if (!m_mail[0].isNull()) |
479 | ftext += QString("From: %1\n") | 479 | ftext += QString("From: %1\n") |
480 | .arg( m_mail[0] ); | 480 | .arg( m_mail[0] ); |
481 | if (!m_mail[1].isNull()) | 481 | if (!m_mail[1].isNull()) |
482 | ftext += QString("Subject: %1\n") | 482 | ftext += QString("Subject: %1\n") |
483 | .arg( m_mail[1] ); | 483 | .arg( m_mail[1] ); |
484 | 484 | ||
485 | ftext += QString("\n%1\n") | 485 | ftext += QString("\n%1\n") |
486 | .arg( m_mail[2]); | 486 | .arg( m_mail[2]); |
487 | 487 | ||
488 | ftext += QString("----- End forwarded message -----\n"); | 488 | ftext += QString("----- End forwarded message -----\n"); |
489 | 489 | ||
490 | Settings *settings = new Settings(); | 490 | Settings *settings = new Settings(); |
491 | ComposeMail composer( settings ,this, 0, true); | 491 | ComposeMail composer( settings ,this, 0, true); |
492 | composer.setSubject( "Fwd: " + m_mail[1] ); | 492 | composer.setSubject( "Fwd: " + m_mail[1] ); |
493 | composer.setMessage( ftext ); | 493 | composer.setMessage( ftext ); |
494 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) | 494 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) |
495 | { | 495 | { |
496 | } | 496 | } |
497 | } | 497 | } |
498 | 498 | ||
499 | void ViewMail::slotDeleteMail( ) | 499 | void ViewMail::slotDeleteMail( ) |
500 | { | 500 | { |
501 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 501 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
502 | { | 502 | { |
503 | m_recMail->Wrapper()->deleteMail( m_recMail ); | 503 | m_recMail->Wrapper()->deleteMail( m_recMail ); |
504 | hide(); | 504 | hide(); |
505 | deleted = true; | 505 | deleted = true; |
506 | } | 506 | } |
507 | } | 507 | } |
508 | 508 | ||
509 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) | 509 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) |
510 | : KDialog(parent,name,modal) | 510 | : KDialog(parent,name,modal) |
511 | { | 511 | { |
512 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 512 | QVBoxLayout*dlglayout = new QVBoxLayout(this); |
513 | dlglayout->setSpacing(2); | 513 | dlglayout->setSpacing(2); |
514 | dlglayout->setMargin(1); | 514 | dlglayout->setMargin(1); |
515 | //m_imageview = new Opie::MM::OImageScrollView(this); | 515 | //m_imageview = new Opie::MM::OImageScrollView(this); |
516 | //dlglayout->addWidget(m_imageview); | 516 | //dlglayout->addWidget(m_imageview); |
517 | } | 517 | } |
518 | 518 | ||
519 | MailImageDlg::~MailImageDlg() | 519 | MailImageDlg::~MailImageDlg() |
520 | { | 520 | { |
521 | } | 521 | } |
522 | 522 | ||
523 | void MailImageDlg::setName(const QString&fname) | 523 | void MailImageDlg::setName(const QString&fname) |
524 | { | 524 | { |
525 | qDebug("viewmail.cpp: MailImageDlg::setName Pending"); | 525 | qDebug("viewmail.cpp: MailImageDlg::setName Pending"); |
526 | // m_imageview->setImage(fname); | 526 | // m_imageview->setImage(fname); |
527 | } | 527 | } |