author | zautrix <zautrix> | 2004-09-15 06:15:59 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-15 06:15:59 (UTC) |
commit | 35b8948c6c203473866c74f1d13185a848454e04 (patch) (side-by-side diff) | |
tree | b6d8eca9863cbca8e24d474d8c895065faa17458 /kmicromail | |
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,182 +1,200 @@ // CHANGED 2004-08-06 Lutz Rogowski #include "composemail.h" #include <libmailwrapper/smtpwrapper.h> #include <libmailwrapper/storemail.h> #include <libmailwrapper/abstractmail.h> #include <libmailwrapper/mailtypes.h> /* OPIE */ //#include <opie2/ofiledialog.h> //#include <opie2/odebug.h> #include <kfiledialog.h> //#include <qpe/resource.h> -#include <qpe/config.h> #include <qpe/global.h> //#include <qpe/contact.h> #include <qcombobox.h> #include <qcheckbox.h> #include <qtimer.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlabel.h> #include <qtabwidget.h> #include <qlistview.h> #include <kabc/addresseedialog.h> #include <kabc/stdaddressbook.h> #include <kabc/addressee.h> #ifdef DESKTOP_VERSION #include <kabc/addresseedialog.h> #else //DESKTOP_VERSION #include <libkdepim/externalapphandler.h> #endif //DESKTOP_VERSION +#include "koprefs.h" //using namespace Opie::Core; //using namespace Opie::Ui; ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal ) : ComposeMailUI( parent, name, modal ) { - mPickLineEdit = 0; connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); settings = s; m_replyid = ""; + if ( KOPrefs::instance()->mUseKapi) { KConfig config( locateLocal("config", "kabcrc") ); config.setGroup( "General" ); QString whoami_uid = config.readEntry( "WhoAmI" ); if ( whoami_uid.isEmpty() ) { QMessageBox::information( 0, tr( "Hint" ), tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), tr( "Ok" ) ); + + fillSettings(); } else ExternalAppHandler::instance()->requestDetailsFromKAPI("", "sendbacklist", whoami_uid); #ifdef DESKTOP_VERSION KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); QStringList mails = con.emails(); QString defmail = con.preferredEmail(); if ( mails.count() == 0) QMessageBox::information( 0, tr( "Hint" ), tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), tr( "Ok" ) ); if (defmail.length()!=0) { fromBox->insertItem(defmail); } QStringList::ConstIterator sit = mails.begin(); for (;sit!=mails.end();++sit) { if ( (*sit)==defmail) continue; fromBox->insertItem((*sit)); } senderNameEdit->setText(con.formattedName()); #endif - Config cfg( "mail" ); - cfg.setGroup( "Compose" ); - checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); + + } else { + fillSettings(); + } + checkBoxLater->setChecked( KOPrefs::instance()->mSendLater ); attList->addColumn( tr( "Name" ) ); attList->addColumn( tr( "Size" ) ); QList<Account> accounts = settings->getAccounts(); + if ( QApplication::desktop()->width() < 320 ) + smtpAccountBox->setMaximumWidth( 80 ); Account *it; for ( it = accounts.first(); it; it = accounts.next() ) { if ( it->getType()==MAILLIB::A_SMTP ) { SMTPaccount *smtp = static_cast<SMTPaccount *>(it); smtpAccountBox->insertItem( smtp->getAccountName() ); smtpAccounts.append( smtp ); } } connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); mMail = 0; warnAttach = true; if ( smtpAccounts.count() > 0 ) { fillValues( smtpAccountBox->currentItem() ); } else { QMessageBox::information( 0, tr( "Problem" ), tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), tr( "Ok" ) ); return; } connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); - + message->setFont ( KOPrefs::instance()->mComposeFont ); } +void ComposeMail::fillSettings() +{ + if ( QApplication::desktop()->width() < 320 ) + fromBox->setMaximumWidth( 100 ); + QStringList mailList = QStringList::split(";",KOPrefs::instance()->mEmail); + QStringList::ConstIterator sit = mailList.begin(); + int pref = 0; + for (;sit!=mailList.end();++sit) { + fromBox->insertItem((*sit)); + } + senderNameEdit->setText(KOPrefs::instance()->mName); +} void ComposeMail::saveAsDraft() { Opie::Core::OSmartPointer<Mail> mail= new Mail(); mail->setMail(fromBox->currentText()); mail->setTo( toLine->text() ); mail->setName(senderNameEdit->text()); mail->setCC( ccLine->text() ); mail->setBCC( bccLine->text() ); mail->setReply( replyLine->text() ); mail->setSubject( subjectLine->text() ); if (!m_replyid.isEmpty()) { QStringList ids; ids.append(m_replyid); mail->setInreply(ids); } QString txt = message->text(); if ( !sigMultiLine->text().isEmpty() ) { txt.append( "\n--\n" ); txt.append( sigMultiLine->text() ); } mail->setMessage( txt ); /* only use the default drafts folder name! */ Storemail wrapper(AbstractMail::draftFolder()); wrapper.storeMail(mail); AttachViewItem *it = (AttachViewItem *) attList->firstChild(); /* attachments we will ignore! */ if ( it != 0 ) { if ( warnAttach ) QMessageBox::warning(0,tr("Store message"), tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); warnAttach = false; } setStatus( tr("Mail saved as draft!") ); } void ComposeMail::clearStatus() { topLevelWidget()->setCaption( tr("Compose mail") ); } void ComposeMail::setStatus( QString status ) { topLevelWidget()->setCaption( status ); QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; } void ComposeMail::pickAddress( ) { QLineEdit *line = mPickLineEdit; if ( line == 0 ) return; #ifdef DESKTOP_VERSION //qDebug(" ComposeMail::pickAddress "); QString names ;//= AddressPicker::getNames(); KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); uint i=0; for (i=0; i < list.count(); i++) { if ( !list[i].preferredEmail().isEmpty()) { if ( ! names.isEmpty() ) names+= ","; 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 @@ #ifndef COMPOSEMAIL_H #define COMPOSEMAIL_H #include <qlineedit.h> #include <qlistview.h> #include "composemailui.h" //#include "addresspickerui.h" #include <libmailwrapper/settings.h> #include <libmailwrapper/mailwrapper.h> class RecMail; #include <opie2/osmartpointer.h> #if 0 class AddressPicker : public AddressPickerUI { //Q_OBJECT public: AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false ); static QString getNames(); protected: QString selectedNames; void accept(); }; #endif class RecMail; class ComposeMail : public ComposeMailUI { Q_OBJECT public: ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false ); virtual ~ComposeMail(); void reEditMail(const Opie::Core::OSmartPointer<RecMail>¤t); public slots: void slotAdjustColumns(); void setTo( const QString & to ); void setSubject( const QString & subject ); void setInReplyTo( const QString & messageId ); void setMessage( const QString & text ); void insertAttendees(const QString&, const QStringList& namelist, const QStringList& emaillist, const QStringList& uidlist); protected slots: void accept(); void reject(); private slots: void fillValues( int current ); + void fillSettings(); void pickAddress(); void pickAddressTo(); void pickAddressCC(); void pickAddressBCC(); void pickAddressReply(); void saveAsDraft(); void addAttachment(); void removeAttachment(); void clearStatus(); void setStatus( QString ); protected: QLineEdit* mPickLineEdit; Opie::Core::OSmartPointer<Mail> mMail; Settings *settings; QList<SMTPaccount> smtpAccounts; QString m_replyid; bool warnAttach; }; class AttachViewItem : public QListViewItem { public: AttachViewItem( QListView *parent, Attachment *att ); Attachment *getAttachment() { return attachment; } private: Attachment *attachment; }; #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 @@ CONFIG += qt warn_on TEMPLATE = app HEADERS = defines.h \ editaccounts.h \ composemail.h \ accountview.h \ accountitem.h \ mainwindow.h \ viewmail.h \ viewmailbase.h \ opiemail.h \ mailistviewitem.h \ settingsdialog.h \ statuswidget.h \ newmaildir.h \ selectstore.h \ selectsmtp.h \ nntpgroups.h \ + koprefs.h \ + koprefsdialog.h \ nntpgroupsdlg.h SOURCES = main.cpp \ opiemail.cpp \ mainwindow.cpp \ accountview.cpp \ accountitem.cpp \ composemail.cpp \ editaccounts.cpp \ viewmail.cpp \ viewmailbase.cpp \ mailistviewitem.cpp \ settingsdialog.cpp \ statuswidget.cpp \ newmaildir.cpp \ selectstore.cpp \ selectsmtp.cpp \ nntpgroups.cpp \ + koprefs.cpp\ + koprefsdialog.cpp\ nntpgroupsdlg.cpp INTERFACES = editaccountsui.ui \ selectmailtypeui.ui \ imapconfigui.ui \ pop3configui.ui \ nntpconfigui.ui \ smtpconfigui.ui \ composemailui.ui \ settingsdialogui.ui \ statuswidgetui.ui \ newmaildirui.ui \ selectstoreui.ui \ nntpgroupsui.ui INCLUDEPATH += . $(KDEPIMDIR) $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore libetpan/include $(KDEPIMDIR)/microkde/kdeui $(QPEDIR)/include LIBS += -L$(QPEDIR)/lib -lkmicromailwrapper -lqpe -lkmicrolibetpan -lmicrokde -lmicroqtcompat -lssl -lcrypto -ljpeg -lmicrokde -lmicroqtcompat -lmicrokabc -lmicrokcal -lmicrokdepim LIBS += $(QTOPIALIB) #LIBS += -lqtopia #next line for Zaurus only #LIBS += -luuid # OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR=$(QPEDIR)/bin TARGET = ompi 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 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include <time.h> +#ifndef _WIN32_ +#include <unistd.h> +#endif +#include <qdir.h> +#include <qtextstream.h> +#include <qtextcodec.h> +#include <qstring.h> +#include <qregexp.h> +#include <qfont.h> +#include <qcolor.h> +#include <qstringlist.h> +#include <stdlib.h> + +#include <kglobal.h> +#include <kconfig.h> +#include <klocale.h> +#include <kdebug.h> +#include <kemailsettings.h> +#include <kstaticdeleter.h> + +#include "koprefs.h" +#include "mainwindow.h" + + +KOPrefs *KOPrefs::mInstance = 0; +static KStaticDeleter<KOPrefs> insd; + +KOPrefs::KOPrefs() : + KPimPrefs("kopiemailrc") +{ + mAppFont = QFont("helvetica",12); + mComposeFont = QFont("helvetica",12); + mReadFont = QFont("helvetica",12); + + KPrefs::setCurrentGroup("General"); + addItemString("SenderName",&mName,i18n ("Please set at") ); + addItemString("SenderEmail",&mEmail,i18n ("Settings@General TAB") ); + addItemBool("ViewMailAsHtml",&mViewAsHtml,false); + addItemBool("SendMailLater",&mSendLater,true); + addItemBool("UseKapi",&mUseKapi,false); + + KPrefs::setCurrentGroup("Fonts"); + addItemFont("Application Font",&mAppFont); + addItemFont("Compose Font",&mComposeFont); + addItemFont("Read Font",&mReadFont); + +#if 0 + mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); + mDefaultViewFont = QFont("helvetica",10); + mDefaultMonthViewFont = QFont("helvetica",8); + mMarcusBainsFont= QFont("helvetica",10); + mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); + mEditBoxFont = QFont("helvetica",12); + mJornalViewFont = QFont("helvetica",12); + + KPrefs::setCurrentGroup("General"); + addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); + + addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); + addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); + addItemBool("ShowIconSearch",&mShowIconSearch,true); + addItemBool("ShowIconList",&mShowIconList,true); + addItemBool("ShowIconDay1",&mShowIconDay1,true); + addItemBool("ShowIconDay5",&mShowIconDay5,true); + addItemBool("ShowIconDay7",&mShowIconDay7,true); + addItemBool("ShowIconMonth",&mShowIconMonth,true); + addItemBool("ShowIconTodoview",&mShowIconTodoview,true); + addItemBool("ShowIconBackFast",&mShowIconBackFast,true); + addItemBool("ShowIconBack",&mShowIconBack,true); + addItemBool("ShowIconToday",&mShowIconToday,true); + addItemBool("ShowIconForward",&mShowIconForward,true); + addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); + addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); + addItemBool("ShowIconNextDays",&mShowIconNextDays,true); + addItemBool("ShowIconNext",&mShowIconNext,true); + addItemBool("ShowIconJournal",&mShowIconJournal,true); + addItemBool("ShowIconStretch",&mShowIconStretch,true); + addItemBool("LanguageChanged",&mLanguageChanged,false); + + addItemBool("AskForQuit",&mAskForQuit,false); + +#ifndef DESKTOP_VERSION + addItemBool("ShowFullMenu",&mShowFullMenu,false); +#else + addItemBool("ShowFullMenu",&mShowFullMenu,true); +#endif + addItemBool("ToolBarHor",&mToolBarHor, true ); + addItemBool("ToolBarUp",&mToolBarUp, false ); + addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); + addItemInt("Whats Next Days",&mWhatsNextDays,3); + addItemInt("Whats Next Prios",&mWhatsNextPrios,1); + + addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); + addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); + addItemInt("AllDay Size",&mAllDaySize,28); + QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; + addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); + + addItemStringList("LocationDefaults",&mLocationDefaults ); + addItemStringList("EventSummary User",&mEventSummaryUser); + addItemStringList("TodoSummary User",&mTodoSummaryUser); + + addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); + addItemBool("Enable Project View",&mEnableProjectView,false); + addItemBool("Auto Save",&mAutoSave,false); + addItemInt("Auto Save Interval",&mAutoSaveInterval,3); + addItemBool("Confirm Deletes",&mConfirm,true); + addItemString("Archive File",&mArchiveFile); + addItemString("Html Export File",&mHtmlExportFile, + QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); + addItemBool("Html With Save",&mHtmlWithSave,false); + + KPrefs::setCurrentGroup("Personal Settings"); + + addItemInt("Mail Client",&mMailClient,MailClientKMail); + addItemBool("Use Control Center Email",&mEmailControlCenter,false); + addItemBool("Bcc",&mBcc,false); + + KPrefs::setCurrentGroup("Time & Date"); + + // addItemString("Time Zone",&mTimeZone,"+0100"); + addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); + // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); + addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); + addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); + addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); + + + addItemInt("Default Start Time",&mStartTime,10); + addItemInt("Default Duration",&mDefaultDuration,2); + addItemInt("Default Alarm Time",&mAlarmTime,3); + addItemInt("Daylight Savings",&mDaylightSavings,0); + KPrefs::setCurrentGroup("AlarmSettings"); + addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); + addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); + addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); + addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); + + + KPrefs::setCurrentGroup("Calendar"); + + addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); + + KPrefs::setCurrentGroup("Fonts"); + // qDebug(" KPrefs::setCurrentGroup(Fonts); "); + addItemFont("TimeBar Font",&mTimeBarFont); + addItemFont("MonthView Font",&mMonthViewFont); + addItemFont("AgendaView Font",&mAgendaViewFont); + addItemFont("MarcusBains Font",&mMarcusBainsFont); + addItemFont("TimeLabels Font",&mTimeLabelsFont); + addItemFont("TodoView Font",&mTodoViewFont); + addItemFont("ListView Font",&mListViewFont); + addItemFont("DateNavigator Font",&mDateNavigatorFont); + addItemFont("EditBox Font",&mEditBoxFont); + addItemFont("JournalView Font",&mJornalViewFont); + addItemFont("WhatsNextView Font",&mWhatsNextFont); + addItemFont("EventView Font",&mEventViewFont); + +// KPrefs::setCurrentGroup("SyncProfiles"); +// addItemString("LocalMachineName",&mLocalMachineName, "undefined"); +// addItemStringList("SyncProfileNames",&mSyncProfileNames); +// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); + + KPrefs::setCurrentGroup("RemoteSyncing"); +// addItemBool("UsePasswd",&mUsePassWd,false); +// addItemBool("WriteBackFile",&mWriteBackFile,true); +// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); +// addItemBool("AskForPreferences",&mAskForPreferences,true); +// addItemBool("ShowSyncSummary",&mShowSyncSummary,true); + addItemBool("ShowSyncEvents",&mShowSyncEvents,false); + addItemInt("LastSyncTime",&mLastSyncTime,0); + addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); + addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); + +#ifdef _WIN32_ + QString hdp= locateLocal("data","korganizer")+"\\\\"; +#else + QString hdp= locateLocal("data","korganizer")+"/"; +#endif +// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); +// addItemString("RemoteUser",&mRemoteUser, "zaurus"); +// addItemString("RemotePassWd",&mRemotePassWd, ""); +// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); +// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); + + + KPrefs::setCurrentGroup("LoadSaveFileNames"); + + addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); + addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); + addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); + addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); + addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); + + + KPrefs::setCurrentGroup("Locale"); + addItemInt("PreferredLanguage",&mPreferredLanguage,0); + addItemInt("PreferredTime",&mPreferredTime,0); + addItemInt("PreferredDate",&mPreferredDate,0); + addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); + addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); + addItemBool("ShortDateInViewer",&mShortDateInViewer,false); + addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); + addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); + + + KPrefs::setCurrentGroup("Colors"); + addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); + addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); + addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); + addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); + addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); + addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); + addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); + addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); + addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); + addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); + addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); + addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); + addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); + addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); + addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); + addItemBool("UseAppColors",&mUseAppColors,false); + + + + KPrefs::setCurrentGroup("Views"); + addItemInt("Hour Size",&mHourSize,8); + addItemBool("Show Daily Recurrences",&mDailyRecur,true); + addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); + addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); + addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); + addItemBool("ShowShortMonthName",&mMonthShowShort,false); + addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); + addItemBool("Enable ToolTips",&mEnableToolTips,false); + addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); + addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); + addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); + addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); + addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); + addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); + addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); + addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); + addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); + addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); + addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); + addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); + addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); + addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); + addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); + addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); + addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); + addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); +#ifdef DESKTOP_VERSION + addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); +#else + addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); +#endif + addItemInt("Day Begins",&mDayBegins,7); + addItemInt("Working Hours Start",&mWorkingHoursStart,8); + addItemInt("Working Hours End",&mWorkingHoursEnd,17); + addItemBool("Exclude Holidays",&mExcludeHolidays,true); + addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); + + addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); + addItemBool("Full View Month",&mFullViewMonth,true); + addItemBool("Full View Todo",&mFullViewTodo,true); + addItemBool("Quick Todo",&mEnableQuickTodo,false); + + addItemInt("Next X Days",&mNextXDays,3); + + KPrefs::setCurrentGroup("Printer"); + + KPrefs::setCurrentGroup("Layout"); + + addItemBool("CompactDialogs",&mCompactDialogs,false); + addItemBool("VerticalScreen",&mVerticalScreen,true); + + KPrefs::setCurrentGroup("KOrganizer Plugins"); + + addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); + + KPrefs::setCurrentGroup("Group Scheduling"); + + addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); + addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); + addItemStringList("AdditionalMails",&mAdditionalMails,""); + addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); + addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); + addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); + addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); + addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); + + KPrefs::setCurrentGroup( "Editors" ); + + addItemStringList( "EventTemplates", &mEventTemplates ); + addItemStringList( "TodoTemplates", &mTodoTemplates ); + + addItemInt("DestinationPolicy",&mDestination,standardDestination); + +#endif + +} + + +KOPrefs::~KOPrefs() +{ + if (mInstance == this) + mInstance = insd.setObject(0); +#if 0 + setLocaleDict( 0 ); + if ( mLocaleDict ) + delete mLocaleDict; + //qDebug("KOPrefs::~KOPrefs() "); +#endif +} + + +KOPrefs *KOPrefs::instance() +{ + if (!mInstance) { + mInstance = insd.setObject(new KOPrefs()); + mInstance->readConfig(); + } + + return mInstance; +} + +void KOPrefs::usrSetDefaults() +{ + +} + +void KOPrefs::fillMailDefaults() +{ + if (mName.isEmpty()) mName = i18n("Anonymous"); + if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); +} + +void KOPrefs::setTimeZoneIdDefault() +{ + mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); +} + + +void KOPrefs::usrReadConfig() +{ +#if 0 + mLocaleDict = 0; + // pending LR fix translation + // qDebug("KOPrefs::usrReadConfig() fix translation "); + if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { + if ( mPreferredLanguage == 1 ) { + mLocaleDict = new QDict<QString>; + int i = 0; + QString fw ( germanwords[i] [0]); + while ( !fw.isEmpty() ) { + mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); + ++i; + fw = germanwords[i] [0]; + } + + setLocaleDict( mLocaleDict ); + } else { + QString fileName ; + if ( mPreferredLanguage == 3 ) + fileName = MainWindow::resourcePath()+"usertranslation.txt"; + else if ( mPreferredLanguage == 2 ) + fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; + QFile file( fileName ); + if (file.open( IO_ReadOnly ) ) { + QTextStream ts( &file ); + ts.setEncoding( QTextStream::Latin1 ); + //ts.setCodec( QTextCodec::latin1 ); + QString text = ts.read(); + file.close(); + text.replace( QRegExp("\\\\n"), "\n" ); + QString line; + QString we; + QString wt; + int br = 0; + int nbr; + nbr = text.find ( "},", br ); + line = text.mid( br, nbr - br ); + br = nbr+1; + int se, ee, st, et; + mLocaleDict = new QDict<QString>; + QString end = "{ \"\",\"\" }"; + while ( (line != end) && (br > 1) ) { + //qDebug("%d *%s* ", br, line.latin1()); + se = line.find("\"")+1; + et = line.findRev("\"",-1); + ee = line.find("\",\""); + st = ee+3; + we = line.mid( se, ee-se ); + wt = line.mid( st, et-st ); + //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); + mLocaleDict->insert( we, new QString (wt) ); + nbr = text.find ( "}", br ); + line = text.mid( br, nbr - br ); + br = nbr+1; + } + //qDebug("end *%s* ", end.latin1()); + + setLocaleDict( mLocaleDict ); + } else { + qDebug("KO: Cannot find translation file %s",fileName.latin1() ); + } + + } + } + config()->setGroup("General"); + + mCustomCategories = config()->readListEntry("Custom Categories"); + if ( KOPrefs::instance()->mLanguageChanged ) { + mLocationDefaults.clear(); + mEventSummaryUser.clear(); + mTodoSummaryUser.clear(); + } + if (mLocationDefaults.isEmpty()) { + mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") + << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") + << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; + // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") + mLocationDefaults.sort(); + } + + if (mEventSummaryUser.isEmpty()) { + mEventSummaryUser = getDefaultList() ; + } + if (mTodoSummaryUser.isEmpty()) { + mTodoSummaryUser = getDefaultList() ; + } + + if (mCustomCategories.isEmpty()) setCategoryDefaults(); + + config()->setGroup("Personal Settings"); + mName = config()->readEntry("user_name",""); + mEmail = config()->readEntry("user_email",""); + fillMailDefaults(); + + config()->setGroup("Category Colors"); + QStringList::Iterator it; + for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { + setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); + + } + + if (mTimeZoneId.isEmpty()) { + setTimeZoneIdDefault(); + } +#endif + KPimPrefs::usrReadConfig(); +} + + +void KOPrefs::usrWriteConfig() +{ +#if 0 + config()->setGroup("General"); + config()->writeEntry("Custom Categories",mCustomCategories); + + config()->setGroup("Personal Settings"); + config()->writeEntry("user_name",mName); + config()->writeEntry("user_email",mEmail); + + config()->setGroup("Category Colors"); + QDictIterator<QColor> it(mCategoryColors); + while (it.current()) { + config()->writeEntry(it.currentKey(),*(it.current())); + ++it; + } + +#endif + KPimPrefs::usrWriteConfig(); +} + + + +KConfig* KOPrefs::getConfig() +{ + return config(); +} 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 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include <time.h> +#ifndef _WIN32_ +#include <unistd.h> +#endif +#include <qdir.h> +#include <qtextstream.h> +#include <qtextcodec.h> +#include <qstring.h> +#include <qregexp.h> +#include <qfont.h> +#include <qcolor.h> +#include <qstringlist.h> +#include <stdlib.h> + +#include <kglobal.h> +#include <kconfig.h> +#include <klocale.h> +#include <kdebug.h> +#include <kemailsettings.h> +#include <kstaticdeleter.h> + +#include "koprefs.h" +#include "mainwindow.h" + +const char *germanwords[][2] = { +#include "wordsgerman.h" + "", "" +}; + +KOPrefs *KOPrefs::mInstance = 0; +static KStaticDeleter<KOPrefs> insd; + +KOPrefs::KOPrefs() : + KPimPrefs("korganizerrc") +{ + mCategoryColors.setAutoDelete(true); + mLocaleDict = 0; + fillMailDefaults(); + mDefaultCategoryColor = QColor(175,210,255);//196,196,196); + QColor defaultHolidayColor = QColor(255,0,0); + QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); + QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); + QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); + QColor defaultTodoDueTodayColor = QColor(255,220,100); + QColor defaultTodoOverdueColor = QColor(255,153,125); + + mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); + mDefaultViewFont = QFont("helvetica",10); + mDefaultMonthViewFont = QFont("helvetica",8); + mMarcusBainsFont= QFont("helvetica",10); + mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); + mEditBoxFont = QFont("helvetica",12); + mJornalViewFont = QFont("helvetica",12); + + KPrefs::setCurrentGroup("General"); + addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); + + addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); + addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); + addItemBool("ShowIconSearch",&mShowIconSearch,true); + addItemBool("ShowIconList",&mShowIconList,true); + addItemBool("ShowIconDay1",&mShowIconDay1,true); + addItemBool("ShowIconDay5",&mShowIconDay5,true); + addItemBool("ShowIconDay7",&mShowIconDay7,true); + addItemBool("ShowIconMonth",&mShowIconMonth,true); + addItemBool("ShowIconTodoview",&mShowIconTodoview,true); + addItemBool("ShowIconBackFast",&mShowIconBackFast,true); + addItemBool("ShowIconBack",&mShowIconBack,true); + addItemBool("ShowIconToday",&mShowIconToday,true); + addItemBool("ShowIconForward",&mShowIconForward,true); + addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); + addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); + addItemBool("ShowIconNextDays",&mShowIconNextDays,true); + addItemBool("ShowIconNext",&mShowIconNext,true); + addItemBool("ShowIconJournal",&mShowIconJournal,true); + addItemBool("ShowIconStretch",&mShowIconStretch,true); + addItemBool("LanguageChanged",&mLanguageChanged,false); + + addItemBool("AskForQuit",&mAskForQuit,false); + +#ifndef DESKTOP_VERSION + addItemBool("ShowFullMenu",&mShowFullMenu,false); +#else + addItemBool("ShowFullMenu",&mShowFullMenu,true); +#endif + addItemBool("ToolBarHor",&mToolBarHor, true ); + addItemBool("ToolBarUp",&mToolBarUp, false ); + addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); + addItemInt("Whats Next Days",&mWhatsNextDays,3); + addItemInt("Whats Next Prios",&mWhatsNextPrios,1); + + addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); + addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); + addItemInt("AllDay Size",&mAllDaySize,28); + QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; + addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); + + addItemStringList("LocationDefaults",&mLocationDefaults ); + addItemStringList("EventSummary User",&mEventSummaryUser); + addItemStringList("TodoSummary User",&mTodoSummaryUser); + + addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); + addItemBool("Enable Project View",&mEnableProjectView,false); + addItemBool("Auto Save",&mAutoSave,false); + addItemInt("Auto Save Interval",&mAutoSaveInterval,3); + addItemBool("Confirm Deletes",&mConfirm,true); + addItemString("Archive File",&mArchiveFile); + addItemString("Html Export File",&mHtmlExportFile, + QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); + addItemBool("Html With Save",&mHtmlWithSave,false); + + KPrefs::setCurrentGroup("Personal Settings"); + + addItemInt("Mail Client",&mMailClient,MailClientKMail); + addItemBool("Use Control Center Email",&mEmailControlCenter,false); + addItemBool("Bcc",&mBcc,false); + + KPrefs::setCurrentGroup("Time & Date"); + + // addItemString("Time Zone",&mTimeZone,"+0100"); + addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); + // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); + addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); + addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); + addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); + + + addItemInt("Default Start Time",&mStartTime,10); + addItemInt("Default Duration",&mDefaultDuration,2); + addItemInt("Default Alarm Time",&mAlarmTime,3); + addItemInt("Daylight Savings",&mDaylightSavings,0); + KPrefs::setCurrentGroup("AlarmSettings"); + addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); + addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); + addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); + addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); + + + KPrefs::setCurrentGroup("Calendar"); + + addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); + + KPrefs::setCurrentGroup("Fonts"); + // qDebug(" KPrefs::setCurrentGroup(Fonts); "); + addItemFont("TimeBar Font",&mTimeBarFont); + addItemFont("MonthView Font",&mMonthViewFont); + addItemFont("AgendaView Font",&mAgendaViewFont); + addItemFont("MarcusBains Font",&mMarcusBainsFont); + addItemFont("TimeLabels Font",&mTimeLabelsFont); + addItemFont("TodoView Font",&mTodoViewFont); + addItemFont("ListView Font",&mListViewFont); + addItemFont("DateNavigator Font",&mDateNavigatorFont); + addItemFont("EditBox Font",&mEditBoxFont); + addItemFont("JournalView Font",&mJornalViewFont); + addItemFont("WhatsNextView Font",&mWhatsNextFont); + addItemFont("EventView Font",&mEventViewFont); + +// KPrefs::setCurrentGroup("SyncProfiles"); +// addItemString("LocalMachineName",&mLocalMachineName, "undefined"); +// addItemStringList("SyncProfileNames",&mSyncProfileNames); +// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); + + KPrefs::setCurrentGroup("RemoteSyncing"); +// addItemBool("UsePasswd",&mUsePassWd,false); +// addItemBool("WriteBackFile",&mWriteBackFile,true); +// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); +// addItemBool("AskForPreferences",&mAskForPreferences,true); +// addItemBool("ShowSyncSummary",&mShowSyncSummary,true); + addItemBool("ShowSyncEvents",&mShowSyncEvents,false); + addItemInt("LastSyncTime",&mLastSyncTime,0); + addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); + addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); + +#ifdef _WIN32_ + QString hdp= locateLocal("data","korganizer")+"\\\\"; +#else + QString hdp= locateLocal("data","korganizer")+"/"; +#endif +// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); +// addItemString("RemoteUser",&mRemoteUser, "zaurus"); +// addItemString("RemotePassWd",&mRemotePassWd, ""); +// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); +// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" ); + + + KPrefs::setCurrentGroup("LoadSaveFileNames"); + + addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); + addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); + addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); + addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); + addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); + + + KPrefs::setCurrentGroup("Locale"); + addItemInt("PreferredLanguage",&mPreferredLanguage,0); + addItemInt("PreferredTime",&mPreferredTime,0); + addItemInt("PreferredDate",&mPreferredDate,0); + addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); + addItemBool("QuickSavingWOUnicode",&mUseQuicksave,false); + addItemBool("ShortDateInViewer",&mShortDateInViewer,false); + addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); + addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); + + + KPrefs::setCurrentGroup("Colors"); + addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); + addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); + addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); + addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); + addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); + addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); + addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); + addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); + addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); + addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); + addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); + addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); + addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); + addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); + addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); + addItemBool("UseAppColors",&mUseAppColors,false); + + + + KPrefs::setCurrentGroup("Views"); + addItemInt("Hour Size",&mHourSize,8); + addItemBool("Show Daily Recurrences",&mDailyRecur,true); + addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); + addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); + addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); + addItemBool("ShowShortMonthName",&mMonthShowShort,false); + addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); + addItemBool("Enable ToolTips",&mEnableToolTips,false); + addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); + addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); + addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); + addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); + addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); + addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); + addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); + addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); + addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); + addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); + addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); + addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); + addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); + addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); + addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); + addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); + addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); + addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); +#ifdef DESKTOP_VERSION + addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); +#else + addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); +#endif + addItemInt("Day Begins",&mDayBegins,7); + addItemInt("Working Hours Start",&mWorkingHoursStart,8); + addItemInt("Working Hours End",&mWorkingHoursEnd,17); + addItemBool("Exclude Holidays",&mExcludeHolidays,true); + addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); + + addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); + addItemBool("Full View Month",&mFullViewMonth,true); + addItemBool("Full View Todo",&mFullViewTodo,true); + addItemBool("Quick Todo",&mEnableQuickTodo,false); + + addItemInt("Next X Days",&mNextXDays,3); + + KPrefs::setCurrentGroup("Printer"); + + KPrefs::setCurrentGroup("Layout"); + + addItemBool("CompactDialogs",&mCompactDialogs,false); + addItemBool("VerticalScreen",&mVerticalScreen,true); + + KPrefs::setCurrentGroup("KOrganizer Plugins"); + + addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); + + KPrefs::setCurrentGroup("Group Scheduling"); + + addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); + addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); + addItemStringList("AdditionalMails",&mAdditionalMails,""); + addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); + addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); + addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); + addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); + addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); + + KPrefs::setCurrentGroup( "Editors" ); + + addItemStringList( "EventTemplates", &mEventTemplates ); + addItemStringList( "TodoTemplates", &mTodoTemplates ); + + addItemInt("DestinationPolicy",&mDestination,standardDestination); + + + +} + + +KOPrefs::~KOPrefs() +{ + if (mInstance == this) + mInstance = insd.setObject(0); + setLocaleDict( 0 ); + if ( mLocaleDict ) + delete mLocaleDict; + //qDebug("KOPrefs::~KOPrefs() "); +} + + +KOPrefs *KOPrefs::instance() +{ + if (!mInstance) { + mInstance = insd.setObject(new KOPrefs()); + mInstance->readConfig(); + } + + return mInstance; +} + +void KOPrefs::usrSetDefaults() +{ + +} + +void KOPrefs::fillMailDefaults() +{ + if (mName.isEmpty()) mName = i18n("Anonymous"); + if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); +} + +void KOPrefs::setTimeZoneIdDefault() +{ + mTimeZoneId = i18n("+01:00 Europe/Oslo(CET)"); +} + +void KOPrefs::setCategoryDefaults() +{ + mCustomCategories.clear(); + mCustomCategories = getDefaultList(); + + QStringList::Iterator it; + for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { + setCategoryColor(*it,mDefaultCategoryColor); + } +} + +QStringList KOPrefs::getDefaultList() +{ + QStringList retval ; + retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") + << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") + << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") + << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") + << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") + << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") + << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") + << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; + retval.sort(); + return retval; +} + +void KOPrefs::usrReadConfig() +{ + mLocaleDict = 0; + // pending LR fix translation + // qDebug("KOPrefs::usrReadConfig() fix translation "); + if ( mPreferredLanguage > 0 && mPreferredLanguage < 4 ) { + if ( mPreferredLanguage == 1 ) { + mLocaleDict = new QDict<QString>; + int i = 0; + QString fw ( germanwords[i] [0]); + while ( !fw.isEmpty() ) { + mLocaleDict->insert( fw, new QString (germanwords[i] [1] )); + ++i; + fw = germanwords[i] [0]; + } + + setLocaleDict( mLocaleDict ); + } else { + QString fileName ; + if ( mPreferredLanguage == 3 ) + fileName = MainWindow::resourcePath()+"usertranslation.txt"; + else if ( mPreferredLanguage == 2 ) + fileName = MainWindow::resourcePath()+"frenchtranslation.txt"; + QFile file( fileName ); + if (file.open( IO_ReadOnly ) ) { + QTextStream ts( &file ); + ts.setEncoding( QTextStream::Latin1 ); + //ts.setCodec( QTextCodec::latin1 ); + QString text = ts.read(); + file.close(); + text.replace( QRegExp("\\\\n"), "\n" ); + QString line; + QString we; + QString wt; + int br = 0; + int nbr; + nbr = text.find ( "},", br ); + line = text.mid( br, nbr - br ); + br = nbr+1; + int se, ee, st, et; + mLocaleDict = new QDict<QString>; + QString end = "{ \"\",\"\" }"; + while ( (line != end) && (br > 1) ) { + //qDebug("%d *%s* ", br, line.latin1()); + se = line.find("\"")+1; + et = line.findRev("\"",-1); + ee = line.find("\",\""); + st = ee+3; + we = line.mid( se, ee-se ); + wt = line.mid( st, et-st ); + //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); + mLocaleDict->insert( we, new QString (wt) ); + nbr = text.find ( "}", br ); + line = text.mid( br, nbr - br ); + br = nbr+1; + } + //qDebug("end *%s* ", end.latin1()); + + setLocaleDict( mLocaleDict ); + } else { + qDebug("KO: Cannot find translation file %s",fileName.latin1() ); + } + + } + } + config()->setGroup("General"); + + mCustomCategories = config()->readListEntry("Custom Categories"); + if ( KOPrefs::instance()->mLanguageChanged ) { + mLocationDefaults.clear(); + mEventSummaryUser.clear(); + mTodoSummaryUser.clear(); + } + if (mLocationDefaults.isEmpty()) { + mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") + << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") + << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; + // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") + mLocationDefaults.sort(); + } + + if (mEventSummaryUser.isEmpty()) { + mEventSummaryUser = getDefaultList() ; + } + if (mTodoSummaryUser.isEmpty()) { + mTodoSummaryUser = getDefaultList() ; + } + + if (mCustomCategories.isEmpty()) setCategoryDefaults(); + + config()->setGroup("Personal Settings"); + mName = config()->readEntry("user_name",""); + mEmail = config()->readEntry("user_email",""); + fillMailDefaults(); + + config()->setGroup("Category Colors"); + QStringList::Iterator it; + for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { + setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); + + } + + if (mTimeZoneId.isEmpty()) { + setTimeZoneIdDefault(); + } + KPimPrefs::usrReadConfig(); +} + + +void KOPrefs::usrWriteConfig() +{ + config()->setGroup("General"); + config()->writeEntry("Custom Categories",mCustomCategories); + + config()->setGroup("Personal Settings"); + config()->writeEntry("user_name",mName); + config()->writeEntry("user_email",mEmail); + + config()->setGroup("Category Colors"); + QDictIterator<QColor> it(mCategoryColors); + while (it.current()) { + config()->writeEntry(it.currentKey(),*(it.current())); + ++it; + } + + + KPimPrefs::usrWriteConfig(); +} + +void KOPrefs::setCategoryColor(QString cat,const QColor & color) +{ + mCategoryColors.replace(cat,new QColor(color)); +} + +QColor *KOPrefs::categoryColor(QString cat) +{ + QColor *color = 0; + + if (!cat.isEmpty()) color = mCategoryColors[cat]; + + if (color) return color; + else return &mDefaultCategoryColor; +} + +void KOPrefs::setFullName(const QString &name) +{ + mName = name; +} + +void KOPrefs::setEmail(const QString &email) +{ + //qDebug(" KOPrefs::setEmai*********** %s",email.latin1() ); + mEmail = email; +} + +QString KOPrefs::fullName() +{ + if (mEmailControlCenter) { + KEMailSettings settings; + return settings.getSetting(KEMailSettings::RealName); + } else { + return mName; + } +} + +QString KOPrefs::email() +{ + if (mEmailControlCenter) { + KEMailSettings settings; + return settings.getSetting(KEMailSettings::EmailAddress); + } else { + return mEmail; + } +} +KConfig* KOPrefs::getConfig() +{ + return config(); +} 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 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ +#ifndef KOPREFS_H +#define KOPREFS_H + +#include <qdict.h> + +#include <libkdepim/kpimprefs.h> + +class KConfig; +class QFont; +class QColor; +class QStringList; + +class KOPrefs : public KPimPrefs +{ + public: + virtual ~KOPrefs(); + + /** Get instance of KOPrefs. It is made sure that there is only one + instance. */ + static KOPrefs *instance(); + + /** Set preferences to default values */ + void usrSetDefaults(); + + /** Read preferences from config file */ + void usrReadConfig(); + + /** Write preferences to config file */ + void usrWriteConfig(); + void setCategoryDefaults(){;}; + + protected: + void setTimeZoneIdDefault(); + + /** Fill empty mail fields with default values. */ + void fillMailDefaults(); + + private: + /** Constructor disabled for public. Use instance() to create a KOPrefs + object. */ + KOPrefs(); + + static KOPrefs *mInstance; + QDict<QString> *mLocaleDict; + public: + // preferences data + KConfig* getConfig(); + QFont mAppFont; + QFont mComposeFont; + QFont mReadFont; + QFont mTimeZoneId; + QString mName; + QString mEmail; + bool mSendLater, mViewAsHtml, mUseKapi; + private: + +}; + +#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 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ +#ifndef KOPREFS_H +#define KOPREFS_H + +#include <qdict.h> + +#include <libkdepim/kpimprefs.h> + +class KConfig; +class QFont; +class QColor; +class QStringList; + +class KOPrefs : public KPimPrefs +{ + public: + enum { FormatVCalendar, FormatICalendar }; + enum { MailClientKMail, MailClientSendmail }; + enum { IMIPDummy, IMIPKMail }; + enum { IMIPOutbox, IMIPdirectsend }; + enum { neverAuto, addressbookAuto, selectedAuto }; + enum { standardDestination, askDestination }; + + virtual ~KOPrefs(); + + /** Get instance of KOPrefs. It is made sure that there is only one + instance. */ + static KOPrefs *instance(); + + /** Set preferences to default values */ + void usrSetDefaults(); + + /** Read preferences from config file */ + void usrReadConfig(); + + /** Write preferences to config file */ + void usrWriteConfig(); + void setCategoryDefaults(); + + protected: + void setTimeZoneIdDefault(); + + /** Fill empty mail fields with default values. */ + void fillMailDefaults(); + + private: + /** Constructor disabled for public. Use instance() to create a KOPrefs + object. */ + KOPrefs(); + + static KOPrefs *mInstance; + QDict<QString> *mLocaleDict; + QStringList getDefaultList(); + public: + // preferences data + KConfig* getConfig(); + void setFullName(const QString &); + QString fullName(); + void setEmail(const QString &); + QString email(); + + QString mAdditional; + + bool mEmailControlCenter; + + bool mBcc; + bool mAutoSave; + int mAutoSaveInterval; + bool mConfirm; + + bool mEnableGroupScheduling; + bool mEnableProjectView; + + int mDefaultFormat; + int mMailClient; + + QString mTimeZone; + QString mTimeZoneId; + //QString mTimeZoneName; // e.g. +00:04:00 Indian/Mauritius + //int mTimeZoneOffset; // e.g. -240 min + bool mUseDaylightsaving; + int mDaylightsavingStart; + int mDaylightsavingEnd; + int mStartTime; + int mDefaultDuration; + int mAlarmTime; + int mDaylightSavings; + + int mWorkingHoursStart; + int mWorkingHoursEnd; + bool mExcludeHolidays; + bool mExcludeSaturdays; + bool mMarcusBainsShowSeconds; + + QFont mTimeBarFont; + QFont mMonthViewFont; + QFont mAgendaViewFont; + QFont mMarcusBainsFont; + QFont mTimeLabelsFont; + QFont mTodoViewFont; + QFont mListViewFont; + QFont mDateNavigatorFont; + QFont mEditBoxFont; + QFont mJornalViewFont; + QFont mWhatsNextFont; + QFont mEventViewFont; + + + + + QColor mHolidayColor; + QColor mHighlightColor; + QColor mEventColor; + QColor mAgendaBgColor; + QColor mWorkingHoursColor; + QColor mTodoDueTodayColor; + QColor mTodoOverdueColor; + QColor mMonthViewEvenColor; + QColor mMonthViewOddColor; + QColor mMonthViewHolidayColor; + bool mMonthViewUsesDayColors; + bool mMonthViewSatSunTog; + QColor mAppColor1; + QColor mAppColor2; + bool mUseAppColors; + + int mDayBegins; + int mHourSize; + int mAllDaySize; + bool mShowFullMenu; + bool mDailyRecur; + bool mWeeklyRecur; + bool mMonthDailyRecur; + bool mMonthWeeklyRecur; + bool mMonthShowIcons; + bool mMonthShowShort; + bool mEnableToolTips; + bool mEnableMonthScroll; + bool mFullViewMonth; + bool mMonthViewUsesCategoryColor; + bool mFullViewTodo; + bool mShowCompletedTodo; + bool mMarcusBainsEnabled; + int mNextXDays; + int mWhatsNextDays; + int mWhatsNextPrios; + bool mEnableQuickTodo; + bool mLanguageChanged; + + bool mCompactDialogs; + bool mVerticalScreen; + + bool mShowIconNewTodo; + bool mShowIconNewEvent; + bool mShowIconSearch; + bool mShowIconList; + bool mShowIconDay1; + bool mShowIconDay5; + bool mShowIconDay7; + bool mShowIconMonth; + bool mShowIconTodoview; + bool mShowIconBackFast; + bool mShowIconBack; + bool mShowIconToday; + bool mShowIconForward; + bool mShowIconForwardFast; + bool mShowIconWhatsThis; + bool mShowIconNextDays; + bool mShowIconNext; + bool mShowIconJournal; + + bool mShowIconStretch; + + bool mToolBarHor; + bool mToolBarUp; + bool mToolBarMiniIcons; + + bool mAskForQuit; + bool mUsePassWd; + bool mWriteBackFile; + int mWriteBackInFuture; + bool mAskForPreferences; + bool mShowSyncSummary; + bool mShowSyncEvents; + bool mShowTodoInAgenda; + bool mWriteBackExistingOnly; + + QString mRemoteIP; + QString mRemoteUser; + QString mRemotePassWd; + QString mRemoteFile; + QString mLocalTempFile; + QString mPhoneDevice; + QString mPhoneConnection; + QString mPhoneModel; + + int mLastSyncTime; + int mSyncAlgoPrefs; + int mRingSyncAlgoPrefs; + QStringList mSyncProfileNames; + QStringList mExternSyncProfiles; + QString mLocalMachineName; + void setCategoryColor(QString cat,const QColor & color); + QColor *categoryColor(QString cat); + + QString mArchiveFile; + QString mHtmlExportFile; + bool mHtmlWithSave; + + QStringList mSelectedPlugins; + + QString mLastImportFile; + QString mLastVcalFile; + QString mLastSaveFile; + QString mLastLoadFile; + QString mLastSyncedLocalFile; + + + QString mDefaultAlarmFile; + int mIMIPScheduler; + int mIMIPSend; + QStringList mAdditionalMails; + int mIMIPAutoRefresh; + int mIMIPAutoInsertReply; + int mIMIPAutoInsertRequest; + int mIMIPAutoFreeBusy; + int mIMIPAutoFreeBusyReply; + + QStringList mTodoTemplates; + QStringList mEventTemplates; + + int mDestination; + + + bool mEditOnDoubleClick; + bool mViewChangeHoldFullscreen; + bool mViewChangeHoldNonFullscreen; + bool mCenterOnCurrentTime; + bool mSetTimeToDayStartAt; + bool mHighlightCurrentDay; + bool mUseHighlightLightColor; + bool mListViewMonthTimespan; + bool mWNViewShowsParents; + bool mWNViewShowLocation; + bool mTodoViewShowsPercentage; + bool mTodoViewUsesCatColors; + bool mTodoViewUsesSmallFont; + bool mTodoViewUsesForegroundColor; + bool mMonthViewUsesForegroundColor; + + bool mHightlightDateTimeEdit; + int mPreferredLanguage; + bool mUseQuicksave; + int mPreferredTime; + int mPreferredDate; + bool mWeekStartsOnSunday; + bool mShortDateInViewer; + QString mUserDateFormatLong; + QString mUserDateFormatShort; + + QStringList mLocationDefaults; + QStringList mEventSummaryUser; + QStringList mTodoSummaryUser; + + bool mUseInternalAlarmNotification; + int mAlarmPlayBeeps; + int mAlarmSuspendTime; + int mAlarmSuspendCount; + int mAlarmBeepInterval; + + private: + QDict<QColor> mCategoryColors; + QColor mDefaultCategoryColor; + + QFont mDefaultTimeBarFont; + QFont mDefaultViewFont; + QFont mDefaultMonthViewFont; + + QString mName; + QString mEmail; +}; + +#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 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include <qlayout.h> +#include <qlabel.h> +#include <qgroupbox.h> +#include <qbuttongroup.h> +#include <qlineedit.h> +#include <qfont.h> +#include <qslider.h> +#include <qfile.h> +#include <qtextstream.h> +#include <qcombobox.h> +#include <qvbox.h> +#include <qhbox.h> +#include <qregexp.h> +#include <qspinbox.h> +#include <qdatetime.h> +#include <qcheckbox.h> +#include <qradiobutton.h> +#include <qpushbutton.h> +#include <qstrlist.h> +#include <qapplication.h> + +#include <kcolorbutton.h> +#include <kdebug.h> +#include <klocale.h> +#include <kglobal.h> +#include <kfontdialog.h> +#include <kfiledialog.h> +#include <kmessagebox.h> +#include <kcolordialog.h> +#include <kiconloader.h> +#include <kemailsettings.h> +#include <kstandarddirs.h> + +#include <klineedit.h> + + +#include "koprefs.h" + +#include "koprefsdialog.h" + + +KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : + KPrefsDialog(KOPrefs::instance(),parent,name,true) +{ + + setCaption( i18n("Settings - some need a restart (nr)")); + setupMainTab(); + setupMailTab();; + setupFontsTab(); + readConfig(); + +#if 0 + + setupMainTab(); + setupLocaleTab(); + setupTimeZoneTab(); + setupTimeTab(); + setupLocaleDateTab(); + setupFontsTab(); + setupColorsTab(); + setupViewsTab(); + //setupSyncTab(); + //setupSyncAlgTab(); + //setupPrinterTab(); + //setupGroupSchedulingTab(); + //setupGroupAutomationTab(); +#endif +} + + +KOPrefsDialog::~KOPrefsDialog() +{ +} + +void KOPrefsDialog::setupMainTab() +{ + QFrame *topFrame = addPage(i18n("General"),0,0); + + QGridLayout *topLayout = new QGridLayout(topFrame,6,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + + mNameEdit = new QLineEdit(topFrame); + mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); + topLayout->addWidget(mNameLabel,0,0); + topLayout->addWidget(mNameEdit,0,1); + + mEmailEdit = new QLineEdit(topFrame); + mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); + topLayout->addWidget(mEmailLabel,1,0); + topLayout->addWidget(mEmailEdit,1,1); + QLabel *lab = new QLabel( i18n("HINT: Separate multiple\neMail addresses by \";\""), topFrame); + topLayout->addMultiCellWidget(lab,2,2,0,1); + KPrefsWidBool* ttt = addWidBool(i18n("Ignore above settings and\nuse KA/Pi \"Who am I\" instead!"), + &(KOPrefs::instance()->mUseKapi),topFrame); + topLayout->addMultiCellWidget(ttt->checkBox(),3,3,0,1); +} + +void KOPrefsDialog::setupMailTab() +{ + QFrame *topFrame = addPage(i18n("Mail"),0,0); + + QGridLayout *topLayout = new QGridLayout(topFrame,4,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + KPrefsWidBool* ttt = addWidBool(i18n("View mail as html"), + &(KOPrefs::instance()->mViewAsHtml),topFrame); + topLayout->addMultiCellWidget(ttt->checkBox(),0,0,0,1); + + + ttt = addWidBool(i18n("Send mails later"), + &(KOPrefs::instance()->mSendLater),topFrame); + topLayout->addMultiCellWidget(ttt->checkBox(),1,1,0,1); + + +} +void KOPrefsDialog::setupFontsTab() +{ + + QFrame *topFrame = addPage(i18n("Fonts"),0,0); + // DesktopIcon("fonts",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,7,3); + topLayout->setSpacing(1); + topLayout->setMargin(3); + KPrefsWidFont * tVFont; + int i = 0; + KPrefsWidFont *timeLabelsFont = + addWidFont(i18n("OK"),i18n("Application(nr)"), + &(KOPrefs::instance()->mAppFont),topFrame); + topLayout->addWidget(timeLabelsFont->label(),i,0); + topLayout->addWidget(timeLabelsFont->preview(),i,1); + topLayout->addWidget(timeLabelsFont->button(),i,2); + ++i; + + + timeLabelsFont = + addWidFont(i18n("Dear Mr."),i18n("Compose mail:"), + &(KOPrefs::instance()->mComposeFont),topFrame); + topLayout->addWidget(timeLabelsFont->label(),i,0); + topLayout->addWidget(timeLabelsFont->preview(),i,1); + topLayout->addWidget(timeLabelsFont->button(),i,2); + ++i; + + KPrefsWidFont *timeBarFont = + addWidFont(i18n("Hello"),i18n("Read mail:"), + &(KOPrefs::instance()->mReadFont),topFrame); + topLayout->addWidget(timeBarFont->label(),i,0); + topLayout->addWidget(timeBarFont->preview(),i,1); + topLayout->addWidget(timeBarFont->button(),i,2); + ++i; + + topLayout->setColStretch(1,1); + topLayout->setRowStretch(4,1); + +} +void KOPrefsDialog::usrReadConfig() +{ + qDebug("read "); + mNameEdit->setText(KOPrefs::instance()->mName); + mEmailEdit->setText(KOPrefs::instance()->mEmail); +} +void KOPrefsDialog::usrWriteConfig() +{ + qDebug("write "); + KOPrefs::instance()->mName = mNameEdit->text(); + KOPrefs::instance()->mEmail = mEmailEdit->text(); + + +} + +#if 0 +void KOPrefsDialog::setupLocaleDateTab() +{ +QFrame *topFrame = addPage(i18n("Date Format"),0,0); + QGridLayout *topLayout = new QGridLayout(topFrame,3,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + int iii = 0; + + + KPrefsWidRadios *syncPrefsGroup = + addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); + QString format; + if ( QApplication::desktop()->width() < 480 ) + format = "(%d.%m.%Y)"; + else + format = "(%d.%m.%Y|%A %d %B %Y)"; + syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); + if ( QApplication::desktop()->width() < 480 ) + format = "(%m.%d.%Y)"; + else + format = "(%m.%d.%Y|%A %B %d %Y)"; + syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); + if ( QApplication::desktop()->width() < 480 ) + format = "(%Y-%m-%d)"; + else + format = "(%Y-%m-%d|%A %Y %B %d)"; + syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); + syncPrefsGroup->addRadio(i18n("User defined")); + topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); + ++iii; + ++iii; + QLabel * lab; + mUserDateFormatLong = new QLineEdit(topFrame); + lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mUserDateFormatLong,iii,1); + ++iii; + mUserDateFormatShort = new QLineEdit(topFrame); + lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mUserDateFormatShort,iii,1); + ++iii; + lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); + topLayout->addMultiCellWidget(lab ,iii,iii,0,1); + ++iii; + lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); + topLayout->addMultiCellWidget(lab ,iii,iii,0,1); + ++iii; + lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); + topLayout->addMultiCellWidget(lab ,iii,iii,0,1); + ++iii; + +} + +void KOPrefsDialog::setupLocaleTab() +{ + QFrame *topFrame = addPage(i18n("Locale"),0,0); + QGridLayout *topLayout = new QGridLayout(topFrame,4,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + int iii = 0; + KPrefsWidRadios *syncPrefsGroup = + addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); + syncPrefsGroup->addRadio(i18n("English")); + syncPrefsGroup->addRadio(i18n("German")); + syncPrefsGroup->addRadio(i18n("French")); + syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); + if ( QApplication::desktop()->width() < 300 ) + ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); + topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); + ++iii; + + syncPrefsGroup = + addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); + if ( QApplication::desktop()->width() > 300 ) + syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); + syncPrefsGroup->addRadio(i18n("24:00")); + syncPrefsGroup->addRadio(i18n("12:00am")); + syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); + topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); + ++iii; + KPrefsWidBool *sb; + if ( QApplication::desktop()->width() < 300 ) { + sb = + addWidBool(i18n("Week starts on Sunday"), + &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); + ++iii; + sb = + addWidBool(i18n("Use short date in (WN/E) view"), + &(KOPrefs::instance()->mShortDateInViewer),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); + } + else { + QWidget * hb = new QWidget( topFrame ); + QHBoxLayout *hbLayout = new QHBoxLayout(hb); + sb = + addWidBool(i18n("Week starts on Sunday"), + &(KOPrefs::instance()->mWeekStartsOnSunday),hb); + hbLayout->addWidget(sb->checkBox() ); + sb = + addWidBool(i18n("Use short date in (WN/E) view"), + &(KOPrefs::instance()->mShortDateInViewer),hb); + hbLayout->addWidget(sb->checkBox() ); + topLayout->addMultiCellWidget(hb, iii,iii,0,1); + + } + //#ifndef DESKTOP_VERSION +#if 0 + ++iii; + sb = + addWidBool(i18n("Quick load/save (w/o Unicode)"), + &(KOPrefs::instance()->mUseQuicksave),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); +#endif +} +void KOPrefsDialog::showSyncPage() +{ + showPage ( 2 ) ; + +} +void KOPrefsDialog::setupSyncAlgTab() +{ +#if 0 + QLabel * lab; + QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); + mSetupSyncAlgTab = topFrame; + QGridLayout *topLayout = new QGridLayout(topFrame,6,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + int iii = 0; + + KPrefsWidBool *sb = + addWidBool(i18n("Ask for preferences before syncing"), + &(KOPrefs::instance()->mAskForPreferences),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); + + ++iii; + + KPrefsWidRadios *syncPrefsGroup = + addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), + topFrame); + syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); + syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); + syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); + syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); + syncPrefsGroup->addRadio(i18n("Force take local entry always")); + syncPrefsGroup->addRadio(i18n("Force take remote entry always")); + topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); + ++iii; + sb = + addWidBool(i18n("Show summary after syncing"), + &(KOPrefs::instance()->mShowSyncSummary),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); + + ++iii; +#endif + + + +} + + +void KOPrefsDialog::setupSyncTab() +{ +#if 0 + QLabel * lab; + QFrame *topFrame = addPage(i18n("Sync Network"),0,0); + QGridLayout *topLayout = new QGridLayout(topFrame,6,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); + int iii = 0; + topLayout->addMultiCellWidget(lab , iii,iii,0,1); + ++iii; + + mRemoteIPEdit = new QLineEdit(topFrame); + lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mRemoteIPEdit,iii,1); + ++iii; + mRemoteUser = new QLineEdit(topFrame); + lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mRemoteUser, iii,1); + ++iii; + + mRemoteFile = new QLineEdit(topFrame); + lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mRemoteFile,iii,1); + ++iii; + + mLocalTempFile = new QLineEdit(topFrame); + lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mLocalTempFile,iii,1); + ++iii; + + KPrefsWidBool *wb = + addWidBool(i18n("Write back synced file"), + &(KOPrefs::instance()->mWriteBackFile),topFrame); + topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); + ++iii; + wb = + addWidBool(i18n("Write back existing entries only"), + &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); + topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); + ++iii; + +#endif +} + +void KOPrefsDialog::setupMainTab() +{ + QFrame *topFrame = addPage(i18n("General"),0,0); + // DesktopIcon("identity",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,6,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + // KPrefsWidBool *emailControlCenter = +// addWidBool(i18n("&Use email settings from Control Center"), +// &(KOPrefs::instance()->mEmailControlCenter),topFrame); +// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); + // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), + // SLOT(toggleEmailSettings(bool))); + + mNameEdit = new QLineEdit(topFrame); + mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); + topLayout->addWidget(mNameLabel,0,0); + topLayout->addWidget(mNameEdit,0,1); + + mEmailEdit = new QLineEdit(topFrame); + mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); + topLayout->addWidget(mEmailLabel,1,0); + topLayout->addWidget(mEmailEdit,1,1); + KPrefsWidBool *wb; + QHBox *dummy; + if ( QApplication::desktop()->width() > 480 ) { + dummy = new QHBox(topFrame); + } else { + dummy = new QVBox(topFrame); + } + + topLayout->addMultiCellWidget(dummy, 2,2,0,1); + addWidBool(i18n("Full menu bar(nr)"), + &(KOPrefs::instance()->mShowFullMenu),dummy); + + + addWidBool(i18n("Mini icons in toolbar(nr)"), + &(KOPrefs::instance()->mToolBarMiniIcons),dummy); + + + dummy = new QHBox(topFrame); + new QLabel(i18n("Days in What's Next:"),dummy); + mWhatsNextSpin = new QSpinBox(1,14,1,dummy); + + topLayout->addMultiCellWidget(dummy,3,3,0,1); + + + + dummy = new QHBox(topFrame); + new QLabel(i18n("Days in Next-X-Days:"),dummy); + mNextXDaysSpin = new QSpinBox(2,14,1,dummy); + + topLayout->addMultiCellWidget(dummy,4,4,0,1); + + QHBox *prioBox = new QHBox(topFrame); + // intervalBox->setSpacing(spacingHint()); + topLayout->addMultiCellWidget(prioBox,5,5,0,1); + QString messa = i18n("Show topmost todo prios in What's Next:"); + + if ( QApplication::desktop()->width() < 300 ) + messa = i18n("Show topmost todo prios in What's N.:"); + QLabel *prioLabel = new QLabel(messa, prioBox); + mPrioSpin = new QSpinBox(0,5,1,prioBox); + if ( QApplication::desktop()->width() < 300 ) + mPrioSpin->setFixedWidth( 40 ); + + // KPrefsWidBool *bcc = +// addWidBool(i18n("Send copy to owner when mailing events"), +// &(KOPrefs::instance()->mBcc),topFrame); +// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); + + + // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); + //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); + + // addWidBool(i18n("Enable automatic saving of calendar"), + // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); + + QHBox *intervalBox = new QHBox(topFrame); + // intervalBox->setSpacing(spacingHint()); + topLayout->addMultiCellWidget(intervalBox,6,6,0,1); + QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); + mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); + autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); + /* + QHBox * agendasize = new QHBox ( topFrame ); + + new QLabel (i18n("AllDayAgenda Height:"), agendasize ); + + + mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); + topLayout->addMultiCellWidget(agendasize,7,7,0,1); + */ + KPrefsWidBool *verticalScreen = + addWidBool(i18n("Show vertical screen (Needs restart)"), + &(KOPrefs::instance()->mVerticalScreen),topFrame); + //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); + topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); + + KPrefsWidBool *ask = + addWidBool(i18n("Ask for quit when closing KO/Pi"), + &(KOPrefs::instance()->mAskForQuit),topFrame); + topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); + + + /* + KPrefsWidBool *confirmCheck = + addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), + topFrame); + topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); + + + mEnableGroupScheduling = + addWidBool(i18n("Enable group scheduling"), + &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); + topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); + connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), + SLOT(warningGroupScheduling())); + + mEnableProjectView = + addWidBool(i18n("Enable project view"), + &(KOPrefs::instance()->mEnableProjectView),topFrame); + topLayout->addWidget(mEnableProjectView->checkBox(),9,0); + connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), + SLOT(warningProjectView())); + + // Can't be disabled anymore + mEnableGroupScheduling->checkBox()->hide(); + + // Disable setting, because this feature now becomes stable + mEnableProjectView->checkBox()->hide(); + + KPrefsWidRadios *defaultFormatGroup = + addWidRadios(i18n("Default Calendar Format"), + &(KOPrefs::instance()->mDefaultFormat),topFrame); + defaultFormatGroup->addRadio(i18n("vCalendar")); + defaultFormatGroup->addRadio(i18n("iCalendar")); + + topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); + + // Default format unconditionally is iCalendar + defaultFormatGroup->groupBox()->hide(); + + KPrefsWidRadios *mailClientGroup = + addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), + topFrame); + mailClientGroup->addRadio(i18n("KMail")); + mailClientGroup->addRadio(i18n("Sendmail")); + topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); + + KPrefsWidBool *htmlsave = + addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), + topFrame); + topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); + + KPrefsWidRadios *destinationGroup = + addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), + topFrame); + destinationGroup->addRadio(i18n("be added to the standard resource")); + destinationGroup->addRadio(i18n("be asked which resource to use")); + topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); + + topLayout->setRowStretch(14,1); + */ +} + + +void KOPrefsDialog::setupTimeTab() +{ + QFrame *topFrame = addPage(i18n("Time"),0,0); + // DesktopIcon("clock",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,4,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + QHBox *dummy = new QHBox(topFrame); + KPrefsWidTime *dayBegins = + addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), + dummy); + //topLayout->addWidget(dayBegins->label(),2,0); + + //topLayout->addWidget(dayBegins->spinBox(),2,1); + topLayout->addMultiCellWidget(dummy,0,0,0,1); + + topLayout->addWidget(new QLabel(i18n("Default appointment time:"), + topFrame),1,0); + mStartTimeSpin = new QSpinBox(0,23,1,topFrame); + mStartTimeSpin->setSuffix(":00"); + topLayout->addWidget(mStartTimeSpin,1,1); + + topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), + topFrame),2,0); + mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); + mDefaultDurationSpin->setSuffix(":00"); + topLayout->addWidget(mDefaultDurationSpin,2,1); + + QStringList alarmList; + alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") + << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; + topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), + 3,0); + mAlarmTimeCombo = new QComboBox(topFrame); + mAlarmTimeCombo->insertStringList(alarmList); + topLayout->addWidget(mAlarmTimeCombo,3,1); + + + QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, + i18n("Working Hours"), + topFrame); + topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); + workingHoursGroup->layout()->setSpacing( 0 ); + workingHoursGroup->layout()->setMargin( 4 ); + QHBox *workStartBox = new QHBox(workingHoursGroup); + // workStartBox->setMargin( 0 ); + addWidTime(i18n("Daily starting hour:"), + &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); + + QHBox *workEndBox = new QHBox(workingHoursGroup); + //workEndBox->setMargin( 0 ); + addWidTime(i18n("Daily ending hour:"), + &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); + QVBox *excludeBox = new QVBox(workingHoursGroup); + //excludeBox->setMargin( 0 ); + addWidBool(i18n("Exclude holidays"), + &(KOPrefs::instance()->mExcludeHolidays),excludeBox); + + addWidBool(i18n("Exclude Saturdays"), + &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); + +// KPrefsWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), +// &(KOPrefs::instance()->mMarcusBainsShowSeconds), +// topFrame); +// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); + + // topLayout->setRowStretch(6,1); +} + + +void KOPrefsDialog::setupViewsTab() +{ + + QFrame *topFrame = addPage(i18n("Views"),0,0); + // DesktopIcon("viewmag",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,6,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + +// QBoxLayout *dayBeginsLayout = new QHBoxLayout; +// topLayout->addLayout(dayBeginsLayout,0,0); + +// KPrefsWidTime *dayBegins = +// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), +// topFrame); +// dayBeginsLayout->addWidget(dayBegins->label()); +// dayBeginsLayout->addStretch(1); +// dayBeginsLayout->addWidget(dayBegins->spinBox()); + +// QBoxLayout *nextDaysLayout = new QHBoxLayout; +// topLayout->addLayout(nextDaysLayout,1,0); +// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); +// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); +// nextDaysLayout->addStretch(1); +// nextDaysLayout->addWidget(mNextXDaysSpin); + + + int ii = 0; + KPrefsWidBool *dummy = + addWidBool(i18n("Edit item on doubleclick (if not, show)"), + &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Highlight current day in agenda"), + &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Use light color for highlight current day"), + &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + KPrefsWidBool *dailyRecur = + addWidBool(i18n("Show events that recur daily in date nav."), + &(KOPrefs::instance()->mDailyRecur),topFrame); + topLayout->addWidget(dailyRecur->checkBox(),ii++,0); + + KPrefsWidBool *weeklyRecur = + addWidBool(i18n("Show ev. that recur weekly in date nav."), + &(KOPrefs::instance()->mWeeklyRecur),topFrame); + topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); + if ( QApplication::desktop()->width() > 640 ) { + + KPrefsWidBool *enableToolTips = + addWidBool(i18n("Enable tooltips displaying summary of ev."), + &(KOPrefs::instance()->mEnableToolTips),topFrame); + topLayout->addWidget(enableToolTips->checkBox(),ii++,0); + + } + KPrefsWidBool *passwdk = + addWidBool(i18n("Show parent To-Do's in What's Next view"), + &(KOPrefs::instance()->mWNViewShowsParents),topFrame); + topLayout->addWidget(passwdk->checkBox(), ii++,0); + + passwdk = + addWidBool(i18n("Show location in What's Next view"), + &(KOPrefs::instance()->mWNViewShowLocation),topFrame); + topLayout->addWidget(passwdk->checkBox(), ii++,0); + + passwdk = + addWidBool(i18n("Show Sync Events in WN/Agenda view"), + &(KOPrefs::instance()->mShowSyncEvents),topFrame); + topLayout->addWidget(passwdk->checkBox(), ii++,0); + + + KPrefsWidBool *marcusBainsEnabled = + addWidBool(i18n("Show Marcus Bains line"), + &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); + topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); + + + // topLayout->addWidget(hourSizeGroup,ii++,0); + // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); + //topLayout->setRowStretch(11,1); + + + + + + + topFrame = addPage(i18n("ViewChange"),0,0); + // DesktopIcon("viewmag",KIcon::SizeMedium)); + + topLayout = new QGridLayout(topFrame,6,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + ii = 0; + + + dummy = + addWidBool(i18n("Hold fullscreen on view change"), + &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Hold non-fullscreen on view change"), + &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + + KPrefsWidBool *fullViewTodo = + addWidBool(i18n("Event list view uses full window"), + &(KOPrefs::instance()->mFullViewTodo),topFrame); + topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); + + KPrefsWidBool *fullViewMonth = + addWidBool(i18n("Next days view uses full window"), + &(KOPrefs::instance()->mFullViewMonth),topFrame); + topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Set agenda to DayBeginsAt on change"), + &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Set agenda to current time on change"), + &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Listview uses monthly timespan"), + &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + dummy = + addWidBool(i18n("Highlight selection in Time Edit"), + &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); + topLayout->addWidget( dummy->checkBox(), ii++,0); + + + + + + topFrame = addPage(i18n("Month View"),0,0); + // DesktopIcon("viewmag",KIcon::SizeMedium)); + + topLayout = new QGridLayout(topFrame,5,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + ii = 0; + QLabel *lab; + QHBox *habo = new QHBox( topFrame ); + if ( QApplication::desktop()->width() < 320 ) { + lab = new QLabel ( i18n("Show events that recur "), topFrame ); + topLayout->addMultiCellWidget(lab,ii, ii,0,1); + ii++; + + } else { + new QLabel ( i18n("Show events that recur "), habo ); + + } + dailyRecur = + addWidBool(i18n("daily"), + &(KOPrefs::instance()->mMonthDailyRecur),habo); + // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); + + weeklyRecur = + addWidBool(i18n("weekly"), + &(KOPrefs::instance()->mMonthWeeklyRecur),habo); + topLayout->addMultiCellWidget(habo,ii, ii,0,1); + ii++; + + + habo = new QHBox( topFrame ); + if ( QApplication::desktop()->width() < 320 ) { + lab = new QLabel (i18n("Show in every cell ") , topFrame ); + topLayout->addMultiCellWidget(lab,ii, ii,0,1); + ii++; + + } else { + new QLabel ( i18n("Show in every cell "), habo ); + } + weeklyRecur = + addWidBool(i18n("short month"), + &(KOPrefs::instance()->mMonthShowShort),habo); + weeklyRecur = + addWidBool(i18n("icons"), + &(KOPrefs::instance()->mMonthShowIcons),habo); + + topLayout->addMultiCellWidget(habo,ii, ii,0,1); + ii++; +#ifdef DESKTOP_VERSION + KPrefsWidBool *enableMonthScroll = + addWidBool(i18n("Enable scrollbars in month view cells"), + &(KOPrefs::instance()->mEnableMonthScroll),topFrame); + topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); +#endif + + dummy = + addWidBool(i18n("Show Sat/Sun together"), + &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + KPrefsWidBool *coloredCategoriesInMonthView = + addWidBool(i18n("Month view uses category colors"), + &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); + topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Categorie colors are applied to text"), + &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + coloredCategoriesInMonthView = + addWidBool(i18n("Month view uses day colors"), + &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); + topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); + + KPrefsWidColor *holidayColor = + addWidColor(i18n("Day color odd months"), + &(KOPrefs::instance()->mMonthViewOddColor),topFrame); + topLayout->addWidget(holidayColor->label(),ii,0); + topLayout->addWidget(holidayColor->button(),ii++,1); + + holidayColor = + addWidColor(i18n("Day color even months"), + &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); + topLayout->addWidget(holidayColor->label(),ii,0); + topLayout->addWidget(holidayColor->button(),ii++,1); + + + holidayColor = + addWidColor(i18n("Color for Sundays + category \"Holiday\""), + &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); + topLayout->addWidget(holidayColor->label(),ii,0); + topLayout->addWidget(holidayColor->button(),ii++,1); + + // *********************** Todo View + + topFrame = addPage(i18n("Todo View"),0,0); + // DesktopIcon("viewmag",KIcon::SizeMedium)); + + topLayout = new QGridLayout(topFrame,4,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + ii = 0; + + KPrefsWidBool *showCompletedTodo = + addWidBool(i18n("To-do view shows completed Todos"), + &(KOPrefs::instance()->mShowCompletedTodo),topFrame); + topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); + dummy = + addWidBool(i18n("To-do view shows complete as 'xx %'"), + &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Small To-do view uses smaller font"), + &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + + + dummy = + addWidBool(i18n("Todo view uses category colors"), + &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + + QWidget* wid = new QWidget( topFrame ); + // Todo due today color + KPrefsWidColor *todoDueTodayColor = + addWidColor(i18n("Todo due today color:"), + &(KOPrefs::instance()->mTodoDueTodayColor),wid); + QHBoxLayout *widLayout = new QHBoxLayout(wid); + widLayout->addWidget( todoDueTodayColor->label() ); + widLayout->addWidget( todoDueTodayColor->button() ); + topLayout->addWidget(wid,ii++,0); + //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); + + // Todo overdue color + wid = new QWidget( topFrame ); + widLayout = new QHBoxLayout(wid); + KPrefsWidColor *todoOverdueColor = + addWidColor(i18n("Todo overdue color:"), + &(KOPrefs::instance()->mTodoOverdueColor),wid); + widLayout->addWidget(todoOverdueColor->label()); + widLayout->addWidget(todoOverdueColor->button()); + topLayout->addWidget(wid,ii++,0); + + dummy = + addWidBool(i18n("Colors are applied to text"), + &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Allday Agenda view shows todos"), + &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + + + + topFrame = addPage(i18n("Alarm"),0,0); + // DesktopIcon("viewmag",KIcon::SizeMedium)); + + topLayout = new QGridLayout(topFrame,2,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + int iii = 0; + + dummy = + addWidBool(i18n("Use internal alarm notification"), + &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); + topLayout->addWidget(dummy->checkBox(),iii++,0); + 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); + + topLayout->addWidget(lab ,iii++,0); +#ifndef DESKTOP_VERSION + lab->setAlignment( AlignLeft|WordBreak|AlignTop); +#else + lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); + lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); +#endif + + QHBox* dummyBox = new QHBox(topFrame); + new QLabel(i18n("Play beeps count:"),dummyBox); + mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); + topLayout->addWidget(dummyBox,iii++,0); + + dummyBox = new QHBox(topFrame); + new QLabel(i18n("Beeps interval in sec:"),dummyBox); + mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); + topLayout->addWidget(dummyBox,iii++,0); + + dummyBox = new QHBox(topFrame); + new QLabel(i18n("Default suspend time in min:"),dummyBox); + mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); + topLayout->addWidget(dummyBox,iii++,0); + + dummyBox = new QHBox(topFrame); + new QLabel(i18n("Auto suspend count:"),dummyBox); + mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); + topLayout->addWidget(dummyBox,iii++,0); + + + + + + + + QHBox* hbo = new QHBox ( topFrame ); + mDefaultAlarmFile = new QLineEdit(hbo); + QPushButton * loadTemplate = new QPushButton(hbo); + QPixmap icon; + if ( QApplication::desktop()->width() < 321 ) + icon = SmallIcon("fileimport16"); + else + icon = SmallIcon("fileimport"); + loadTemplate->setIconSet (icon ) ; + connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); + int size = loadTemplate->sizeHint().height(); + loadTemplate->setFixedSize( size, size ); + //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); + // topLayout->addWidget(lab ,iii++,0); + lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); + topLayout->addWidget(lab ,iii++,0); + topLayout->addWidget(hbo,iii++,0); + // 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); + +// topLayout->addWidget(lab ,iii++,0); +// #ifndef DESKTOP_VERSION +// lab->setAlignment( AlignLeft|WordBreak|AlignTop); +// #else +// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); +// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); +// #endif + + +} + +void KOPrefsDialog::selectSoundFile() +{ + QString fileName = mDefaultAlarmFile->text(); + fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); + if ( fileName.length() > 0 ) + mDefaultAlarmFile->setText( fileName ); +} +void KOPrefsDialog::setupFontsTab() +{ + + QFrame *topFrame = addPage(i18n("Fonts"),0,0); + // DesktopIcon("fonts",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,7,3); + topLayout->setSpacing(1); + topLayout->setMargin(3); + KPrefsWidFont * tVFont; + int i = 0; + KPrefsWidFont *timeLabelsFont = + addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), + &(KOPrefs::instance()->mDateNavigatorFont),topFrame); + topLayout->addWidget(timeLabelsFont->label(),i,0); + topLayout->addWidget(timeLabelsFont->preview(),i,1); + topLayout->addWidget(timeLabelsFont->button(),i,2); + ++i; + + + timeLabelsFont = + addWidFont(i18n("Mon 15"),i18n("Date Labels:"), + &(KOPrefs::instance()->mTimeLabelsFont),topFrame); + topLayout->addWidget(timeLabelsFont->label(),i,0); + topLayout->addWidget(timeLabelsFont->preview(),i,1); + topLayout->addWidget(timeLabelsFont->button(),i,2); + ++i; + + KPrefsWidFont *timeBarFont = + addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), + &(KOPrefs::instance()->mTimeBarFont),topFrame); + topLayout->addWidget(timeBarFont->label(),i,0); + topLayout->addWidget(timeBarFont->preview(),i,1); + topLayout->addWidget(timeBarFont->button(),i,2); + ++i; + + + KPrefsWidFont *marcusBainsFont = + addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), + &(KOPrefs::instance()->mMarcusBainsFont),topFrame); + topLayout->addWidget(marcusBainsFont->label(),i,0); + topLayout->addWidget(marcusBainsFont->preview(),i,1); + topLayout->addWidget(marcusBainsFont->button(),i,2); + ++i; + + tVFont = + addWidFont(i18n("Summary"),i18n("Event Viewer:"), + &(KOPrefs::instance()->mEventViewFont),topFrame); + topLayout->addWidget(tVFont->label(),i,0); + topLayout->addWidget(tVFont->preview(),i,1); + topLayout->addWidget(tVFont->button(),i,2); + ++i; + + + + tVFont = + addWidFont(i18n("Details"),i18n("EditorBox:"), + &(KOPrefs::instance()->mEditBoxFont),topFrame); + topLayout->addWidget(tVFont->label(),i,0); + topLayout->addWidget(tVFont->preview(),i,1); + topLayout->addWidget(tVFont->button(),i,2); + ++i; + + + + topLayout->setColStretch(1,1); + topLayout->setRowStretch(4,1); + + + i = 0; + topFrame = addPage(i18n("View Fonts"),0, + DesktopIcon("fonts",KIcon::SizeMedium)); + + topLayout = new QGridLayout(topFrame,7,3); + topLayout->setSpacing(1); + topLayout->setMargin(3); + + tVFont = + addWidFont(i18n("Configure KO"),i18n("What's Next View:"), + &(KOPrefs::instance()->mWhatsNextFont),topFrame); + topLayout->addWidget(tVFont->label(),i,0); + topLayout->addWidget(tVFont->preview(),i,1); + topLayout->addWidget(tVFont->button(),i,2); + ++i; + KPrefsWidFont *agendaViewFont = + addWidFont(i18n("Event text"),i18n("Agenda view:"), + &(KOPrefs::instance()->mAgendaViewFont),topFrame); + topLayout->addWidget(agendaViewFont->label(),i,0); + topLayout->addWidget(agendaViewFont->preview(),i,1); + topLayout->addWidget(agendaViewFont->button(),i,2); + ++i; + + + KPrefsWidFont *monthViewFont = + addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), + i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); + topLayout->addWidget(monthViewFont->label(),i,0); + topLayout->addWidget(monthViewFont->preview(),i,1); + topLayout->addWidget(monthViewFont->button(),i,2); + ++i; + + + KPrefsWidFont *lVFont = + addWidFont(i18n("Event"),i18n("List View:"), + &(KOPrefs::instance()->mListViewFont),topFrame); + topLayout->addWidget(lVFont->label(),i,0); + topLayout->addWidget(lVFont->preview(),i,1); + topLayout->addWidget(lVFont->button(),i,2); + ++i; + + + tVFont = + addWidFont(i18n("ToDo"),i18n("ToDoView:"), + &(KOPrefs::instance()->mTodoViewFont),topFrame); + topLayout->addWidget(tVFont->label(),i,0); + topLayout->addWidget(tVFont->preview(),i,1); + topLayout->addWidget(tVFont->button(),i,2); + ++i; + + + tVFont = + addWidFont(i18n("Today"),i18n("JournalView:"), + &(KOPrefs::instance()->mJornalViewFont),topFrame); + topLayout->addWidget(tVFont->label(),i,0); + topLayout->addWidget(tVFont->preview(),i,1); + topLayout->addWidget(tVFont->button(),i,2); + ++i; + + + + + topLayout->setColStretch(1,1); + topLayout->setRowStretch(4,1); + + + + +} + +void KOPrefsDialog::setupColorsTab() +{ + QFrame *topFrame = addPage(i18n("Colors"),0,0); + // DesktopIcon("colorize",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,5,2); + // topLayout->setSpacing(spacingHint()); + // topLayout->setMargin(marginHint()); + + topLayout->setSpacing(2); + topLayout->setMargin(3); + + int ii = 1; + QGroupBox *categoryGroup ; + + categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), + topFrame); + topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); + + mCategoryCombo = new QComboBox(categoryGroup); + mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); + connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); + + mCategoryButton = new KColorButton(categoryGroup); + connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); + updateCategoryColor(); + + + // Holiday Color + + KPrefsWidColor *holidayColor = + addWidColor(i18n("Holiday color:"), + &(KOPrefs::instance()->mHolidayColor),topFrame); + topLayout->addWidget(holidayColor->label(),ii,0); + topLayout->addWidget(holidayColor->button(),ii++,1); + + // Highlight Color + KPrefsWidColor *highlightColor = + addWidColor(i18n("Highlight color:"), + &(KOPrefs::instance()->mHighlightColor),topFrame); + topLayout->addWidget(highlightColor->label(),ii,0); + topLayout->addWidget(highlightColor->button(),ii++,1); + + // Event color + KPrefsWidColor *eventColor = + addWidColor(i18n("Default event color:"), + &(KOPrefs::instance()->mEventColor),topFrame); + topLayout->addWidget(eventColor->label(),ii,0); + topLayout->addWidget(eventColor->button(),ii++,1); + + // agenda view background color + KPrefsWidColor *agendaBgColor = + addWidColor(i18n("Agenda view background color:"), + &(KOPrefs::instance()->mAgendaBgColor),topFrame); + topLayout->addWidget(agendaBgColor->label(),ii,0); + topLayout->addWidget(agendaBgColor->button(),ii++,1); + + // working hours color + KPrefsWidColor *workingHoursColor = + addWidColor(i18n("Working hours color:"), + &(KOPrefs::instance()->mWorkingHoursColor),topFrame); + topLayout->addWidget(workingHoursColor->label(),ii,0); + topLayout->addWidget(workingHoursColor->button(),ii++,1); + + KPrefsWidBool *sb = + addWidBool(i18n("Use colors for application:"), + &(KOPrefs::instance()->mUseAppColors),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); + + ii++; + KPrefsWidColor * workingHoursColor1 = + addWidColor(i18n("Buttons, menus, etc.:"), + &(KOPrefs::instance()->mAppColor1),topFrame); + topLayout->addWidget(workingHoursColor1->label(),ii,0); + topLayout->addWidget(workingHoursColor1->button(),ii++,1); + + KPrefsWidColor * workingHoursColor2 = + addWidColor(i18n("Frames, labels, etc.:"), + &(KOPrefs::instance()->mAppColor2),topFrame); + topLayout->addWidget(workingHoursColor2->label(),ii,0); + topLayout->addWidget(workingHoursColor2->button(),ii++,1); + + + +} + +void KOPrefsDialog::setCategoryColor() +{ + mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); +} + +void KOPrefsDialog::updateCategoryColor() +{ + QString cat = mCategoryCombo->currentText(); + QColor *color = mCategoryDict.find(cat); + if (!color) { + color = KOPrefs::instance()->categoryColor(cat); + } + if (color) { + mCategoryButton->setColor(*color); + } +} + +void KOPrefsDialog::setupPrinterTab() +{ + mPrinterTab = addPage(i18n("Printing"),0, + DesktopIcon("fileprint",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + topLayout->setRowStretch(4,1); +} + +void KOPrefsDialog::setupGroupSchedulingTab() +{ +#if 0 + QFrame *topFrame = addPage(i18n("Group Scheduling"),0, + DesktopIcon("personal",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,6,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + +#if 0 + KPrefsWidRadios *schedulerGroup = + addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), + topFrame); + schedulerGroup->addRadio("Dummy"); // Only for debugging + schedulerGroup->addRadio(i18n("Mail client")); + + topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); +#endif + + KPrefsWidRadios *sendGroup = + addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), + topFrame); + sendGroup->addRadio(i18n("Send to outbox")); + sendGroup->addRadio(i18n("Send directly")); + + topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); + + topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); + mAMails = new QListView(topFrame); + mAMails->addColumn(i18n("Email"),300); + topLayout->addMultiCellWidget(mAMails,3,3,0,1); + + topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); + aEmailsEdit = new QLineEdit(topFrame); + aEmailsEdit->setEnabled(false); + topLayout->addWidget(aEmailsEdit,4,1); + + QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); + topLayout->addWidget(add,5,0); + QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); + topLayout->addWidget(del,5,1); + + //topLayout->setRowStretch(2,1); + connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); + connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); + connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); + connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); +#endif +} + +void KOPrefsDialog::setupGroupAutomationTab() +{ + return; + QFrame *topFrame = addPage(i18n("Group Automation"),0, + DesktopIcon("personal",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,5,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + KPrefsWidRadios *autoRefreshGroup = + addWidRadios(i18n("Auto Send Refresh"), + &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); + autoRefreshGroup->addRadio(i18n("Never")); + autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); + //autoRefreshGroup->addRadio(i18n("selected emails")); + topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); + + KPrefsWidRadios *autoInsertGroup = + addWidRadios(i18n("Auto Insert IMIP Replies"), + &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); + autoInsertGroup->addRadio(i18n("Never")); + autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); + //autoInsertGroup->addRadio(i18n("selected emails")); + topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); + + KPrefsWidRadios *autoRequestGroup = + addWidRadios(i18n("Auto Insert IMIP Requests"), + &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); + autoRequestGroup->addRadio(i18n("Never")); + autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); + //autoInsertGroup->addRadio(i18n("selected emails")); + topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); + + KPrefsWidRadios *autoFreeBusyGroup = + addWidRadios(i18n("Auto Send FreeBusy Information"), + &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); + autoFreeBusyGroup->addRadio(i18n("Never")); + autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); + //autoFreeBusyGroup->addRadio(i18n("selected emails")); + topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); + + KPrefsWidRadios *autoFreeBusyReplyGroup = + addWidRadios(i18n("Auto Save FreeBusy Replies"), + &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); + autoFreeBusyReplyGroup->addRadio(i18n("Never")); + autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); + //autoFreeBusyGroup->addRadio(i18n("selected emails")); + topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); +} + +void KOPrefsDialog::showPrinterTab() +{ + showPage(pageIndex(mPrinterTab)); +} + + +void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, + const QStringList *tags) +{ + if (tags) { + int i = tags->findIndex(text); + if (i > 0) combo->setCurrentItem(i); + } else { + for(int i=0;i<combo->count();++i) { + if (combo->text(i) == text) { + combo->setCurrentItem(i); + break; + } + } + } +} + +void KOPrefsDialog::usrReadConfig() +{ + mNameEdit->setText(KOPrefs::instance()->fullName()); + mEmailEdit->setText(KOPrefs::instance()->email()); + + mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); + QDate current ( 2001, 1,1); + mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); + mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); + setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); + //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); + mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); + mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); + mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); + // if (KOPrefs::instance()->mAllDaySize > 47 ) + // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; + //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); + + mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); + mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); + mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); + // mAMails->clear(); + // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); +// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { +// QListViewItem *item = new QListViewItem(mAMails); +// item->setText(0,*it); +// mAMails->insertItem(item); +// } + + // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); + //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); + //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); + //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); + + //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); + mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); + QString dummy = KOPrefs::instance()->mUserDateFormatLong; + mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); + dummy = KOPrefs::instance()->mUserDateFormatShort; + mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); + updateCategories(); + mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); + mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); + mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); + mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); +} + + +void KOPrefsDialog::usrWriteConfig() +{ + + // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); + //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); + //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); + //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); + //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); + KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); + + KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); + KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); + KOPrefs::instance()->setFullName(mNameEdit->text()); + KOPrefs::instance()->setEmail(mEmailEdit->text()); + + KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); + + KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); + QDate date; + date = mStartDateSavingEdit->date(); + int sub = 0; + if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) + sub = 1; + KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; + date = mEndDateSavingEdit->date(); + if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) + sub = 1; + else + sub = 0; + KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; + // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); + + KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); + KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); + KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); + + //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); + + QDictIterator<QColor> it(mCategoryDict); + while (it.current()) { + KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); + ++it; + } + + KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); + KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); + KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); + + KOPrefs::instance()->mAdditionalMails.clear(); + // QListViewItem *item; + // item = mAMails->firstChild(); + // while (item) + // { + // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); + // item = item->nextSibling(); + // } + KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); + KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; + KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; + KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; + +} + +void KOPrefsDialog::updateCategories() +{ + mCategoryCombo->clear(); + mCategoryDict.clear(); + mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); + updateCategoryColor(); +} + +void KOPrefsDialog::warningGroupScheduling() +{ + warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); +} + +void KOPrefsDialog::warningProjectView() +{ + warningExperimental(mEnableProjectView->checkBox()->isChecked()); +} + +void KOPrefsDialog::warningExperimental(bool on) +{ + if (on) { + KMessageBox::information(this,i18n("This is an experimental feature. " + "It may not work, it may do nothing useful and it may cause data loss. " + "Use with care.\n" + "You have to restart KOrganizer for this setting to take effect.")); + } else { + KMessageBox::information(this, + i18n("You have to restart KOrganizer for this setting to take effect.")); + } +} + +void KOPrefsDialog::toggleEmailSettings(bool on) +{ + if (on) { + mEmailEdit->setEnabled(false); + mNameEdit->setEnabled(false); + mEmailLabel->setEnabled(false); + mNameLabel->setEnabled(false); + + KEMailSettings settings; + mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); + mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); + } else { + mEmailEdit->setEnabled(true); + mNameEdit->setEnabled(true); + mEmailLabel->setEnabled(true); + mNameLabel->setEnabled(true); + } +} + +void KOPrefsDialog::addItem() +{ + // aEmailsEdit->setEnabled(true); +// QListViewItem *item = new QListViewItem(mAMails); +// mAMails->insertItem(item); +// mAMails->setSelected(item,true); +// aEmailsEdit->setText(i18n("(EmptyEmail)")); +} + +void KOPrefsDialog::removeItem() +{ +// QListViewItem *item; +// item = mAMails->selectedItem(); +// if (!item) return; +// mAMails->takeItem(item); +// item = mAMails->selectedItem(); +// if (!item) { +// aEmailsEdit->setText(""); +// aEmailsEdit->setEnabled(false); +// } +// if (mAMails->childCount() == 0) { +// aEmailsEdit->setEnabled(false); +// } +} + +void KOPrefsDialog::updateItem() +{ + // QListViewItem *item; +// item = mAMails->selectedItem(); +// if (!item) return; +// item->setText(0,aEmailsEdit->text()); +} + +void KOPrefsDialog::updateInput() +{ +// QListViewItem *item; +// item = mAMails->selectedItem(); +// if (!item) return; +// aEmailsEdit->setEnabled(true); +// aEmailsEdit->setText(item->text(0)); +} +void KOPrefsDialog::updateTimezoneOffset( int index ) +{ + /* + qDebug("updateTimezoneOffset %d ", index); + if ( index < 24 ) { + mTimezoneOffsetSpin->setEnabled ( false ); + mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); + + + } else { + if ( index == 24 ) { + mTimezoneOffsetSpin->setEnabled ( true ); + mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); + + } else { + mTimezoneOffsetSpin->setEnabled ( false ); + mTimezoneOffsetSpin->setValue( 0 ); + } + } + */ +} + +void KOPrefsDialog::setupTimeZoneTab() +{ + QFrame *topFrame = addPage(i18n("Time Zone"),0,0); + // DesktopIcon("clock",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,5,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + QHBox *timeZoneBox = new QHBox( topFrame ); + topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); + + new QLabel( i18n("Timezone:"), timeZoneBox ); + mTimeZoneCombo = new QComboBox( timeZoneBox ); + if ( QApplication::desktop()->width() < 300 ) { + mTimeZoneCombo->setMaximumWidth(150); + } + + QStringList list; + list = KGlobal::locale()->timeZoneList(); + mTimeZoneCombo->insertStringList(list); + + // find the currently set time zone and select it + QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; + int nCurrentlySet = 11; + for (int i = 0; i < mTimeZoneCombo->count(); i++) + { + if (mTimeZoneCombo->text(i) == sCurrentlySet) + { + nCurrentlySet = i; + break; + } + } + mTimeZoneCombo->setCurrentItem(nCurrentlySet); + int iii = 1; + KPrefsWidBool *sb = + addWidBool(i18n("Timezone has daylight saving"), + &(KOPrefs::instance()->mUseDaylightsaving),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); + ++iii; + QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); + topLayout->addMultiCellWidget(lab, iii,iii,0,1); + ++iii; + lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); + topLayout->addMultiCellWidget(lab, iii,iii,0,1); + ++iii; + lab = new QLabel( i18n("Daylight start:"), topFrame ); + topLayout->addWidget(lab, iii,0); + mStartDateSavingEdit = new KDateEdit(topFrame); + topLayout->addWidget(mStartDateSavingEdit, iii,1); + ++iii; + + lab = new QLabel( i18n("Daylight end:"), topFrame ); + topLayout->addWidget(lab, iii,0); + mEndDateSavingEdit = new KDateEdit(topFrame); + topLayout->addWidget(mEndDateSavingEdit, iii,1); + ++iii; + QDate current ( 2001, 1,1); + mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); + mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); + + +} +#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 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include <qlayout.h> +#include <qlabel.h> +#include <qgroupbox.h> +#include <qbuttongroup.h> +#include <qlineedit.h> +#include <qfont.h> +#include <qslider.h> +#include <qfile.h> +#include <qtextstream.h> +#include <qcombobox.h> +#include <qvbox.h> +#include <qhbox.h> +#include <qregexp.h> +#include <qspinbox.h> +#include <qdatetime.h> +#include <qcheckbox.h> +#include <qradiobutton.h> +#include <qpushbutton.h> +#include <qstrlist.h> +#include <qapplication.h> + +#include <kcolorbutton.h> +#include <kdebug.h> +#include <klocale.h> +#include <kglobal.h> +#include <kfontdialog.h> +#include <kfiledialog.h> +#include <kmessagebox.h> +#include <kcolordialog.h> +#include <kiconloader.h> +#include <kemailsettings.h> +#include <kstandarddirs.h> + +#include <kurlrequester.h> +#include <klineedit.h> + +#if defined(USE_SOLARIS) +#include <sys/param.h> + +#define ZONEINFODIR "/usr/share/lib/zoneinfo" +#define INITFILE "/etc/default/init" +#endif + +#include "koprefs.h" + +#include "koprefsdialog.h" + + +KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : + KPrefsDialog(KOPrefs::instance(),parent,name,true) +{ + + setCaption( i18n("Preferences - some settings need a restart (nr)")); + mCategoryDict.setAutoDelete(true); + + KGlobal::locale()->insertCatalogue("timezones"); + + setupMainTab(); + setupLocaleTab(); + setupTimeZoneTab(); + setupTimeTab(); + setupLocaleDateTab(); + setupFontsTab(); + setupColorsTab(); + setupViewsTab(); + //setupSyncTab(); + //setupSyncAlgTab(); + //setupPrinterTab(); + //setupGroupSchedulingTab(); + //setupGroupAutomationTab(); +} + + +KOPrefsDialog::~KOPrefsDialog() +{ +} + +void KOPrefsDialog::setupLocaleDateTab() +{ +QFrame *topFrame = addPage(i18n("Date Format"),0,0); + QGridLayout *topLayout = new QGridLayout(topFrame,3,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + int iii = 0; + + + KPrefsWidRadios *syncPrefsGroup = + addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); + QString format; + if ( QApplication::desktop()->width() < 480 ) + format = "(%d.%m.%Y)"; + else + format = "(%d.%m.%Y|%A %d %B %Y)"; + syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); + if ( QApplication::desktop()->width() < 480 ) + format = "(%m.%d.%Y)"; + else + format = "(%m.%d.%Y|%A %B %d %Y)"; + syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); + if ( QApplication::desktop()->width() < 480 ) + format = "(%Y-%m-%d)"; + else + format = "(%Y-%m-%d|%A %Y %B %d)"; + syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); + syncPrefsGroup->addRadio(i18n("User defined")); + topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); + ++iii; + ++iii; + QLabel * lab; + mUserDateFormatLong = new QLineEdit(topFrame); + lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mUserDateFormatLong,iii,1); + ++iii; + mUserDateFormatShort = new QLineEdit(topFrame); + lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mUserDateFormatShort,iii,1); + ++iii; + lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); + topLayout->addMultiCellWidget(lab ,iii,iii,0,1); + ++iii; + lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); + topLayout->addMultiCellWidget(lab ,iii,iii,0,1); + ++iii; + lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); + topLayout->addMultiCellWidget(lab ,iii,iii,0,1); + ++iii; + +} + +void KOPrefsDialog::setupLocaleTab() +{ + QFrame *topFrame = addPage(i18n("Locale"),0,0); + QGridLayout *topLayout = new QGridLayout(topFrame,4,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + int iii = 0; + KPrefsWidRadios *syncPrefsGroup = + addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); + syncPrefsGroup->addRadio(i18n("English")); + syncPrefsGroup->addRadio(i18n("German")); + syncPrefsGroup->addRadio(i18n("French")); + syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); + if ( QApplication::desktop()->width() < 300 ) + ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); + topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); + ++iii; + + syncPrefsGroup = + addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); + if ( QApplication::desktop()->width() > 300 ) + syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); + syncPrefsGroup->addRadio(i18n("24:00")); + syncPrefsGroup->addRadio(i18n("12:00am")); + syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); + topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); + ++iii; + KPrefsWidBool *sb; + if ( QApplication::desktop()->width() < 300 ) { + sb = + addWidBool(i18n("Week starts on Sunday"), + &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); + ++iii; + sb = + addWidBool(i18n("Use short date in (WN/E) view"), + &(KOPrefs::instance()->mShortDateInViewer),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); + } + else { + QWidget * hb = new QWidget( topFrame ); + QHBoxLayout *hbLayout = new QHBoxLayout(hb); + sb = + addWidBool(i18n("Week starts on Sunday"), + &(KOPrefs::instance()->mWeekStartsOnSunday),hb); + hbLayout->addWidget(sb->checkBox() ); + sb = + addWidBool(i18n("Use short date in (WN/E) view"), + &(KOPrefs::instance()->mShortDateInViewer),hb); + hbLayout->addWidget(sb->checkBox() ); + topLayout->addMultiCellWidget(hb, iii,iii,0,1); + + } + //#ifndef DESKTOP_VERSION +#if 0 + ++iii; + sb = + addWidBool(i18n("Quick load/save (w/o Unicode)"), + &(KOPrefs::instance()->mUseQuicksave),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); +#endif +} +void KOPrefsDialog::showSyncPage() +{ + showPage ( 2 ) ; + +} +void KOPrefsDialog::setupSyncAlgTab() +{ +#if 0 + QLabel * lab; + QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); + mSetupSyncAlgTab = topFrame; + QGridLayout *topLayout = new QGridLayout(topFrame,6,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + int iii = 0; + + KPrefsWidBool *sb = + addWidBool(i18n("Ask for preferences before syncing"), + &(KOPrefs::instance()->mAskForPreferences),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); + + ++iii; + + KPrefsWidRadios *syncPrefsGroup = + addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), + topFrame); + syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); + syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); + syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); + syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); + syncPrefsGroup->addRadio(i18n("Force take local entry always")); + syncPrefsGroup->addRadio(i18n("Force take remote entry always")); + topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); + ++iii; + sb = + addWidBool(i18n("Show summary after syncing"), + &(KOPrefs::instance()->mShowSyncSummary),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); + + ++iii; +#endif + + + +} + + +void KOPrefsDialog::setupSyncTab() +{ +#if 0 + QLabel * lab; + QFrame *topFrame = addPage(i18n("Sync Network"),0,0); + QGridLayout *topLayout = new QGridLayout(topFrame,6,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); + int iii = 0; + topLayout->addMultiCellWidget(lab , iii,iii,0,1); + ++iii; + + mRemoteIPEdit = new QLineEdit(topFrame); + lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mRemoteIPEdit,iii,1); + ++iii; + mRemoteUser = new QLineEdit(topFrame); + lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mRemoteUser, iii,1); + ++iii; + + mRemoteFile = new QLineEdit(topFrame); + lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mRemoteFile,iii,1); + ++iii; + + mLocalTempFile = new QLineEdit(topFrame); + lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); + topLayout->addWidget(lab ,iii,0); + topLayout->addWidget(mLocalTempFile,iii,1); + ++iii; + + KPrefsWidBool *wb = + addWidBool(i18n("Write back synced file"), + &(KOPrefs::instance()->mWriteBackFile),topFrame); + topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); + ++iii; + wb = + addWidBool(i18n("Write back existing entries only"), + &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); + topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); + ++iii; + +#endif +} + +void KOPrefsDialog::setupMainTab() +{ + QFrame *topFrame = addPage(i18n("General"),0,0); + // DesktopIcon("identity",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,6,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + // KPrefsWidBool *emailControlCenter = +// addWidBool(i18n("&Use email settings from Control Center"), +// &(KOPrefs::instance()->mEmailControlCenter),topFrame); +// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); + // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), + // SLOT(toggleEmailSettings(bool))); + + mNameEdit = new QLineEdit(topFrame); + mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); + topLayout->addWidget(mNameLabel,0,0); + topLayout->addWidget(mNameEdit,0,1); + + mEmailEdit = new QLineEdit(topFrame); + mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); + topLayout->addWidget(mEmailLabel,1,0); + topLayout->addWidget(mEmailEdit,1,1); + KPrefsWidBool *wb; + QHBox *dummy; + if ( QApplication::desktop()->width() > 480 ) { + dummy = new QHBox(topFrame); + } else { + dummy = new QVBox(topFrame); + } + + topLayout->addMultiCellWidget(dummy, 2,2,0,1); + addWidBool(i18n("Full menu bar(nr)"), + &(KOPrefs::instance()->mShowFullMenu),dummy); + + + addWidBool(i18n("Mini icons in toolbar(nr)"), + &(KOPrefs::instance()->mToolBarMiniIcons),dummy); + + + dummy = new QHBox(topFrame); + new QLabel(i18n("Days in What's Next:"),dummy); + mWhatsNextSpin = new QSpinBox(1,14,1,dummy); + + topLayout->addMultiCellWidget(dummy,3,3,0,1); + + + + dummy = new QHBox(topFrame); + new QLabel(i18n("Days in Next-X-Days:"),dummy); + mNextXDaysSpin = new QSpinBox(2,14,1,dummy); + + topLayout->addMultiCellWidget(dummy,4,4,0,1); + + QHBox *prioBox = new QHBox(topFrame); + // intervalBox->setSpacing(spacingHint()); + topLayout->addMultiCellWidget(prioBox,5,5,0,1); + QString messa = i18n("Show topmost todo prios in What's Next:"); + + if ( QApplication::desktop()->width() < 300 ) + messa = i18n("Show topmost todo prios in What's N.:"); + QLabel *prioLabel = new QLabel(messa, prioBox); + mPrioSpin = new QSpinBox(0,5,1,prioBox); + if ( QApplication::desktop()->width() < 300 ) + mPrioSpin->setFixedWidth( 40 ); + + // KPrefsWidBool *bcc = +// addWidBool(i18n("Send copy to owner when mailing events"), +// &(KOPrefs::instance()->mBcc),topFrame); +// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); + + + // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); + //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); + + // addWidBool(i18n("Enable automatic saving of calendar"), + // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); + + QHBox *intervalBox = new QHBox(topFrame); + // intervalBox->setSpacing(spacingHint()); + topLayout->addMultiCellWidget(intervalBox,6,6,0,1); + QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); + mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); + autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); + /* + QHBox * agendasize = new QHBox ( topFrame ); + + new QLabel (i18n("AllDayAgenda Height:"), agendasize ); + + + mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); + topLayout->addMultiCellWidget(agendasize,7,7,0,1); + */ + KPrefsWidBool *verticalScreen = + addWidBool(i18n("Show vertical screen (Needs restart)"), + &(KOPrefs::instance()->mVerticalScreen),topFrame); + //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); + topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); + + KPrefsWidBool *ask = + addWidBool(i18n("Ask for quit when closing KO/Pi"), + &(KOPrefs::instance()->mAskForQuit),topFrame); + topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); + + + /* + KPrefsWidBool *confirmCheck = + addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), + topFrame); + topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); + + + mEnableGroupScheduling = + addWidBool(i18n("Enable group scheduling"), + &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); + topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); + connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), + SLOT(warningGroupScheduling())); + + mEnableProjectView = + addWidBool(i18n("Enable project view"), + &(KOPrefs::instance()->mEnableProjectView),topFrame); + topLayout->addWidget(mEnableProjectView->checkBox(),9,0); + connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), + SLOT(warningProjectView())); + + // Can't be disabled anymore + mEnableGroupScheduling->checkBox()->hide(); + + // Disable setting, because this feature now becomes stable + mEnableProjectView->checkBox()->hide(); + + KPrefsWidRadios *defaultFormatGroup = + addWidRadios(i18n("Default Calendar Format"), + &(KOPrefs::instance()->mDefaultFormat),topFrame); + defaultFormatGroup->addRadio(i18n("vCalendar")); + defaultFormatGroup->addRadio(i18n("iCalendar")); + + topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); + + // Default format unconditionally is iCalendar + defaultFormatGroup->groupBox()->hide(); + + KPrefsWidRadios *mailClientGroup = + addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), + topFrame); + mailClientGroup->addRadio(i18n("KMail")); + mailClientGroup->addRadio(i18n("Sendmail")); + topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); + + KPrefsWidBool *htmlsave = + addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), + topFrame); + topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); + + KPrefsWidRadios *destinationGroup = + addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), + topFrame); + destinationGroup->addRadio(i18n("be added to the standard resource")); + destinationGroup->addRadio(i18n("be asked which resource to use")); + topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); + + topLayout->setRowStretch(14,1); + */ +} + + +void KOPrefsDialog::setupTimeTab() +{ + QFrame *topFrame = addPage(i18n("Time"),0,0); + // DesktopIcon("clock",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,4,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + QHBox *dummy = new QHBox(topFrame); + KPrefsWidTime *dayBegins = + addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), + dummy); + //topLayout->addWidget(dayBegins->label(),2,0); + + //topLayout->addWidget(dayBegins->spinBox(),2,1); + topLayout->addMultiCellWidget(dummy,0,0,0,1); + + topLayout->addWidget(new QLabel(i18n("Default appointment time:"), + topFrame),1,0); + mStartTimeSpin = new QSpinBox(0,23,1,topFrame); + mStartTimeSpin->setSuffix(":00"); + topLayout->addWidget(mStartTimeSpin,1,1); + + topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), + topFrame),2,0); + mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); + mDefaultDurationSpin->setSuffix(":00"); + topLayout->addWidget(mDefaultDurationSpin,2,1); + + QStringList alarmList; + alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") + << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; + topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), + 3,0); + mAlarmTimeCombo = new QComboBox(topFrame); + mAlarmTimeCombo->insertStringList(alarmList); + topLayout->addWidget(mAlarmTimeCombo,3,1); + + + QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, + i18n("Working Hours"), + topFrame); + topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); + workingHoursGroup->layout()->setSpacing( 0 ); + workingHoursGroup->layout()->setMargin( 4 ); + QHBox *workStartBox = new QHBox(workingHoursGroup); + // workStartBox->setMargin( 0 ); + addWidTime(i18n("Daily starting hour:"), + &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); + + QHBox *workEndBox = new QHBox(workingHoursGroup); + //workEndBox->setMargin( 0 ); + addWidTime(i18n("Daily ending hour:"), + &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); + QVBox *excludeBox = new QVBox(workingHoursGroup); + //excludeBox->setMargin( 0 ); + addWidBool(i18n("Exclude holidays"), + &(KOPrefs::instance()->mExcludeHolidays),excludeBox); + + addWidBool(i18n("Exclude Saturdays"), + &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); + +// KPrefsWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), +// &(KOPrefs::instance()->mMarcusBainsShowSeconds), +// topFrame); +// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); + + // topLayout->setRowStretch(6,1); +} + + +void KOPrefsDialog::setupViewsTab() +{ + + QFrame *topFrame = addPage(i18n("Views"),0,0); + // DesktopIcon("viewmag",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,6,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + +// QBoxLayout *dayBeginsLayout = new QHBoxLayout; +// topLayout->addLayout(dayBeginsLayout,0,0); + +// KPrefsWidTime *dayBegins = +// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), +// topFrame); +// dayBeginsLayout->addWidget(dayBegins->label()); +// dayBeginsLayout->addStretch(1); +// dayBeginsLayout->addWidget(dayBegins->spinBox()); + +// QBoxLayout *nextDaysLayout = new QHBoxLayout; +// topLayout->addLayout(nextDaysLayout,1,0); +// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); +// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); +// nextDaysLayout->addStretch(1); +// nextDaysLayout->addWidget(mNextXDaysSpin); + + + int ii = 0; + KPrefsWidBool *dummy = + addWidBool(i18n("Edit item on doubleclick (if not, show)"), + &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Highlight current day in agenda"), + &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Use light color for highlight current day"), + &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + KPrefsWidBool *dailyRecur = + addWidBool(i18n("Show events that recur daily in date nav."), + &(KOPrefs::instance()->mDailyRecur),topFrame); + topLayout->addWidget(dailyRecur->checkBox(),ii++,0); + + KPrefsWidBool *weeklyRecur = + addWidBool(i18n("Show ev. that recur weekly in date nav."), + &(KOPrefs::instance()->mWeeklyRecur),topFrame); + topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); + if ( QApplication::desktop()->width() > 640 ) { + + KPrefsWidBool *enableToolTips = + addWidBool(i18n("Enable tooltips displaying summary of ev."), + &(KOPrefs::instance()->mEnableToolTips),topFrame); + topLayout->addWidget(enableToolTips->checkBox(),ii++,0); + + } + KPrefsWidBool *passwdk = + addWidBool(i18n("Show parent To-Do's in What's Next view"), + &(KOPrefs::instance()->mWNViewShowsParents),topFrame); + topLayout->addWidget(passwdk->checkBox(), ii++,0); + + passwdk = + addWidBool(i18n("Show location in What's Next view"), + &(KOPrefs::instance()->mWNViewShowLocation),topFrame); + topLayout->addWidget(passwdk->checkBox(), ii++,0); + + passwdk = + addWidBool(i18n("Show Sync Events in WN/Agenda view"), + &(KOPrefs::instance()->mShowSyncEvents),topFrame); + topLayout->addWidget(passwdk->checkBox(), ii++,0); + + + KPrefsWidBool *marcusBainsEnabled = + addWidBool(i18n("Show Marcus Bains line"), + &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); + topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); + + + // topLayout->addWidget(hourSizeGroup,ii++,0); + // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); + //topLayout->setRowStretch(11,1); + + + + + + + topFrame = addPage(i18n("ViewChange"),0,0); + // DesktopIcon("viewmag",KIcon::SizeMedium)); + + topLayout = new QGridLayout(topFrame,6,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + ii = 0; + + + dummy = + addWidBool(i18n("Hold fullscreen on view change"), + &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Hold non-fullscreen on view change"), + &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + + KPrefsWidBool *fullViewTodo = + addWidBool(i18n("Event list view uses full window"), + &(KOPrefs::instance()->mFullViewTodo),topFrame); + topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); + + KPrefsWidBool *fullViewMonth = + addWidBool(i18n("Next days view uses full window"), + &(KOPrefs::instance()->mFullViewMonth),topFrame); + topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Set agenda to DayBeginsAt on change"), + &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Set agenda to current time on change"), + &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Listview uses monthly timespan"), + &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + dummy = + addWidBool(i18n("Highlight selection in Time Edit"), + &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); + topLayout->addWidget( dummy->checkBox(), ii++,0); + + + + + + topFrame = addPage(i18n("Month View"),0,0); + // DesktopIcon("viewmag",KIcon::SizeMedium)); + + topLayout = new QGridLayout(topFrame,5,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + ii = 0; + QLabel *lab; + QHBox *habo = new QHBox( topFrame ); + if ( QApplication::desktop()->width() < 320 ) { + lab = new QLabel ( i18n("Show events that recur "), topFrame ); + topLayout->addMultiCellWidget(lab,ii, ii,0,1); + ii++; + + } else { + new QLabel ( i18n("Show events that recur "), habo ); + + } + dailyRecur = + addWidBool(i18n("daily"), + &(KOPrefs::instance()->mMonthDailyRecur),habo); + // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); + + weeklyRecur = + addWidBool(i18n("weekly"), + &(KOPrefs::instance()->mMonthWeeklyRecur),habo); + topLayout->addMultiCellWidget(habo,ii, ii,0,1); + ii++; + + + habo = new QHBox( topFrame ); + if ( QApplication::desktop()->width() < 320 ) { + lab = new QLabel (i18n("Show in every cell ") , topFrame ); + topLayout->addMultiCellWidget(lab,ii, ii,0,1); + ii++; + + } else { + new QLabel ( i18n("Show in every cell "), habo ); + } + weeklyRecur = + addWidBool(i18n("short month"), + &(KOPrefs::instance()->mMonthShowShort),habo); + weeklyRecur = + addWidBool(i18n("icons"), + &(KOPrefs::instance()->mMonthShowIcons),habo); + + topLayout->addMultiCellWidget(habo,ii, ii,0,1); + ii++; +#ifdef DESKTOP_VERSION + KPrefsWidBool *enableMonthScroll = + addWidBool(i18n("Enable scrollbars in month view cells"), + &(KOPrefs::instance()->mEnableMonthScroll),topFrame); + topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); +#endif + + dummy = + addWidBool(i18n("Show Sat/Sun together"), + &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + KPrefsWidBool *coloredCategoriesInMonthView = + addWidBool(i18n("Month view uses category colors"), + &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); + topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Categorie colors are applied to text"), + &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + coloredCategoriesInMonthView = + addWidBool(i18n("Month view uses day colors"), + &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); + topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); + + KPrefsWidColor *holidayColor = + addWidColor(i18n("Day color odd months"), + &(KOPrefs::instance()->mMonthViewOddColor),topFrame); + topLayout->addWidget(holidayColor->label(),ii,0); + topLayout->addWidget(holidayColor->button(),ii++,1); + + holidayColor = + addWidColor(i18n("Day color even months"), + &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); + topLayout->addWidget(holidayColor->label(),ii,0); + topLayout->addWidget(holidayColor->button(),ii++,1); + + + holidayColor = + addWidColor(i18n("Color for Sundays + category \"Holiday\""), + &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); + topLayout->addWidget(holidayColor->label(),ii,0); + topLayout->addWidget(holidayColor->button(),ii++,1); + + // *********************** Todo View + + topFrame = addPage(i18n("Todo View"),0,0); + // DesktopIcon("viewmag",KIcon::SizeMedium)); + + topLayout = new QGridLayout(topFrame,4,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + ii = 0; + + KPrefsWidBool *showCompletedTodo = + addWidBool(i18n("To-do view shows completed Todos"), + &(KOPrefs::instance()->mShowCompletedTodo),topFrame); + topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); + dummy = + addWidBool(i18n("To-do view shows complete as 'xx %'"), + &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Small To-do view uses smaller font"), + &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + + + dummy = + addWidBool(i18n("Todo view uses category colors"), + &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + + QWidget* wid = new QWidget( topFrame ); + // Todo due today color + KPrefsWidColor *todoDueTodayColor = + addWidColor(i18n("Todo due today color:"), + &(KOPrefs::instance()->mTodoDueTodayColor),wid); + QHBoxLayout *widLayout = new QHBoxLayout(wid); + widLayout->addWidget( todoDueTodayColor->label() ); + widLayout->addWidget( todoDueTodayColor->button() ); + topLayout->addWidget(wid,ii++,0); + //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); + + // Todo overdue color + wid = new QWidget( topFrame ); + widLayout = new QHBoxLayout(wid); + KPrefsWidColor *todoOverdueColor = + addWidColor(i18n("Todo overdue color:"), + &(KOPrefs::instance()->mTodoOverdueColor),wid); + widLayout->addWidget(todoOverdueColor->label()); + widLayout->addWidget(todoOverdueColor->button()); + topLayout->addWidget(wid,ii++,0); + + dummy = + addWidBool(i18n("Colors are applied to text"), + &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + dummy = + addWidBool(i18n("Allday Agenda view shows todos"), + &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); + topLayout->addWidget(dummy->checkBox(),ii++,0); + + + + + topFrame = addPage(i18n("Alarm"),0,0); + // DesktopIcon("viewmag",KIcon::SizeMedium)); + + topLayout = new QGridLayout(topFrame,2,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + int iii = 0; + + dummy = + addWidBool(i18n("Use internal alarm notification"), + &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); + topLayout->addWidget(dummy->checkBox(),iii++,0); + 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); + + topLayout->addWidget(lab ,iii++,0); +#ifndef DESKTOP_VERSION + lab->setAlignment( AlignLeft|WordBreak|AlignTop); +#else + lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); + lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); +#endif + + QHBox* dummyBox = new QHBox(topFrame); + new QLabel(i18n("Play beeps count:"),dummyBox); + mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); + topLayout->addWidget(dummyBox,iii++,0); + + dummyBox = new QHBox(topFrame); + new QLabel(i18n("Beeps interval in sec:"),dummyBox); + mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); + topLayout->addWidget(dummyBox,iii++,0); + + dummyBox = new QHBox(topFrame); + new QLabel(i18n("Default suspend time in min:"),dummyBox); + mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); + topLayout->addWidget(dummyBox,iii++,0); + + dummyBox = new QHBox(topFrame); + new QLabel(i18n("Auto suspend count:"),dummyBox); + mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); + topLayout->addWidget(dummyBox,iii++,0); + + + + + + + + QHBox* hbo = new QHBox ( topFrame ); + mDefaultAlarmFile = new QLineEdit(hbo); + QPushButton * loadTemplate = new QPushButton(hbo); + QPixmap icon; + if ( QApplication::desktop()->width() < 321 ) + icon = SmallIcon("fileimport16"); + else + icon = SmallIcon("fileimport"); + loadTemplate->setIconSet (icon ) ; + connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); + int size = loadTemplate->sizeHint().height(); + loadTemplate->setFixedSize( size, size ); + //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); + // topLayout->addWidget(lab ,iii++,0); + lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); + topLayout->addWidget(lab ,iii++,0); + topLayout->addWidget(hbo,iii++,0); + // 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); + +// topLayout->addWidget(lab ,iii++,0); +// #ifndef DESKTOP_VERSION +// lab->setAlignment( AlignLeft|WordBreak|AlignTop); +// #else +// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); +// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); +// #endif + + +} + +void KOPrefsDialog::selectSoundFile() +{ + QString fileName = mDefaultAlarmFile->text(); + fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); + if ( fileName.length() > 0 ) + mDefaultAlarmFile->setText( fileName ); +} +void KOPrefsDialog::setupFontsTab() +{ + + QFrame *topFrame = addPage(i18n("Fonts"),0,0); + // DesktopIcon("fonts",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,7,3); + topLayout->setSpacing(1); + topLayout->setMargin(3); + KPrefsWidFont * tVFont; + int i = 0; + KPrefsWidFont *timeLabelsFont = + addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), + &(KOPrefs::instance()->mDateNavigatorFont),topFrame); + topLayout->addWidget(timeLabelsFont->label(),i,0); + topLayout->addWidget(timeLabelsFont->preview(),i,1); + topLayout->addWidget(timeLabelsFont->button(),i,2); + ++i; + + + timeLabelsFont = + addWidFont(i18n("Mon 15"),i18n("Date Labels:"), + &(KOPrefs::instance()->mTimeLabelsFont),topFrame); + topLayout->addWidget(timeLabelsFont->label(),i,0); + topLayout->addWidget(timeLabelsFont->preview(),i,1); + topLayout->addWidget(timeLabelsFont->button(),i,2); + ++i; + + KPrefsWidFont *timeBarFont = + addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), + &(KOPrefs::instance()->mTimeBarFont),topFrame); + topLayout->addWidget(timeBarFont->label(),i,0); + topLayout->addWidget(timeBarFont->preview(),i,1); + topLayout->addWidget(timeBarFont->button(),i,2); + ++i; + + + KPrefsWidFont *marcusBainsFont = + addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), + &(KOPrefs::instance()->mMarcusBainsFont),topFrame); + topLayout->addWidget(marcusBainsFont->label(),i,0); + topLayout->addWidget(marcusBainsFont->preview(),i,1); + topLayout->addWidget(marcusBainsFont->button(),i,2); + ++i; + + tVFont = + addWidFont(i18n("Summary"),i18n("Event Viewer:"), + &(KOPrefs::instance()->mEventViewFont),topFrame); + topLayout->addWidget(tVFont->label(),i,0); + topLayout->addWidget(tVFont->preview(),i,1); + topLayout->addWidget(tVFont->button(),i,2); + ++i; + + + + tVFont = + addWidFont(i18n("Details"),i18n("EditorBox:"), + &(KOPrefs::instance()->mEditBoxFont),topFrame); + topLayout->addWidget(tVFont->label(),i,0); + topLayout->addWidget(tVFont->preview(),i,1); + topLayout->addWidget(tVFont->button(),i,2); + ++i; + + + + topLayout->setColStretch(1,1); + topLayout->setRowStretch(4,1); + + + i = 0; + topFrame = addPage(i18n("View Fonts"),0, + DesktopIcon("fonts",KIcon::SizeMedium)); + + topLayout = new QGridLayout(topFrame,7,3); + topLayout->setSpacing(1); + topLayout->setMargin(3); + + tVFont = + addWidFont(i18n("Configure KO"),i18n("What's Next View:"), + &(KOPrefs::instance()->mWhatsNextFont),topFrame); + topLayout->addWidget(tVFont->label(),i,0); + topLayout->addWidget(tVFont->preview(),i,1); + topLayout->addWidget(tVFont->button(),i,2); + ++i; + KPrefsWidFont *agendaViewFont = + addWidFont(i18n("Event text"),i18n("Agenda view:"), + &(KOPrefs::instance()->mAgendaViewFont),topFrame); + topLayout->addWidget(agendaViewFont->label(),i,0); + topLayout->addWidget(agendaViewFont->preview(),i,1); + topLayout->addWidget(agendaViewFont->button(),i,2); + ++i; + + + KPrefsWidFont *monthViewFont = + addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), + i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); + topLayout->addWidget(monthViewFont->label(),i,0); + topLayout->addWidget(monthViewFont->preview(),i,1); + topLayout->addWidget(monthViewFont->button(),i,2); + ++i; + + + KPrefsWidFont *lVFont = + addWidFont(i18n("Event"),i18n("List View:"), + &(KOPrefs::instance()->mListViewFont),topFrame); + topLayout->addWidget(lVFont->label(),i,0); + topLayout->addWidget(lVFont->preview(),i,1); + topLayout->addWidget(lVFont->button(),i,2); + ++i; + + + tVFont = + addWidFont(i18n("ToDo"),i18n("ToDoView:"), + &(KOPrefs::instance()->mTodoViewFont),topFrame); + topLayout->addWidget(tVFont->label(),i,0); + topLayout->addWidget(tVFont->preview(),i,1); + topLayout->addWidget(tVFont->button(),i,2); + ++i; + + + tVFont = + addWidFont(i18n("Today"),i18n("JournalView:"), + &(KOPrefs::instance()->mJornalViewFont),topFrame); + topLayout->addWidget(tVFont->label(),i,0); + topLayout->addWidget(tVFont->preview(),i,1); + topLayout->addWidget(tVFont->button(),i,2); + ++i; + + + + + topLayout->setColStretch(1,1); + topLayout->setRowStretch(4,1); + + + + +} + +void KOPrefsDialog::setupColorsTab() +{ + QFrame *topFrame = addPage(i18n("Colors"),0,0); + // DesktopIcon("colorize",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,5,2); + // topLayout->setSpacing(spacingHint()); + // topLayout->setMargin(marginHint()); + + topLayout->setSpacing(2); + topLayout->setMargin(3); + + int ii = 1; + QGroupBox *categoryGroup ; + + categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), + topFrame); + topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); + + mCategoryCombo = new QComboBox(categoryGroup); + mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); + connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); + + mCategoryButton = new KColorButton(categoryGroup); + connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); + updateCategoryColor(); + + + // Holiday Color + + KPrefsWidColor *holidayColor = + addWidColor(i18n("Holiday color:"), + &(KOPrefs::instance()->mHolidayColor),topFrame); + topLayout->addWidget(holidayColor->label(),ii,0); + topLayout->addWidget(holidayColor->button(),ii++,1); + + // Highlight Color + KPrefsWidColor *highlightColor = + addWidColor(i18n("Highlight color:"), + &(KOPrefs::instance()->mHighlightColor),topFrame); + topLayout->addWidget(highlightColor->label(),ii,0); + topLayout->addWidget(highlightColor->button(),ii++,1); + + // Event color + KPrefsWidColor *eventColor = + addWidColor(i18n("Default event color:"), + &(KOPrefs::instance()->mEventColor),topFrame); + topLayout->addWidget(eventColor->label(),ii,0); + topLayout->addWidget(eventColor->button(),ii++,1); + + // agenda view background color + KPrefsWidColor *agendaBgColor = + addWidColor(i18n("Agenda view background color:"), + &(KOPrefs::instance()->mAgendaBgColor),topFrame); + topLayout->addWidget(agendaBgColor->label(),ii,0); + topLayout->addWidget(agendaBgColor->button(),ii++,1); + + // working hours color + KPrefsWidColor *workingHoursColor = + addWidColor(i18n("Working hours color:"), + &(KOPrefs::instance()->mWorkingHoursColor),topFrame); + topLayout->addWidget(workingHoursColor->label(),ii,0); + topLayout->addWidget(workingHoursColor->button(),ii++,1); + + KPrefsWidBool *sb = + addWidBool(i18n("Use colors for application:"), + &(KOPrefs::instance()->mUseAppColors),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); + + ii++; + KPrefsWidColor * workingHoursColor1 = + addWidColor(i18n("Buttons, menus, etc.:"), + &(KOPrefs::instance()->mAppColor1),topFrame); + topLayout->addWidget(workingHoursColor1->label(),ii,0); + topLayout->addWidget(workingHoursColor1->button(),ii++,1); + + KPrefsWidColor * workingHoursColor2 = + addWidColor(i18n("Frames, labels, etc.:"), + &(KOPrefs::instance()->mAppColor2),topFrame); + topLayout->addWidget(workingHoursColor2->label(),ii,0); + topLayout->addWidget(workingHoursColor2->button(),ii++,1); + + + +} + +void KOPrefsDialog::setCategoryColor() +{ + mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); +} + +void KOPrefsDialog::updateCategoryColor() +{ + QString cat = mCategoryCombo->currentText(); + QColor *color = mCategoryDict.find(cat); + if (!color) { + color = KOPrefs::instance()->categoryColor(cat); + } + if (color) { + mCategoryButton->setColor(*color); + } +} + +void KOPrefsDialog::setupPrinterTab() +{ + mPrinterTab = addPage(i18n("Printing"),0, + DesktopIcon("fileprint",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + topLayout->setRowStretch(4,1); +} + +void KOPrefsDialog::setupGroupSchedulingTab() +{ +#if 0 + QFrame *topFrame = addPage(i18n("Group Scheduling"),0, + DesktopIcon("personal",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,6,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + +#if 0 + KPrefsWidRadios *schedulerGroup = + addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), + topFrame); + schedulerGroup->addRadio("Dummy"); // Only for debugging + schedulerGroup->addRadio(i18n("Mail client")); + + topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); +#endif + + KPrefsWidRadios *sendGroup = + addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), + topFrame); + sendGroup->addRadio(i18n("Send to outbox")); + sendGroup->addRadio(i18n("Send directly")); + + topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); + + topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); + mAMails = new QListView(topFrame); + mAMails->addColumn(i18n("Email"),300); + topLayout->addMultiCellWidget(mAMails,3,3,0,1); + + topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); + aEmailsEdit = new QLineEdit(topFrame); + aEmailsEdit->setEnabled(false); + topLayout->addWidget(aEmailsEdit,4,1); + + QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); + topLayout->addWidget(add,5,0); + QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); + topLayout->addWidget(del,5,1); + + //topLayout->setRowStretch(2,1); + connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); + connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); + connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); + connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); +#endif +} + +void KOPrefsDialog::setupGroupAutomationTab() +{ + return; + QFrame *topFrame = addPage(i18n("Group Automation"),0, + DesktopIcon("personal",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,5,1); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + KPrefsWidRadios *autoRefreshGroup = + addWidRadios(i18n("Auto Send Refresh"), + &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); + autoRefreshGroup->addRadio(i18n("Never")); + autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); + //autoRefreshGroup->addRadio(i18n("selected emails")); + topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); + + KPrefsWidRadios *autoInsertGroup = + addWidRadios(i18n("Auto Insert IMIP Replies"), + &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); + autoInsertGroup->addRadio(i18n("Never")); + autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); + //autoInsertGroup->addRadio(i18n("selected emails")); + topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); + + KPrefsWidRadios *autoRequestGroup = + addWidRadios(i18n("Auto Insert IMIP Requests"), + &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); + autoRequestGroup->addRadio(i18n("Never")); + autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); + //autoInsertGroup->addRadio(i18n("selected emails")); + topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); + + KPrefsWidRadios *autoFreeBusyGroup = + addWidRadios(i18n("Auto Send FreeBusy Information"), + &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); + autoFreeBusyGroup->addRadio(i18n("Never")); + autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); + //autoFreeBusyGroup->addRadio(i18n("selected emails")); + topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); + + KPrefsWidRadios *autoFreeBusyReplyGroup = + addWidRadios(i18n("Auto Save FreeBusy Replies"), + &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); + autoFreeBusyReplyGroup->addRadio(i18n("Never")); + autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); + //autoFreeBusyGroup->addRadio(i18n("selected emails")); + topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); +} + +void KOPrefsDialog::showPrinterTab() +{ + showPage(pageIndex(mPrinterTab)); +} + + +void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, + const QStringList *tags) +{ + if (tags) { + int i = tags->findIndex(text); + if (i > 0) combo->setCurrentItem(i); + } else { + for(int i=0;i<combo->count();++i) { + if (combo->text(i) == text) { + combo->setCurrentItem(i); + break; + } + } + } +} + +void KOPrefsDialog::usrReadConfig() +{ + mNameEdit->setText(KOPrefs::instance()->fullName()); + mEmailEdit->setText(KOPrefs::instance()->email()); + + mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); + QDate current ( 2001, 1,1); + mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); + mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); + setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); + //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); + mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); + mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); + mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); + // if (KOPrefs::instance()->mAllDaySize > 47 ) + // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; + //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); + + mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); + mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); + mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); + // mAMails->clear(); + // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); +// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { +// QListViewItem *item = new QListViewItem(mAMails); +// item->setText(0,*it); +// mAMails->insertItem(item); +// } + + // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); + //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); + //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); + //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); + + //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); + mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); + QString dummy = KOPrefs::instance()->mUserDateFormatLong; + mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); + dummy = KOPrefs::instance()->mUserDateFormatShort; + mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); + updateCategories(); + mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); + mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); + mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); + mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); +} + + +void KOPrefsDialog::usrWriteConfig() +{ + + // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); + //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); + //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); + //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); + //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); + KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); + + KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); + KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); + KOPrefs::instance()->setFullName(mNameEdit->text()); + KOPrefs::instance()->setEmail(mEmailEdit->text()); + + KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); + + KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); + QDate date; + date = mStartDateSavingEdit->date(); + int sub = 0; + if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) + sub = 1; + KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; + date = mEndDateSavingEdit->date(); + if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) + sub = 1; + else + sub = 0; + KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; + // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); + + KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); + KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); + KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); + + //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); + + QDictIterator<QColor> it(mCategoryDict); + while (it.current()) { + KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); + ++it; + } + + KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); + KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); + KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); + + KOPrefs::instance()->mAdditionalMails.clear(); + // QListViewItem *item; + // item = mAMails->firstChild(); + // while (item) + // { + // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); + // item = item->nextSibling(); + // } + KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); + KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; + KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; + KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; + +} + +void KOPrefsDialog::updateCategories() +{ + mCategoryCombo->clear(); + mCategoryDict.clear(); + mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); + updateCategoryColor(); +} + +void KOPrefsDialog::warningGroupScheduling() +{ + warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); +} + +void KOPrefsDialog::warningProjectView() +{ + warningExperimental(mEnableProjectView->checkBox()->isChecked()); +} + +void KOPrefsDialog::warningExperimental(bool on) +{ + if (on) { + KMessageBox::information(this,i18n("This is an experimental feature. " + "It may not work, it may do nothing useful and it may cause data loss. " + "Use with care.\n" + "You have to restart KOrganizer for this setting to take effect.")); + } else { + KMessageBox::information(this, + i18n("You have to restart KOrganizer for this setting to take effect.")); + } +} + +void KOPrefsDialog::toggleEmailSettings(bool on) +{ + if (on) { + mEmailEdit->setEnabled(false); + mNameEdit->setEnabled(false); + mEmailLabel->setEnabled(false); + mNameLabel->setEnabled(false); + + KEMailSettings settings; + mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); + mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); + } else { + mEmailEdit->setEnabled(true); + mNameEdit->setEnabled(true); + mEmailLabel->setEnabled(true); + mNameLabel->setEnabled(true); + } +} + +void KOPrefsDialog::addItem() +{ + // aEmailsEdit->setEnabled(true); +// QListViewItem *item = new QListViewItem(mAMails); +// mAMails->insertItem(item); +// mAMails->setSelected(item,true); +// aEmailsEdit->setText(i18n("(EmptyEmail)")); +} + +void KOPrefsDialog::removeItem() +{ +// QListViewItem *item; +// item = mAMails->selectedItem(); +// if (!item) return; +// mAMails->takeItem(item); +// item = mAMails->selectedItem(); +// if (!item) { +// aEmailsEdit->setText(""); +// aEmailsEdit->setEnabled(false); +// } +// if (mAMails->childCount() == 0) { +// aEmailsEdit->setEnabled(false); +// } +} + +void KOPrefsDialog::updateItem() +{ + // QListViewItem *item; +// item = mAMails->selectedItem(); +// if (!item) return; +// item->setText(0,aEmailsEdit->text()); +} + +void KOPrefsDialog::updateInput() +{ +// QListViewItem *item; +// item = mAMails->selectedItem(); +// if (!item) return; +// aEmailsEdit->setEnabled(true); +// aEmailsEdit->setText(item->text(0)); +} +void KOPrefsDialog::updateTimezoneOffset( int index ) +{ + /* + qDebug("updateTimezoneOffset %d ", index); + if ( index < 24 ) { + mTimezoneOffsetSpin->setEnabled ( false ); + mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); + + + } else { + if ( index == 24 ) { + mTimezoneOffsetSpin->setEnabled ( true ); + mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); + + } else { + mTimezoneOffsetSpin->setEnabled ( false ); + mTimezoneOffsetSpin->setValue( 0 ); + } + } + */ +} + +void KOPrefsDialog::setupTimeZoneTab() +{ + QFrame *topFrame = addPage(i18n("Time Zone"),0,0); + // DesktopIcon("clock",KIcon::SizeMedium)); + + QGridLayout *topLayout = new QGridLayout(topFrame,5,2); + topLayout->setSpacing(spacingHint()); + topLayout->setMargin(marginHint()); + + QHBox *timeZoneBox = new QHBox( topFrame ); + topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); + + new QLabel( i18n("Timezone:"), timeZoneBox ); + mTimeZoneCombo = new QComboBox( timeZoneBox ); + if ( QApplication::desktop()->width() < 300 ) { + mTimeZoneCombo->setMaximumWidth(150); + } + + QStringList list; + list = KGlobal::locale()->timeZoneList(); + mTimeZoneCombo->insertStringList(list); + + // find the currently set time zone and select it + QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; + int nCurrentlySet = 11; + for (int i = 0; i < mTimeZoneCombo->count(); i++) + { + if (mTimeZoneCombo->text(i) == sCurrentlySet) + { + nCurrentlySet = i; + break; + } + } + mTimeZoneCombo->setCurrentItem(nCurrentlySet); + int iii = 1; + KPrefsWidBool *sb = + addWidBool(i18n("Timezone has daylight saving"), + &(KOPrefs::instance()->mUseDaylightsaving),topFrame); + topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); + ++iii; + QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); + topLayout->addMultiCellWidget(lab, iii,iii,0,1); + ++iii; + lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); + topLayout->addMultiCellWidget(lab, iii,iii,0,1); + ++iii; + lab = new QLabel( i18n("Daylight start:"), topFrame ); + topLayout->addWidget(lab, iii,0); + mStartDateSavingEdit = new KDateEdit(topFrame); + topLayout->addWidget(mStartDateSavingEdit, iii,1); + ++iii; + + lab = new QLabel( i18n("Daylight end:"), topFrame ); + topLayout->addWidget(lab, iii,0); + mEndDateSavingEdit = new KDateEdit(topFrame); + topLayout->addWidget(mEndDateSavingEdit, iii,1); + ++iii; + QDate current ( 2001, 1,1); + mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); + mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); + + +} + 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 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ +#ifndef _KOPREFSDIALOG_H +#define _KOPREFSDIALOG_H + +#include <qframe.h> +#include <qdict.h> +#include <qcolor.h> +#include <qlistview.h> + +#include <kdialogbase.h> + +#include <libkdepim/kprefsdialog.h> +#include <libkdepim/kdateedit.h> + +class KColorButton; +class QSpinBox; +class QSlider; +class KURLRequester; +class QComboBox; +class QLineEdit; +class QStringList; + +/** Dialog to change the korganizer configuration. + */ +class KOPrefsDialog : public KPrefsDialog +{ + Q_OBJECT + public: + /** Initialize dialog and pages */ + KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); + ~KOPrefsDialog(); + +protected: + void usrReadConfig(); + void usrWriteConfig(); + + void setupMainTab(); + void setupMailTab(); + void setupFontsTab(); + private: + QLineEdit *mNameEdit; + QLineEdit *mEmailEdit; + QLabel *mNameLabel; + QLabel *mEmailLabel; +#if 0 + /* + public slots: + void showPrinterTab(); + + + void updateCategories(); + void showSyncPage(); + protected slots: + void selectSoundFile(); + void setCategoryColor(); + void updateCategoryColor(); + void updateTimezoneOffset( int ); + + + void warningExperimental(bool on); + void warningGroupScheduling(); + void warningProjectView(); + + void toggleEmailSettings(bool); + + //additional emails + void addItem(); + void removeItem(); + void updateItem(); + void updateInput(); +*/ + protected: + void usrReadConfig(); + void usrWriteConfig(); + + void setupMainTab(); + void setupTimeTab(); + void setupTimeZoneTab(); + void setupLocaleTab(); + void setupLocaleDateTab(); + void setupFontsTab(); + void setupColorsTab(); + void setupViewsTab(); + void setupDisplayTab(); + void setupPrinterTab(); + void setupGroupSchedulingTab(); + void setupGroupAutomationTab(); + void setupSyncTab(); + void setupSyncAlgTab(); + + void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); + + + private: + KPrefsWidBool *mEnableGroupScheduling; + KPrefsWidBool *mEnableProjectView; + + QFrame *mPrinterTab; + + QLineEdit *nameEdit; + QLineEdit *emailEdit; + + QComboBox *timeCombo; + QComboBox *tzCombo; + + // widgets holding preferences data + QLineEdit *mNameEdit; + QLineEdit *mEmailEdit; + QLabel *mNameLabel; + QLabel *mEmailLabel; + QLineEdit *mAdditionalEdit; + QSpinBox *mAutoSaveIntervalSpin; + QSpinBox *mPrioSpin; + // QListView *mAMails; + QLineEdit *aEmailsEdit; + + QComboBox *mTimeZoneCombo; + QStringList tzonenames; + QSpinBox *mStartTimeSpin; + QSpinBox *mDefaultDurationSpin; + QComboBox *mAlarmTimeCombo; + + QComboBox *mCategoryCombo; + KColorButton *mCategoryButton; + QDict<QColor> mCategoryDict; + + QSlider *mHourSizeSlider; + + QSpinBox *mNextXDaysSpin; + QSpinBox *mWhatsNextSpin; + + QLineEdit * mRemoteIPEdit; + QLineEdit * mRemoteUser; + QLineEdit * mRemotePassWd; + QLineEdit * mRemoteFile; + QLineEdit * mLocalTempFile; + QWidget* mSetupSyncAlgTab; + QLineEdit * mUserDateFormatLong; + QLineEdit * mUserDateFormatShort; + + QSpinBox *mTimezoneOffsetSpin; + QSpinBox *mDaylightsavingStart; + QSpinBox *mDaylightsavingEnd; + KDateEdit* mStartDateSavingEdit; + KDateEdit* mEndDateSavingEdit; + QSpinBox * mAlarmPlayBeeps; + QSpinBox * mAlarmSuspendTime; + QSpinBox * mAlarmSuspendCount; + QSpinBox * mAlarmBeepInterval; + + QLineEdit * mDefaultAlarmFile; +#endif +}; + +#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 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ +#ifndef _KOPREFSDIALOG_H +#define _KOPREFSDIALOG_H + +#include <qframe.h> +#include <qdict.h> +#include <qcolor.h> +#include <qlistview.h> + +#include <kdialogbase.h> + +#include <libkdepim/kprefsdialog.h> +#include <libkdepim/kdateedit.h> + +class KColorButton; +class QSpinBox; +class QSlider; +class KURLRequester; +class QComboBox; +class QLineEdit; +class QStringList; + +/** Dialog to change the korganizer configuration. + */ +class KOPrefsDialog : public KPrefsDialog +{ + Q_OBJECT + public: + /** Initialize dialog and pages */ + KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); + ~KOPrefsDialog(); + + public slots: + void showPrinterTab(); + + /** Update controls for categories */ + void updateCategories(); + void showSyncPage(); + protected slots: + void selectSoundFile(); + void setCategoryColor(); + void updateCategoryColor(); + void updateTimezoneOffset( int ); + + + void warningExperimental(bool on); + void warningGroupScheduling(); + void warningProjectView(); + + void toggleEmailSettings(bool); + + //additional emails + void addItem(); + void removeItem(); + void updateItem(); + void updateInput(); + + protected: + void usrReadConfig(); + void usrWriteConfig(); + + void setupMainTab(); + void setupTimeTab(); + void setupTimeZoneTab(); + void setupLocaleTab(); + void setupLocaleDateTab(); + void setupFontsTab(); + void setupColorsTab(); + void setupViewsTab(); + void setupDisplayTab(); + void setupPrinterTab(); + void setupGroupSchedulingTab(); + void setupGroupAutomationTab(); + void setupSyncTab(); + void setupSyncAlgTab(); + + void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); + + + private: + KPrefsWidBool *mEnableGroupScheduling; + KPrefsWidBool *mEnableProjectView; + + QFrame *mPrinterTab; + + QLineEdit *nameEdit; + QLineEdit *emailEdit; + + QComboBox *timeCombo; + QComboBox *tzCombo; + + // widgets holding preferences data + QLineEdit *mNameEdit; + QLineEdit *mEmailEdit; + QLabel *mNameLabel; + QLabel *mEmailLabel; + QLineEdit *mAdditionalEdit; + QSpinBox *mAutoSaveIntervalSpin; + QSpinBox *mPrioSpin; + // QListView *mAMails; + QLineEdit *aEmailsEdit; + + QComboBox *mTimeZoneCombo; + QStringList tzonenames; + QSpinBox *mStartTimeSpin; + QSpinBox *mDefaultDurationSpin; + QComboBox *mAlarmTimeCombo; + + QComboBox *mCategoryCombo; + KColorButton *mCategoryButton; + QDict<QColor> mCategoryDict; + + QSlider *mHourSizeSlider; + + QSpinBox *mNextXDaysSpin; + QSpinBox *mWhatsNextSpin; + + QLineEdit * mRemoteIPEdit; + QLineEdit * mRemoteUser; + QLineEdit * mRemotePassWd; + QLineEdit * mRemoteFile; + QLineEdit * mLocalTempFile; + QWidget* mSetupSyncAlgTab; + QLineEdit * mUserDateFormatLong; + QLineEdit * mUserDateFormatShort; + + QSpinBox *mTimezoneOffsetSpin; + QSpinBox *mDaylightsavingStart; + QSpinBox *mDaylightsavingEnd; + KDateEdit* mStartDateSavingEdit; + KDateEdit* mEndDateSavingEdit; + QSpinBox * mAlarmPlayBeeps; + QSpinBox * mAlarmSuspendTime; + QSpinBox * mAlarmSuspendCount; + QSpinBox * mAlarmBeepInterval; + + QLineEdit * mDefaultAlarmFile; +}; + +#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 @@ // CHANGED 2004-08-06 Lutz Rogowski #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #include <libkdepim/externalapphandler.h> #include <stdlib.h> #else #include <qapplication.h> #include <qstring.h> #include <qwindowsstyle.h> #include <qplatinumstyle.h> #include <qsgistyle.h> #endif #include "opiemail.h" #include <qdir.h> #include <kstandarddirs.h> #include <kglobal.h> #include <stdio.h> #include "mainwindow.h" +#include "koprefs.h" //using namespace Opie::Core; int main( int argc, char **argv ) { #ifndef DESKTOP_VERSION QPEApplication a( argc, argv ); a.setKeepRunning (); #else QApplication a( argc, argv ); QApplication::setStyle( new QPlatinumStyle ()); #endif - + a.setFont( KOPrefs::instance()->mAppFont ); KGlobal::setAppName( "kopiemail" ); QString fileName ; #ifndef DESKTOP_VERSION fileName = getenv("QPEDIR"); if ( QApplication::desktop()->width() > 320 ) KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); else KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); #else fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/"; KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); #endif KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); OpieMail mw; #ifndef DESKTOP_VERSION //qDebug("CONNECT "); QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); a.showMainWidget(&mw ); #else a.setMainWidget(&mw ); mw.show(); //m.resize( 800, 600 ); QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); #endif int rv = a.exec(); return rv; } diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 19ffdb3..4e7c6be 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -1,297 +1,305 @@ // CHANGED 2004-09-31 Lutz Rogowski // CHANGED 2004-08-06 Lutz Rogowski #include "settingsdialog.h" #include "opiemail.h" #include "editaccounts.h" #include "composemail.h" #include "mailistviewitem.h" #include "viewmail.h" #include "selectstore.h" #include "selectsmtp.h" #include "accountitem.h" +#include "koprefsdialog.h" #include <qmessagebox.h> #include <qtimer.h> #include <libkdepim/externalapphandler.h> #include <qpe/qpeapplication.h> #include <libmailwrapper/smtpwrapper.h> #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> /* OPIE */ //#include <qpe/resource.h> //#include <qpe/qpeapplication.h> /* QT */ //using namespace Opie::Core; OpieMail::OpieMail( QWidget *parent, const char *name ) : MainWindow( parent, name) //, WStyle_ContextHelp ) { settings = new Settings(); folderView->populate( settings->getAccounts() ); } OpieMail::~OpieMail() { if (settings) delete settings; } void OpieMail::appMessage(const QCString &msg, const QByteArray &data) { } #include <stdlib.h> void OpieMail::message(const QCString &msg, const QByteArray &data) { // copied from old mail2 static int ii = 0; //qDebug("QCOP CALL ############################# %d ", ii); //QString mess ( msg ); //qDebug("Message = %s ",mess.latin1()); ++ii; //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); mPendingEmail = QString::null; mPendingName = QString::null; if (msg == "writeMail(QString,QString)") { //qDebug("writeMail(QString,QString) "); QDataStream stream(data,IO_ReadOnly); stream >> mPendingName >> mPendingEmail; // removing the whitespaces at beginning and end is needed! QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); } else if (msg == "newMail()") { //qDebug("slotComposeMail() "); // we cannot call slotComposeMail(); directly, because may be executing a QCOP call // and a QCOP call does not like a processevents in his execution // with the Qtimer we call slotComposeMail() after we reached the main event loop QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); // slotComposeMail(); } else if (msg == "newMail(QString)") { //qDebug(" newMail(QString)"); QDataStream stream(data,IO_ReadOnly); stream >> mPendingName; // the format is // NAME <EMAIL>:SUBJECT QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); } else { - if ( ii == 1 ) { - qDebug("Kopiemail::Error:: Initial QCOP call for ExternalAppHandler not supported "); - return; - } - ExternalAppHandler::instance()->appMessage ( msg, data); + mPendingData = data; + mPendingMessage = msg; + QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); } //qDebug("END OpieMail::message "); } +void OpieMail::slotExtAppHandler() +{ + ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); +} void OpieMail::slotwriteMail2(const QString& namemail ) { //qDebug("OpieMail::slotwriteMail2 "); //qApp->processEvents(); ComposeMail compose( settings, this, 0, true ); if ( !namemail.isEmpty() ) { QString to = namemail; if ( namemail.find( " <") > 1 ) { to = "\"" +to.replace( QRegExp( " <"), "\" <") ; } else if ( namemail.find( "<") > 1 ) { to = "\"" +to.replace( QRegExp( "<"), "\" <") ; } int sub = to.find( ">:"); if ( sub > 0 ) { compose.setTo( to.left(sub+1) ); compose.setSubject( to.mid(sub+2) ); } else compose.setTo( to ); } compose.slotAdjustColumns(); compose.showMaximized(); compose.exec(); raise(); //qDebug("retttich "); } void OpieMail::slotwriteMail(const QString&name,const QString&email) { // qDebug("OpieMail::slotwriteMail "); ComposeMail compose( settings, this, 0, true ); if (!email.isEmpty()) { if (!name.isEmpty()) { compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); } else { compose.setTo(email); } } compose.slotAdjustColumns(); compose.showMaximized(); compose.exec(); raise(); } void OpieMail::slotComposeMail() { if ( mPendingEmail == QString::null && mPendingName == QString::null) slotwriteMail2( QString () ); else { if ( mPendingEmail == QString::null ) slotwriteMail2( mPendingName ); else slotwriteMail( mPendingName, mPendingEmail ); } //slotwriteMail(0l,0l); } void OpieMail::slotSendQueued() { SMTPaccount *smtp = 0; QList<Account> list = settings->getAccounts(); QList<SMTPaccount> smtpList; smtpList.setAutoDelete(false); Account *it; for ( it = list.first(); it; it = list.next() ) { if ( it->getType() == MAILLIB::A_SMTP ) { smtp = static_cast<SMTPaccount *>(it); smtpList.append(smtp); } } if (smtpList.count()==0) { QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); return; } if (smtpList.count()==1) { smtp = smtpList.at(0); } else { smtp = 0; selectsmtp selsmtp; selsmtp.setSelectionlist(&smtpList); selsmtp.showMaximized(); if ( selsmtp.exec() == QDialog::Accepted ) { smtp = selsmtp.selected_smtp(); } } if (smtp) { SMTPwrapper * wrap = new SMTPwrapper(smtp); if ( wrap->flushOutbox() ) { QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); } delete wrap; } } void OpieMail::slotSearchMails() { qDebug("OpieMail::slotSearchMails():not implemented "); } void OpieMail::slotEditSettings() { +#if 0 SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); settingsDialog.showMaximized(); settingsDialog.exec(); +#endif + KOPrefsDialog settingsDialog( this, "koprefs", true ); + settingsDialog.showMaximized(); + settingsDialog.exec(); } void OpieMail::slotEditAccounts() { - EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); + EditAccounts eaDialog( settings, this, 0, true ); eaDialog.slotAdjustColumns(); eaDialog.showMaximized(); eaDialog.exec(); if ( settings ) delete settings; settings = new Settings(); folderView->populate( settings->getAccounts() ); } void OpieMail::displayMail() { QListViewItem*item = mailView->currentItem(); if (!item) return; RecMailP mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); - ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); + ViewMail readMail( this,"", Qt::WType_Modal ); readMail.setBody( body ); readMail.setMail( mail ); readMail.showMaximized(); readMail.exec(); if ( readMail.deleted ) { folderView->refreshCurrent(); } else { ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); } } void OpieMail::slotGetMail() { QListViewItem * item = folderView->currentItem(); if ( ! item ) return; while ( item->parent () ) item = item->parent (); ((AccountViewItem *)item)->contextMenuSelected( 101 ); } void OpieMail::slotDeleteMail() { if (!mailView->currentItem()) return; RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 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 ) { mail->Wrapper()->deleteMail( mail ); folderView->refreshCurrent(); } } void OpieMail::slotDeleteAllMail() { QValueList<RecMailP> t; if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); while ( item ) { if ( item->isSelected() ) { t.append( item->data() ); } item = (MailListViewItem*)item->nextSibling(); } } else return; if ( t.count() == 0 ) return; RecMailP mail = t.first(); mail->Wrapper()->deleteMailList(t); folderView->refreshCurrent(); } void OpieMail::clearSelection() { mailView->clearSelection(); } void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) { 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 @@ // CHANGED 2004-09-31 Lutz Rogowski #ifndef OPIEMAIL_H #define OPIEMAIL_H #include "mainwindow.h" #include <libmailwrapper/settings.h> #include <opie2/osmartpointer.h> #include <libmailwrapper/mailtypes.h> class OpieMail : public MainWindow { Q_OBJECT public: OpieMail( QWidget *parent = 0, const char *name = 0 ); virtual ~OpieMail(); static QString appName() { return QString::fromLatin1("kopiemail"); } public slots: virtual void slotwriteMail(const QString&name,const QString&email); virtual void slotwriteMail2(const QString&nameemail); virtual void slotComposeMail(); + virtual void slotExtAppHandler(); virtual void appMessage(const QCString &msg, const QByteArray &data); virtual void message(const QCString &msg, const QByteArray &data); protected slots: virtual void slotSendQueued(); virtual void slotSearchMails(); virtual void slotEditSettings(); virtual void slotEditAccounts(); virtual void displayMail(); virtual void slotDeleteMail(); virtual void slotGetMail(); virtual void slotDeleteAllMail(); virtual void mailHold(int, QListViewItem *,const QPoint&,int); virtual void slotShowFolders( bool show ); virtual void refreshMailView(const QValueList<RecMailP>&); virtual void mailLeftClicked( QListViewItem * ); virtual void slotMoveCopyMail(); virtual void slotMoveCopyAllMail(); virtual void reEditMail(); void clearSelection(); private: QString mPendingEmail; QString mPendingName; + QByteArray mPendingData; + QCString mPendingMessage; Settings *settings; }; #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 @@ #include <qcheckbox.h> #include <qspinbox.h> +#include <qlayout.h> +#include <qtabwidget.h> -#include <qpe/config.h> +#include <kconfig.h> +#include <kprefs.h> +#include <klocale.h> +#include <kglobal.h> +#include <kfontdialog.h> #include "settingsdialog.h" SettingsDialog::SettingsDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : SettingsDialogUI( parent, name, modal, fl ) { - readConfig(); +#if 0 + QTabWidget *topFrame = TabWidget2; + + QGridLayout *topLayout = new QGridLayout(topFrame,3,3); + topLayout->setSpacing(2); + topLayout->setMargin(3); + KPrefsWidFont * tVFont; + int i = 0; + KPrefsWidFont *timeLabelsFont = + addWidFont(i18n("OK"),i18n("Application(nr):"), + &(mAppFont),topFrame); + topLayout->addWidget(timeLabelsFont->label(),i,0); + topLayout->addWidget(timeLabelsFont->preview(),i,1); + topLayout->addWidget(timeLabelsFont->button(),i,2); + ++i; + + + timeLabelsFont = + addWidFont(i18n("Mon 15"),i18n("Compose Mail:"), + &(mComposeFont),topFrame); + topLayout->addWidget(timeLabelsFont->label(),i,0); + topLayout->addWidget(timeLabelsFont->preview(),i,1); + topLayout->addWidget(timeLabelsFont->button(),i,2); + ++i; + + KPrefsWidFont *timeBarFont = + addWidFont(i18n("Mon 15"),i18n("Read Mail:"), + &(mReadFont),topFrame); + topLayout->addWidget(timeBarFont->label(),i,0); + topLayout->addWidget(timeBarFont->preview(),i,1); + topLayout->addWidget(timeBarFont->button(),i,2); + ++i; + + readConfig(); +#endif } SettingsDialog::~SettingsDialog() { } void SettingsDialog::readConfig() { - Config cfg("mail"); + KConfig cfg = ( locateLocal("config","kopiemailrc" )); cfg.setGroup( "Settings" ); showHtmlButton->setChecked( cfg.readBoolEntry( "showHtml", false ) ); cfg.setGroup( "Compose" ); checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); cfg.setGroup( "Applet" ); cbEnableTaskbarApplet->setChecked( cfg.readBoolEntry( "Disabled", false ) ); spCheckOften->setValue( cfg.readNumEntry( "CheckEvery", 5 ) ); cbBlinkLed->setChecked( cfg.readBoolEntry( "BlinkLed", true ) ); cbPlaySound->setChecked( cfg.readBoolEntry( "PlaySound", false ) ); } void SettingsDialog::writeConfig() { - Config cfg( "mail" ); + KConfig cfg ( locateLocal("config","kopiemailrc" )); cfg.setGroup( "Settings" ); cfg.writeEntry( "showHtml", showHtmlButton->isChecked() ); cfg.setGroup( "Compose" ); cfg.writeEntry( "sendLater", checkBoxLater->isChecked() ); cfg.setGroup( "Applet" ); cfg.writeEntry( "Disabled", cbEnableTaskbarApplet->isChecked() ); cfg.writeEntry( "CheckEvery", spCheckOften->value() ); cfg.writeEntry( "BlinkLed", cbBlinkLed->isChecked() ); cfg.writeEntry( "PlaySound", cbPlaySound->isChecked() ); } void SettingsDialog::accept() { writeConfig(); QDialog::accept(); } 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 @@ #ifndef SETTINGS_DIALOG_H #define SETTINGS_DIALOG_H #include <qwidget.h> +#include <qfont.h> #include "settingsdialogui.h" class SettingsDialog : public SettingsDialogUI { Q_OBJECT public: SettingsDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~SettingsDialog(); private: void readConfig(); void writeConfig(); - + QFont mAppFont, mComposeFont, mReadFont; private slots: void accept(); }; #endif diff --git a/kmicromail/settingsdialogui.ui b/kmicromail/settingsdialogui.ui index b503667..f1d48a4 100644 --- a/kmicromail/settingsdialogui.ui +++ b/kmicromail/settingsdialogui.ui @@ -1,230 +1,199 @@ <!DOCTYPE UI><UI> <class>SettingsDialogUI</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>SettingsDialogUI</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>312</width> - <height>379</height> + <width>261</width> + <height>298</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Settings Dialog</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <vbox> <property stdset="1"> <name>margin</name> <number>3</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget> <class>QTabWidget</class> <property stdset="1"> <name>name</name> <cstring>TabWidget2</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>true</bool> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> - <string>View Mail</string> + <string>Mail</string> </attribute> <vbox> <property stdset="1"> <name>margin</name> - <number>3</number> + <number>11</number> </property> <property stdset="1"> <name>spacing</name> - <number>3</number> + <number>6</number> </property> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>showHtmlButton</cstring> </property> <property stdset="1"> <name>text</name> <string>View mail as Html</string> </property> </widget> - <spacer> - <property> - <name>name</name> - <cstring>Spacer1</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Vertical</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </vbox> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>Compose Mail</string> - </attribute> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>3</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>3</number> - </property> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>checkBoxLater</cstring> </property> <property stdset="1"> <name>text</name> <string>Send mails later ( enqueue in outbox )</string> </property> </widget> <spacer> <property> <name>name</name> - <cstring>Spacer2</cstring> + <cstring>Spacer1</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> <enum>Expanding</enum> </property> <property> <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> </vbox> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> + <string>Fonts</string> + </attribute> + </widget> + <widget> + <class>QWidget</class> + <property stdset="1"> + <name>name</name> + <cstring>tab</cstring> + </property> + <attribute> + <name>title</name> <string>Taskbar Applet</string> </attribute> <vbox> <property stdset="1"> <name>margin</name> <number>3</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget> <class>QCheckBox</class> <property stdset="1"> <name>name</name> <cstring>cbEnableTaskbarApplet</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>false</bool> </property> <property stdset="1"> <name>text</name> <string>Disable Taskbar Applet</string> </property> </widget> <widget> <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout2</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QSpinBox</class> <property stdset="1"> <name>name</name> <cstring>spCheckOften</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>false</bool> </property> <property stdset="1"> <name>suffix</name> <string> min</string> </property> <property stdset="1"> <name>value</name> <number>5</number> </property> </widget> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 67b77f8..6e560d7 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp @@ -1,92 +1,92 @@ // CHANGED 2004-08-06 Lutz Rogowski #include "composemail.h" #include "viewmail.h" #include <libmailwrapper/settings.h> #include <libmailwrapper/abstractmail.h> #include <libmailwrapper/mailtypes.h> #include <kapplication.h> /* OPIE */ //#include <opie2/odebug.h> //#include <opie2/ofiledialog.h> //#include <opie2/oimagescrollview.h> #include <kfiledialog.h> #include <kdialog.h> -#include <qpe/config.h> #include <qpe/qpeapplication.h> /* QT */ #include <qtextbrowser.h> #include <qmessagebox.h> #include <qtextstream.h> #include <qaction.h> #include <qpopupmenu.h> #include <qfile.h> #include <qlayout.h> +#include "koprefs.h" //using namespace Opie::Ui; //using namespace Opie::Core; AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, const QString&fsize,int num,const QValueList<int>&path) : QListViewItem(parent,after),_partNum(num) { _path=path; setText(0, mime); setText(1, desc); setText(2, file); setText(3, fsize); } AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, const QString&fsize,int num,const QValueList<int>&path) : QListViewItem(parent,after),_partNum(num) { _path=path; setText(0, mime); setText(1, desc); setText(2, file); setText(3, fsize); } bool AttachItem::isParentof(const QValueList<int>&path) { /* if not set, then no parent */ if (path.count()==0||_path.count()==0) return false; /* the parent must have one digit less then a child */ if (path.count()!=_path.count()+1) return false; for (unsigned int i=0; i < _path.count();++i) { if (_path[i]!=path[i]) return false; } return true; } AttachItem* ViewMail::searchParent(const QValueList<int>&path) { QListViewItemIterator it( attachments ); for ( ; it.current(); ++it ) { AttachItem*ati = (AttachItem*)it.current(); if (ati->isParentof(path)) return ati; } return 0; } AttachItem* ViewMail::lastChild(AttachItem*parent) { if (!parent) return 0; AttachItem* item = (AttachItem*)parent->firstChild(); if (!item) return item; AttachItem*temp=0; while( (temp=(AttachItem*)item->nextSibling())) { item = temp; } return item; } void ViewMail::setBody(const RecBodyP&body ) @@ -265,165 +265,165 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int iview.setName(tmpfile); KApplication::execDialog(&iview); output.remove(); } } break; case 1: if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { setText(); } else { if ( m_recMail->Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); } } break; } delete menu; } void ViewMail::setMail(const RecMailP&mail ) { m_recMail = mail; m_mail[0] = mail->getFrom(); m_mail[1] = mail->getSubject(); m_mail[3] = mail->getDate(); m_mail[4] = mail->Msgid(); m_mail2[0] = mail->To(); m_mail2[1] = mail->CC(); m_mail2[2] = mail->Bcc(); setText(); } ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) : ViewMailBase(parent, name, fl), _inLoop(false) { m_gotBody = false; deleted = false; connect( reply, SIGNAL(activated()), SLOT(slotReply())); connect( forward, SIGNAL(activated()), SLOT(slotForward())); connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); attachments->setEnabled(m_gotBody); connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); readConfig(); attachments->setSorting(-1); } void ViewMail::readConfig() { - Config cfg( "mail" ); - cfg.setGroup( "Settings" ); - m_showHtml = cfg.readBoolEntry( "showHtml", false ); + + setFont ( KOPrefs::instance()->mReadFont ); + m_showHtml = KOPrefs::instance()->mViewAsHtml; showHtml->setOn( m_showHtml ); } void ViewMail::setText() { QString toString; QString ccString; QString bccString; for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { toString += (*it); } for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { ccString += (*it); } for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { bccString += (*it); } setCaption( tr("E-Mail by %1").arg( m_mail[0] ) ); m_mailHtml = "<html><body>" "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + - "</td></tr></table><font face=fixed>"; + "</td></tr></table><font>"; if ( !m_showHtml ) { browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); } else { browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); } // remove later in favor of a real handling m_gotBody = true; } ViewMail::~ViewMail() { m_recMail->Wrapper()->cleanMimeCache(); hide(); } void ViewMail::hide() { QWidget::hide(); if (_inLoop) { _inLoop = false; qApp->exit_loop(); } } void ViewMail::exec() { show(); if (!_inLoop) { _inLoop = true; qApp->enter_loop(); } } QString ViewMail::deHtml(const QString &string) { QString string_ = string; string_.replace(QRegExp("&"), "&"); string_.replace(QRegExp("<"), "<"); string_.replace(QRegExp(">"), ">"); string_.replace(QRegExp("\\n"), "<br>"); return string_; } void ViewMail::slotReply() { if (!m_gotBody) { QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); return; } QString rtext; |