author | umopapisdn <umopapisdn> | 2003-05-04 00:08:28 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2003-05-04 00:08:28 (UTC) |
commit | 8489a583d5b762c5530076271ee3c3be7011b9ef (patch) (side-by-side diff) | |
tree | 67b1c998368636f8b95e1cae75070f7be9d80409 /core/pim/datebook/datebook.cpp | |
parent | 585f0369fb448bdb49f9c261c488610fa46e61d7 (diff) | |
download | opie-8489a583d5b762c5530076271ee3c3be7011b9ef.zip opie-8489a583d5b762c5530076271ee3c3be7011b9ef.tar.gz opie-8489a583d5b762c5530076271ee3c3be7011b9ef.tar.bz2 |
New feature: It's now possible to configure a default location and default categories for new events. (Options available in configuration dialog.)
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebook.cpp | 46 |
1 files changed, 42 insertions, 4 deletions
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 @@ -244,2 +244,16 @@ void DateBook::slotSettings() + 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_) @@ -257,2 +271,4 @@ void DateBook::slotSettings() weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); + defaultLocation=frmSettings.comboLocation->currentText(); + defaultCategories=frmSettings.comboCategory->currentCategories(); @@ -387,4 +403,6 @@ 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(); @@ -608,2 +626,11 @@ void DateBook::loadSettings() 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(); + } } @@ -622,2 +649,9 @@ void DateBook::saveSettings() configDB.writeEntry("weeklistviewconfig",weeklistviewconfig); + + configDB.writeEntry("defaultLocation",defaultLocation); + QStringList tmpStringList; + for( uint i=0; i<defaultCategories.count(); i++) { + tmpStringList << QString::number(defaultCategories[i]); + } + configDB.writeEntry("defaultCategories",tmpStringList.join(",")); } @@ -843,6 +877,11 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const if(location==0) { + if(defaultLocation.isEmpty()) { ev.setLocation( tr("(Unknown)") ); } else { + ev.setLocation( defaultLocation ); + } + } else { ev.setLocation(location); } + ev.setCategories(defaultCategories); ev.setStart( start ); @@ -861,4 +900,3 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const if ( !error.isNull() ) { - if ( QMessageBox::warning( this, tr("Error!"), - error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) + if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 ) continue; |