summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebook.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp46
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
@@ -243,4 +243,18 @@ void DateBook::slotSettings()
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();
@@ -256,4 +270,6 @@ void DateBook::slotSettings()
defaultView=frmSettings.comboDefaultView->currentItem()+1;
weeklistviewconfig=frmSettings.comboWeekListView->currentItem();
+ defaultLocation=frmSettings.comboLocation->currentText();
+ defaultCategories=frmSettings.comboCategory->currentCategories();
if ( dayView ) {
@@ -386,6 +402,8 @@ 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();
}
@@ -607,4 +625,13 @@ void DateBook::loadSettings()
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();
+ }
}
@@ -621,4 +648,11 @@ void DateBook::saveSettings()
configDB.writeEntry("defaultview",defaultView);
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(","));
}
@@ -842,8 +876,13 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const
// When the new gui comes in, change this...
if(location==0) {
+ if(defaultLocation.isEmpty()) {
ev.setLocation( tr("(Unknown)") );
} else {
+ ev.setLocation( defaultLocation );
+ }
+ } else {
ev.setLocation(location);
}
+ ev.setCategories(defaultCategories);
ev.setStart( start );
ev.setEnd( end );
@@ -860,6 +899,5 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const
QString error = checkEvent( ev );
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;
}