-rw-r--r-- | korganizer/calendarview.cpp | 7 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 251 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 118 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 7 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | libkdepim/kcmconfigs/kdepimconfigwidget.cpp | 1 | ||||
-rw-r--r-- | microkde/kcolorbutton.cpp | 7 | ||||
-rw-r--r-- | microkde/kcolorbutton.h | 3 |
8 files changed, 321 insertions, 74 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 753d81f..1024b4e 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -3919,50 +3919,53 @@ void CalendarView::editFilters() CalFilter *filter = mFilters.first(); while(filter) { kdDebug() << " Filter: " << filter->name() << endl; filter = mFilters.next(); } mDialogManager->showFilterEditDialog(&mFilters); } void CalendarView::toggleFilter() { showFilter(! mFilterView->isVisible()); } KOFilterView *CalendarView::filterView() { return mFilterView; } void CalendarView::selectFilter( int fil ) { mFilterView->setSelectedFilter( fil ); } void CalendarView::showFilter(bool visible) { -#if 0 - if (visible) mCalEditView->show(); +#if 1 + if (visible) { + mCalEditView->readConfig(); + mCalEditView->show(); + } else mCalEditView->hide(); #else if (visible) mFilterView->show(); else mFilterView->hide(); #endif } void CalendarView::toggleFilerEnabled( ) { mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); if ( !mFilterView->filtersEnabled() ) topLevelWidget()->setCaption( i18n("Filter disabled ") ); } void CalendarView::updateFilter() { CalFilter *filter = mFilterView->selectedFilter(); if (filter) { QString mess; if (mFilterView->filtersEnabled()) { mess = i18n("Filter selected: ")+filter->name(); filter->setEnabled(true); } else filter->setEnabled(false); mCalendar->setFilter(filter); diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index dc6237b..d79b28e 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -5,55 +5,98 @@ 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 <qcheckbox.h> #include <qcombobox.h> #include <qpushbutton.h> #include <qlayout.h> #include <qlabel.h> +#include <qdialog.h> #include <libkcal/calfilter.h> #include "kofilterview.h" +#include "koprefs.h" #include <kiconloader.h> #include <kglobal.h> +#include <kcolorbutton.h> +#include <kmessagebox.h> + + +#include <kurlrequester.h> +#include <klineedit.h> + +class KONewCalPrefs : public QDialog +{ + public: + KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : + QDialog( parent, name, true ) + { + setCaption( i18n("Add new Calendar") ); + QVBoxLayout* lay = new QVBoxLayout( this ); + lay->setSpacing( 3 ); + lay->setMargin( 3 ); + QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); + lay->addWidget( lab ); + nameE = new KLineEdit( this ); + lay->addWidget( nameE ); + lab = new QLabel( i18n("Local ical (*.ics) file:"), this ); + lay->addWidget( lab ); + url = new KURLRequester ( this ); + lay->addWidget( url ); + QPushButton * ok = new QPushButton( i18n("OK"), this ); + lay->addWidget( ok ); + QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); + lay->addWidget( cancel ); + connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); + connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); + resize( 200, 200 ); + } + + QString calName() { return nameE->text(); } + QString calFileName() { return url->url(); } +private: + KLineEdit* nameE; + KURLRequester *url; +}; + KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, const char* name,WFlags fl ) : KOFilterView_base(parent,name,fl) { mFilters = filterList; connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); } KOFilterView::~KOFilterView() { // no need to delete child widgets, Qt does it all for us } bool KOFilterView::filtersEnabled() { return mEnabledCheck->isChecked(); } void KOFilterView::setFiltersEnabled(bool set) { @@ -82,95 +125,259 @@ CalFilter *KOFilterView::selectedFilter() void KOFilterView::setSelectedFilter(QString filterName) { int filter_num = mSelectionCombo->count(); int i; for (i=0;i<filter_num;i++) { if (mSelectionCombo->text(i)==filterName) mSelectionCombo->setCurrentItem(i); } emit filterChanged(); } void KOFilterView::setSelectedFilter( int fil ) { if ( fil >= mSelectionCombo->count() ) return; mSelectionCombo->setCurrentItem( fil ); emit filterChanged(); } KOCalEditView::KOCalEditView(QWidget* parent, const char* name ) : QWidget(parent,name) { - /* - connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); - connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); - connect(mEditButton,SIGNAL(clicked()),SIGNAL(editCalEdits())); - */ - QGridLayout* mainLayout = new QGridLayout ( this , 2, 6 ); - QPushButton * addBut = new QPushButton ( this ); + mw = 0; + ml = new QVBoxLayout ( this ); +} + +KOCalEditView::~KOCalEditView() +{ + // no need to delete child widgets, Qt does it all for us +} +void KOCalEditView::selectCal(int id ,bool b) +{ + KOPrefs::instance()->getCalendar( id )->isEnabled = b; + emit calendarEnabled ( id, b ); + +} +void KOCalEditView::selectStdCal( int id, bool b ) +{ + + if ( !b ) { + KOCalCheckButton* it = (KOCalCheckButton*) sender(); + if ( it ) { + it->blockSignals( true ); + it->setChecked( true ); + it->blockSignals( false ); + return; + } + return; + } + KOCalCheckButton* sen = (KOCalCheckButton*) sender(); + KOCalCheckButton* it = mStdandardB.first(); + while ( it ) { + if ( it->isChecked() ) { + if ( it != sen ) { + it->blockSignals( true ); + it->setChecked( false ); + it->blockSignals( false ); + break; + } + } + it = mStdandardB.next(); + } + KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); + while ( kkf ) { + kkf->isStandard = false; + kkf = KOPrefs::instance()->mCalendars.next(); + } + KOPrefs::instance()->getCalendar( id )->isStandard = true; + emit setCalendarDefault ( id ); +} + +void KOCalEditView::selectCalAlarm(int id ,bool b ) +{ + KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; + emit alarmEnabled ( id , b ); +} +void KOCalEditView::selectReadOnly(int id ,bool b ) +{ + KOPrefs::instance()->getCalendar( id )->isReadOnly = b; + emit calendarReadonly ( id , b ); + +} +void KOCalEditView::setColor( const QColor& c, int id ) +{ + KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; +} +void KOCalEditView::deleteCal( int id ) +{ + KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); + QString name = kkf->mName; + QString file = kkf->mFileName; + if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; + emit removeCalendar ( id ); + KOPrefs::instance()->mCalendars.remove ( kkf ); + readConfig(); +} +void KOCalEditView::infoCal( int id ) +{ + QString name = KOPrefs::instance()->getCalendar( id )->mName; + QString file = KOPrefs::instance()->getCalendar( id )->mFileName; + KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); +} +void KOCalEditView::readConfig() +{ + + mStdandardB.clear(); + mEnabledB.clear(); + mAlarmB.clear(); + mROB.clear(); + + if ( mw ) delete mw; + mw = new QWidget ( this ); + ml->addWidget ( mw ); + + mainLayout = new QGridLayout ( mw , 2, 8 ); + mainLayout->setSpacing( 3 ); + QPushButton * addBut = new QPushButton ( mw ); mainLayout->addWidget( addBut,0,0 ); addBut->setPixmap ( SmallIcon("plus")); connect(addBut,SIGNAL(clicked()),SLOT(addCal())); addBut->setMaximumWidth( addBut->sizeHint().height() ); - addBut = new QPushButton ( this ); + addBut = new QPushButton ( mw ); mainLayout->addWidget( addBut,0,1 ); addBut->setPixmap ( SmallIcon("eye")); connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); addBut->setMaximumWidth( addBut->sizeHint().height() ); - QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", this ); + QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); mainLayout->addWidget( lab,0,2 ); - addBut = new QPushButton ( this ); + addBut = new QPushButton ( mw ); mainLayout->addWidget( addBut,0,3 ); addBut->setPixmap ( SmallIcon("bell")); connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); addBut->setMaximumWidth( addBut->sizeHint().height() ); - addBut = new QPushButton ( this ); + addBut = new QPushButton ( mw ); mainLayout->addWidget( addBut,0,4 ); addBut->setPixmap ( SmallIcon("pencil")); connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); addBut->setMaximumWidth( addBut->sizeHint().height() ); - addBut = new QPushButton ( this ); - mainLayout->addWidget( addBut,0,5 ); + lab = new QLabel ( i18n(" Color "), mw ); + mainLayout->addWidget( lab,0,5 ); +#if 0 + addBut = new QPushButton ( mw ); + mainLayout->addWidget( addBut,0,6 ); addBut->setPixmap ( SmallIcon("minus")); connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); addBut->setMaximumWidth( addBut->sizeHint().height() ); +#endif + KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); + int row = 1; + while ( kkf ) { + KOCalCheckButton* cb = new KOCalCheckButton( mw ); + mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); + cb->setChecked( kkf->isStandard ); + cb->setNum( kkf->mCalNumber ); + connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); + cb = new KOCalCheckButton( mw ); + mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); + cb->setChecked( kkf->isEnabled ); + cb->setNum( kkf->mCalNumber ); + connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); + KOCalButton* name = new KOCalButton( mw ); + name->setNum( kkf->mCalNumber ); + name->setText( kkf->mName ); + mainLayout->addWidget( name,row,2 ); + connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); + cb = new KOCalCheckButton( mw ); + mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); + cb->setChecked( kkf->isAlarmEnabled ); + cb->setNum( kkf->mCalNumber ); + connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); + cb = new KOCalCheckButton( mw ); + mainLayout->addWidget( cb,row,4 );mROB.append( cb ); + cb->setChecked( kkf->isReadOnly ); + cb->setNum( kkf->mCalNumber ); + connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); + KColorButton *colb = new KColorButton( mw ); + mainLayout->addWidget( colb,row,5 ); + colb->setID( kkf->mCalNumber ); + colb->setColor( kkf->mDefaultColor ); + connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); + if ( row > 1) { + KOCalButton* calb = new KOCalButton( mw ); + mainLayout->addWidget( calb,row,6 ); + calb->setNum( kkf->mCalNumber ); + calb->setPixmap ( SmallIcon("minus")); + connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); + int hei = calb->sizeHint().height(); + calb->setMaximumSize( hei*9/10, hei*9/10 ); } - -KOCalEditView::~KOCalEditView() -{ - // no need to delete child widgets, Qt does it all for us + ++row; + kkf = KOPrefs::instance()->mCalendars.next(); } -void KOCalEditView::readConfig( KConfig *) -{ + lab = new QLabel ( "", mw ); + mainLayout->addWidget( lab,row,0 ); + mw->show(); } void KOCalEditView::addCal() { qDebug("addcal "); + KONewCalPrefs prefs ( this ); + if ( ! prefs.exec() ) + return; + QString name = prefs.calName(); + QString file = prefs.calFileName(); + QFileInfo fi ( file ); + if (!fi.exists() ) { + KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); + return; + } + KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); + kkf->mName = name; + kkf->mFileName = file; + emit calendarAdded( kkf->mCalNumber ); + readConfig(); } void KOCalEditView::enableAll() { - qDebug("enableAll"); + toggleList( mEnabledB ); } void KOCalEditView::enableAlarm() { - qDebug("enableAlarm"); + toggleList( mAlarmB ); } void KOCalEditView::disableRO() { - qDebug("OCalEditView::disableRO() "); + toggleList( mROB ); +} +void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) +{ + bool dis = false; + KOCalCheckButton* it = list.first(); + while ( it ) { + if ( !it->isChecked() ) { + dis = true; + break; + } + it = list.next(); + } + it = list.first(); + while ( it ) { + it->setChecked(dis); + it = list.next(); + } } void KOCalEditView::deleteAll() { qDebug("delteAll"); } diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index 060108f..aaf0eb6 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h @@ -10,124 +10,146 @@ 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 KOFILTERVIEW_H #define KOFILTERVIEW_H #include <qstring.h> #include <qcheckbox.h> #include <qpushbutton.h> #include <kconfig.h> #include "kofilterview_base.h" #include <libkcal/calfilter.h> -using namespace KCal; - -class KOFilterView : public KOFilterView_base -{ - Q_OBJECT - public: - KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); - ~KOFilterView(); - - void updateFilters(); - - bool filtersEnabled(); - void setFiltersEnabled(bool); - CalFilter *selectedFilter(); - void setSelectedFilter(QString); - void setSelectedFilter( int ); - - signals: - void filterChanged(); - void editFilters(); - - private: - QPtrList<CalFilter> *mFilters; -}; - -class KOCalEditView : public QWidget -{ - Q_OBJECT - public: - KOCalEditView( QWidget* parent=0,const char* name=0); - ~KOCalEditView(); - - void readConfig( KConfig *); - public slots: - void addCal(); - void enableAll(); - void enableAlarm(); - void disableRO(); - void deleteAll(); - signals: - void alarmEnabled ( int cal, bool enable ); - void calendarEnabled ( int cal, bool enable ); - void calendarReadonly ( int cal, bool readonly ); - void setCalendarDefault ( int cal ); - void removeCalendar ( int cal ); - - private: -}; +class QGridLayout; +using namespace KCal; class KOCalButton : public QPushButton { Q_OBJECT public: KOCalButton( QWidget *parent=0, const char *name=0 ) : QPushButton( parent, name) { connect( this, SIGNAL( clicked() ), SLOT( bottonClicked() )); mNumber = -1; } void setNum ( int num ) {mNumber = num; } signals: void selectNum ( int ); private: int mNumber; void keyPressEvent ( QKeyEvent * e ) { e->ignore(); } private slots : void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } }; class KOCalCheckButton : public QCheckBox { Q_OBJECT public: KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : QCheckBox( parent, name) { connect( this, SIGNAL( toggled ( bool ) ), SLOT( bottonClicked( bool ) )); mNumber = -1; + //setMaximumWidth( 10 ); + } void setNum ( int num ) {mNumber = num; } signals: void selectNum ( int, bool ); private: int mNumber; void keyPressEvent ( QKeyEvent * e ) { e->ignore(); } private slots : void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } }; + +class KOFilterView : public KOFilterView_base +{ + Q_OBJECT + public: + KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); + ~KOFilterView(); + + void updateFilters(); + + bool filtersEnabled(); + void setFiltersEnabled(bool); + CalFilter *selectedFilter(); + void setSelectedFilter(QString); + void setSelectedFilter( int ); + + signals: + void filterChanged(); + void editFilters(); + + private: + QPtrList<CalFilter> *mFilters; +}; + +class KOCalEditView : public QWidget +{ + Q_OBJECT + public: + KOCalEditView( QWidget* parent=0,const char* name=0); + ~KOCalEditView(); + + void readConfig(); + public slots: + void addCal(); + void enableAll(); + void enableAlarm(); + void disableRO(); + void deleteAll(); + void selectStdCal(int,bool ); + void selectCal(int,bool ); + void selectCalAlarm(int,bool ); + void selectReadOnly(int,bool ); + void setColor(const QColor &,int) ; + void deleteCal(int) ; + void infoCal(int) ; + signals: + void alarmEnabled ( int cal, bool enable ); + void calendarEnabled ( int cal, bool enable ); + void calendarReadonly ( int cal, bool readonly ); + void setCalendarDefault ( int cal ); + void removeCalendar ( int cal ); + void calendarAdded( int ); + + private: + QVBoxLayout* ml; + QWidget *mw; + void toggleList ( QPtrList<KOCalCheckButton> ); + QPtrList<KOCalCheckButton> mStdandardB; + QPtrList<KOCalCheckButton> mEnabledB; + QPtrList<KOCalCheckButton> mAlarmB; + QPtrList<KOCalCheckButton> mROB; + QGridLayout* mainLayout; +}; + + + #endif // KOFILTERVIEW_H diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 179f586..bc6aae4 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -421,71 +421,74 @@ void KOPrefs::usrReadConfig() } 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)); } config()->setGroup("CCal"); int numCals = config()->readNumEntry("NumberCalendars",0 ); mNextAvailableCalendar = 1; if ( numCals == 0 ) { KopiCalendarFile *kkf = getNewCalendar(); kkf->isStandard = true; - kkf->mName = i18n("Standard Calendar"); + kkf->mName = i18n("Standard"); kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); } while ( mNextAvailableCalendar <= numCals ) { qDebug("Read cal #%d ", mNextAvailableCalendar ); QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); KopiCalendarFile *kkf = getNewCalendar(); kkf->isStandard = config()->readBoolEntry( prefix+"_isStandard", false ); kkf->isEnabled = config()->readBoolEntry( prefix+"_isEnabled", true); kkf->isAlarmEnabled = config()->readBoolEntry( prefix+"_isAlarmEnabled", true); kkf->isReadOnly = config()->readBoolEntry( prefix+"_isReadOnly", false); kkf->mName = config()->readEntry( prefix+"_Name", "Calendar"); kkf->mFileName = config()->readEntry( prefix+"_FileName", kkf->mFileName); kkf->mDefaultColor = config()->readColorEntry( prefix+"_Color",&mEventColor); if ( kkf->mCalNumber == 1 ) { kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); - //kkf->mName = i18n("Standard Calendar"); } } KPimPrefs::usrReadConfig(); } +KopiCalendarFile * KOPrefs::getCalendar( int num ) +{ + return mDefCalColors[num-1]; +} KopiCalendarFile * KOPrefs::getNewCalendar() { KopiCalendarFile * kkf = new KopiCalendarFile(); kkf->mCalNumber = mNextAvailableCalendar; mDefCalColors.resize( mNextAvailableCalendar ); mDefCalColors[mNextAvailableCalendar-1] = kkf; ++mNextAvailableCalendar; kkf->mDefaultColor = mEventColor; kkf->mName = i18n("New Calendar"); mCalendars.append( kkf ); return kkf; } void KOPrefs::deleteCalendar( int num ) { KopiCalendarFile * kkf = mCalendars.first(); while ( kkf ) { if ( kkf->mCalNumber == num ) { qDebug("KOPrefs::deleteCalendar %d ", num ); mCalendars.remove( kkf ); delete kkf; return; } kkf = mCalendars.next(); diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 7d71cbd..f114d88 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -72,48 +72,49 @@ class KOPrefs : public KPimPrefs 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(); void setAllDefaults(); KopiCalendarFile * getNewCalendar(); + KopiCalendarFile * getCalendar( int ); void deleteCalendar( int ); QColor defaultColor( int ) const; 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; QStringList getDefaultList(); QStringList getLocationDefaultList(); public: // preferences data KConfig* getConfig(); void setFullName(const QString &); QString fullName(); void setEmail(const QString &); QString email(); diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp index a0f9d2e..ff1e240 100644 --- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp +++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp @@ -68,48 +68,49 @@ $Id$ #include <kmessagebox.h> #include <kstandarddirs.h> #ifndef KAB_EMBEDDED #include <ktrader.h> #else // KAB_EMBEDDED #include <mergewidget.h> #include <distributionlistwidget.h> #endif // KAB_EMBEDDED #include "addresseewidget.h" #include "extensionconfigdialog.h" #include "extensionwidget.h" */ #include "qapplication.h" #include "kpimglobalprefs.h" #include "kdepimconfigwidget.h" #include <kprefs.h> #include <kmessagebox.h> + KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) : KPrefsWidget(prefs, parent, name ) { mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); QVBoxLayout *topLayout = new QVBoxLayout( this, 0, KDialog::spacingHint() ); tabWidget = new QTabWidget( this ); topLayout->addWidget( tabWidget ); setupLocaleTab(); setupLocaleDateTab(); setupTimeZoneTab(); setupExternalAppTab(); setupStoreTab(); setupBackupTab(); diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp index 96dc256..197bea2 100644 --- a/microkde/kcolorbutton.cpp +++ b/microkde/kcolorbutton.cpp @@ -1,47 +1,54 @@ #include "kcolorbutton.h" #include "kcolordialog.h" #include "qapplication.h" #include "qlayout.h" #ifdef DESKTOP_VERSION #include <qcolordialog.h> #endif void KColorButton:: edit() { #ifdef DESKTOP_VERSION QColor col = QColorDialog::getColor ( mColor ); if ( col.isValid () ) { mColor = col; setColor ( mColor ); emit changed ( mColor ); + emit changedID ( mColor, id ); } #else KColorDialog* k = new KColorDialog( this ); k->setColor( mColor ); int res = k->exec(); if ( res ) { mColor = k->getColor(); setColor ( mColor ); emit changed ( mColor ); + emit changedID ( mColor, id ); } delete k; #endif } KColorButton::KColorButton( QWidget *p ):QPushButton( p ) { int size = 24; if( QApplication::desktop()->width() < 480 || QApplication::desktop()->height() <= 320 ) size = 18; setFixedSize( size,size ); + int id = 0; connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() )); } +void KColorButton::setID ( int i) +{ + id = i; +} void KColorButton::setColor ( const QColor & c) { mColor = c; QPixmap pix ( height() - 4, width() - 4 ); pix.fill( c ); setPixmap ( pix ); } diff --git a/microkde/kcolorbutton.h b/microkde/kcolorbutton.h index 88b3774..983771b 100644 --- a/microkde/kcolorbutton.h +++ b/microkde/kcolorbutton.h @@ -1,26 +1,29 @@ #ifndef MICROKDE_KCOLORBUTTON_H #define MICROKDE_KCOLORBUTTON_H #include <qpushbutton.h> #include <qcolor.h> #include <kglobal.h> #include <qpixmap.h> #include <qlabel.h> class KColorButton : public QPushButton { Q_OBJECT public: KColorButton( QWidget *p ); void setColor ( const QColor &); + void setID ( int i) ; QColor color() const { return mColor ; } signals: void changed(const QColor &); + void changedID(const QColor &, int id); private slots: void edit(); private: QColor mColor; + int id; }; #endif |