From 8489a583d5b762c5530076271ee3c3be7011b9ef Mon Sep 17 00:00:00 2001 From: umopapisdn Date: Sun, 04 May 2003 00:08:28 +0000 Subject: New feature: It's now possible to configure a default location and default categories for new events. (Options available in configuration dialog.) --- (limited to 'core/pim') diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 6dd8918..cf1eeca 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp @@ -242,6 +242,20 @@ void DateBook::slotSettings() frmSettings.comboDefaultView->setCurrentItem(defaultView-1); frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); + bool found=false; + for (int i=0; i<(frmSettings.comboLocation->count()); i++) { + if ( frmSettings.comboLocation->text(i) == defaultLocation ) { + frmSettings.comboLocation->setCurrentItem(i); + found=true; + break; + } + } + if(!found) { + frmSettings.comboLocation->insertItem(defaultLocation); + frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1); + } + frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar")); + #if defined (Q_WS_QWS) || defined(_WS_QWS_) frmSettings.showMaximized(); #endif @@ -255,6 +269,8 @@ void DateBook::slotSettings() rowStyle = frmSettings.rowStyle(); defaultView=frmSettings.comboDefaultView->currentItem()+1; weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); + defaultLocation=frmSettings.comboLocation->currentText(); + defaultCategories=frmSettings.comboCategory->currentCategories(); if ( dayView ) { dayView->setStartViewTime( startTime ); @@ -385,8 +401,10 @@ void DateBook::viewMonth() { void DateBook::insertEvent( const Event &e ) { - qWarning("Adding Event!"); - db->addEvent(e); + Event dupEvent=e; + dupEvent.setLocation(defaultLocation); + dupEvent.setCategories(defaultCategories); + db->addEvent(dupEvent); emit newEvent(); } @@ -606,6 +624,15 @@ void DateBook::loadSettings() rowStyle = config.readNumEntry("rowstyle"); defaultView = config.readNumEntry("defaultview",DAY); weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL); + + defaultLocation=config.readEntry("defaultLocation"); + QString tmpString=config.readEntry("defaultCategories"); + QStringList tmpStringList=QStringList::split(",",tmpString); + defaultCategories.truncate(0); + for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) { + defaultCategories.resize(defaultCategories.count()+1); + defaultCategories[defaultCategories.count()-1]=(*i).toInt(); + } } void DateBook::saveSettings() @@ -620,6 +647,13 @@ void DateBook::saveSettings() configDB.writeEntry("rowstyle", rowStyle); configDB.writeEntry("defaultview",defaultView); configDB.writeEntry("weeklistviewconfig",weeklistviewconfig); + + configDB.writeEntry("defaultLocation",defaultLocation); + QStringList tmpStringList; + for( uint i=0; isetResizePolicy( QScrollView::AutoOneFit ); - sv->setFrameStyle( QFrame::NoFrame ); - sv->setHScrollBarMode( QScrollView::AlwaysOff ); - vb->addWidget( sv ); + // argh! This really needs to be encapsulated in a class + // or function. + QDialog newDlg( this, 0, TRUE ); + newDlg.setCaption( DateEntryBase::tr("New Event") ); + DateEntry *e; + QVBoxLayout *vb = new QVBoxLayout( &newDlg ); + QScrollView *sv = new QScrollView( &newDlg ); + sv->setResizePolicy( QScrollView::AutoOneFit ); + sv->setFrameStyle( QFrame::NoFrame ); + sv->setHScrollBarMode( QScrollView::AlwaysOff ); + vb->addWidget( sv ); - Event ev; - ev.setDescription( str ); - // When the new gui comes in, change this... + Event ev; + ev.setDescription( str ); + // When the new gui comes in, change this... if(location==0) { - ev.setLocation( tr("(Unknown)") ); + if(defaultLocation.isEmpty()) { + ev.setLocation(tr("(Unknown)")); + } else { + ev.setLocation( defaultLocation ); + } } else { ev.setLocation(location); } - ev.setStart( start ); - ev.setEnd( end ); + ev.setCategories(defaultCategories); + ev.setStart( start ); + ev.setEnd( end ); - e = new DateEntry( onMonday, ev, ampm, &newDlg ); - e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); - sv->addChild( e ); + e = new DateEntry( onMonday, ev, ampm, &newDlg ); + e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); + sv->addChild( e ); #if defined(Q_WS_QWS) || defined(_WS_QWS_) - newDlg.showMaximized(); + newDlg.showMaximized(); #endif - while (newDlg.exec()) { - ev = e->event(); - ev.assignUid(); - QString error = checkEvent( ev ); - if ( !error.isNull() ) { - if ( QMessageBox::warning( this, tr("Error!"), - error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) - continue; + while (newDlg.exec()) { + ev = e->event(); + ev.assignUid(); + QString error = checkEvent( ev ); + if ( !error.isNull() ) { + if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) + continue; + } + db->addEvent( ev ); + emit newEvent(); + break; } - db->addEvent( ev ); - emit newEvent(); - break; - } } void DateBook::setDocument( const QString &filename ) diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index 3f57d4a..eeb8666 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h @@ -108,25 +108,27 @@ private: void saveSettings(); private: - DateBookDBHack *db; - QWidgetStack *views; - DateBookDay *dayView; - DateBookWeek *weekView; - DateBookMonth *monthView; - DateBookWeekLst *weekLstView; - QAction *dayAction, *weekAction, *weekLstAction, *monthAction; + DateBookDBHack *db; + QWidgetStack *views; + DateBookDay *dayView; + DateBookWeek *weekView; + DateBookMonth *monthView; + DateBookWeekLst *weekLstView; + QAction *dayAction, *weekAction, *weekLstAction, *monthAction; int weeklistviewconfig; - bool aPreset; // have everything set to alarm? - int presetTime; // the standard time for the alarm - int startTime; - int rowStyle; + bool aPreset; // have everything set to alarm? + int presetTime; // the standard time for the alarm + int startTime; + int rowStyle; int defaultView; + QArray defaultCategories; + QString defaultLocation; bool bJumpToCurTime; //should jump to current time in dayview? - bool ampm; - bool onMonday; + bool ampm; + bool onMonday; - bool syncing; - bool inSearch; + bool syncing; + bool inSearch; int alarmCounter; diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp index 49fcd17..675b17f 100644 --- a/core/pim/datebook/datebooksettings.cpp +++ b/core/pim/datebook/datebooksettings.cpp @@ -31,9 +31,10 @@ DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, : DateBookSettingsBase( parent, name, modal, fl ), ampm( whichClock ) { - init(); - QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), - this, SLOT( slotChangeClock( bool ) ) ); + init(); + QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), this, SLOT( slotChangeClock( bool ) ) ); + QArray categories; + comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); } DateBookSettings::~DateBookSettings() diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h index 90a07f9..c3036e1 100644 --- a/core/pim/datebook/datebooksettings.h +++ b/core/pim/datebook/datebooksettings.h @@ -21,6 +21,7 @@ #ifndef DATEBOOKSETTINGS_H #define DATEBOOKSETTINGS_H #include "datebooksettingsbase.h" +#include class DateBookSettings : public DateBookSettingsBase { diff --git a/core/pim/datebook/datebooksettingsbase.ui b/core/pim/datebook/datebooksettingsbase.ui index 3836330..e613db1 100644 --- a/core/pim/datebook/datebooksettingsbase.ui +++ b/core/pim/datebook/datebooksettingsbase.ui @@ -33,7 +33,7 @@ 0 0 273 - 303 + 340 @@ -530,32 +530,169 @@ - - - name - Spacer9 - + + QGroupBox - orientation - Vertical + name + GroupBox5_2_2 - sizeType - Expanding - - - sizeHint - - 20 - 20 - + title + Defaults - + + + margin + 11 + + + spacing + 6 + + + QLayoutWidget + + name + Layout6_2 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel2_2_3 + + + frameShape + MShape + + + frameShadow + MShadow + + + text + Location: + + + + QComboBox + + + text + + + + + + text + Office + + + + + text + Home + + + + name + comboLocation + + + sizePolicy + + 7 + 0 + + + + editable + true + + + currentItem + 0 + + + duplicatesEnabled + false + + + + + + QLayoutWidget + + name + Layout7_2 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel2_2_2_2 + + + text + Category: + + + + CategorySelect + + name + comboCategory + + + + + + + + + CategorySelect +
qpe/categoryselect.h
+ + -1 + -1 + + 0 + + 7 + 1 + + image0 +
+
+ + + image0 + 789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758 + + chkAlarmPreset -- cgit v0.9.0.2