summaryrefslogtreecommitdiff
path: root/core/pim/datebook/datebook.cpp
Unidiff
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
@@ -239,12 +239,26 @@ void DateBook::slotSettings()
239 frmSettings.setAlarmPreset( aPreset, presetTime ); 239 frmSettings.setAlarmPreset( aPreset, presetTime );
240 frmSettings.setJumpToCurTime( bJumpToCurTime ); 240 frmSettings.setJumpToCurTime( bJumpToCurTime );
241 frmSettings.setRowStyle( rowStyle ); 241 frmSettings.setRowStyle( rowStyle );
242 frmSettings.comboDefaultView->setCurrentItem(defaultView-1); 242 frmSettings.comboDefaultView->setCurrentItem(defaultView-1);
243 frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); 243 frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig);
244 244
245 bool found=false;
246 for (int i=0; i<(frmSettings.comboLocation->count()); i++) {
247 if ( frmSettings.comboLocation->text(i) == defaultLocation ) {
248 frmSettings.comboLocation->setCurrentItem(i);
249 found=true;
250 break;
251 }
252 }
253 if(!found) {
254 frmSettings.comboLocation->insertItem(defaultLocation);
255 frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1);
256 }
257 frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar"));
258
245#if defined (Q_WS_QWS) || defined(_WS_QWS_) 259#if defined (Q_WS_QWS) || defined(_WS_QWS_)
246 frmSettings.showMaximized(); 260 frmSettings.showMaximized();
247#endif 261#endif
248 262
249 if ( frmSettings.exec() ) { 263 if ( frmSettings.exec() ) {
250 264
@@ -252,12 +266,14 @@ void DateBook::slotSettings()
252 presetTime = frmSettings.presetTime(); 266 presetTime = frmSettings.presetTime();
253 startTime = frmSettings.startTime(); 267 startTime = frmSettings.startTime();
254 bJumpToCurTime = frmSettings.jumpToCurTime(); 268 bJumpToCurTime = frmSettings.jumpToCurTime();
255 rowStyle = frmSettings.rowStyle(); 269 rowStyle = frmSettings.rowStyle();
256 defaultView=frmSettings.comboDefaultView->currentItem()+1; 270 defaultView=frmSettings.comboDefaultView->currentItem()+1;
257 weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); 271 weeklistviewconfig=frmSettings.comboWeekListView->currentItem();
272 defaultLocation=frmSettings.comboLocation->currentText();
273 defaultCategories=frmSettings.comboCategory->currentCategories();
258 274
259 if ( dayView ) { 275 if ( dayView ) {
260 dayView->setStartViewTime( startTime ); 276 dayView->setStartViewTime( startTime );
261 dayView->setJumpToCurTime( bJumpToCurTime ); 277 dayView->setJumpToCurTime( bJumpToCurTime );
262 dayView->setRowStyle( rowStyle ); 278 dayView->setRowStyle( rowStyle );
263 } 279 }
@@ -382,14 +398,16 @@ void DateBook::viewWeekLst() {
382void DateBook::viewMonth() { 398void DateBook::viewMonth() {
383 view(MONTH,currentDate()); 399 view(MONTH,currentDate());
384} 400}
385 401
386void DateBook::insertEvent( const Event &e ) 402void DateBook::insertEvent( const Event &e )
387{ 403{
388 qWarning("Adding Event!"); 404 Event dupEvent=e;
389 db->addEvent(e); 405 dupEvent.setLocation(defaultLocation);
406 dupEvent.setCategories(defaultCategories);
407 db->addEvent(dupEvent);
390 emit newEvent(); 408 emit newEvent();
391} 409}
392 410
393void DateBook::duplicateEvent( const Event &e ) 411void DateBook::duplicateEvent( const Event &e )
394{ 412{
395 qWarning("Hmmm..."); 413 qWarning("Hmmm...");
@@ -603,12 +621,21 @@ void DateBook::loadSettings()
603 aPreset = config.readBoolEntry("alarmpreset"); 621 aPreset = config.readBoolEntry("alarmpreset");
604 presetTime = config.readNumEntry("presettime"); 622 presetTime = config.readNumEntry("presettime");
605 bJumpToCurTime = config.readBoolEntry("jumptocurtime"); 623 bJumpToCurTime = config.readBoolEntry("jumptocurtime");
606 rowStyle = config.readNumEntry("rowstyle"); 624 rowStyle = config.readNumEntry("rowstyle");
607 defaultView = config.readNumEntry("defaultview",DAY); 625 defaultView = config.readNumEntry("defaultview",DAY);
608 weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL); 626 weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL);
627
628 defaultLocation=config.readEntry("defaultLocation");
629 QString tmpString=config.readEntry("defaultCategories");
630 QStringList tmpStringList=QStringList::split(",",tmpString);
631 defaultCategories.truncate(0);
632 for( QStringList::Iterator i=tmpStringList.begin(); i!=tmpStringList.end(); i++) {
633 defaultCategories.resize(defaultCategories.count()+1);
634 defaultCategories[defaultCategories.count()-1]=(*i).toInt();
635 }
609} 636}
610 637
611void DateBook::saveSettings() 638void DateBook::saveSettings()
612{ 639{
613 Config config( "qpe" ); 640 Config config( "qpe" );
614 Config configDB( "DateBook" ); 641 Config configDB( "DateBook" );
@@ -617,12 +644,19 @@ void DateBook::saveSettings()
617 configDB.writeEntry("alarmpreset",aPreset); 644 configDB.writeEntry("alarmpreset",aPreset);
618 configDB.writeEntry("presettime",presetTime); 645 configDB.writeEntry("presettime",presetTime);
619 configDB.writeEntry("jumptocurtime", bJumpToCurTime); 646 configDB.writeEntry("jumptocurtime", bJumpToCurTime);
620 configDB.writeEntry("rowstyle", rowStyle); 647 configDB.writeEntry("rowstyle", rowStyle);
621 configDB.writeEntry("defaultview",defaultView); 648 configDB.writeEntry("defaultview",defaultView);
622 configDB.writeEntry("weeklistviewconfig",weeklistviewconfig); 649 configDB.writeEntry("weeklistviewconfig",weeklistviewconfig);
650
651 configDB.writeEntry("defaultLocation",defaultLocation);
652 QStringList tmpStringList;
653 for( uint i=0; i<defaultCategories.count(); i++) {
654 tmpStringList << QString::number(defaultCategories[i]);
655 }
656 configDB.writeEntry("defaultCategories",tmpStringList.join(","));
623} 657}
624 658
625void DateBook::appMessage(const QCString& msg, const QByteArray& data) 659void DateBook::appMessage(const QCString& msg, const QByteArray& data)
626{ 660{
627 bool needShow = FALSE; 661 bool needShow = FALSE;
628 if ( msg == "alarm(QDateTime,int)" ) { 662 if ( msg == "alarm(QDateTime,int)" ) {
@@ -838,16 +872,21 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const
838 vb->addWidget( sv ); 872 vb->addWidget( sv );
839 873
840 Event ev; 874 Event ev;
841 ev.setDescription( str ); 875 ev.setDescription( str );
842 // When the new gui comes in, change this... 876 // When the new gui comes in, change this...
843 if(location==0) { 877 if(location==0) {
878 if(defaultLocation.isEmpty()) {
844 ev.setLocation( tr("(Unknown)") ); 879 ev.setLocation( tr("(Unknown)") );
845 } else { 880 } else {
881 ev.setLocation( defaultLocation );
882 }
883 } else {
846 ev.setLocation(location); 884 ev.setLocation(location);
847 } 885 }
886 ev.setCategories(defaultCategories);
848 ev.setStart( start ); 887 ev.setStart( start );
849 ev.setEnd( end ); 888 ev.setEnd( end );
850 889
851 e = new DateEntry( onMonday, ev, ampm, &newDlg ); 890 e = new DateEntry( onMonday, ev, ampm, &newDlg );
852 e->setAlarmEnabled( aPreset, presetTime, Event::Loud ); 891 e->setAlarmEnabled( aPreset, presetTime, Event::Loud );
853 sv->addChild( e ); 892 sv->addChild( e );
@@ -856,14 +895,13 @@ void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const
856#endif 895#endif
857 while (newDlg.exec()) { 896 while (newDlg.exec()) {
858 ev = e->event(); 897 ev = e->event();
859 ev.assignUid(); 898 ev.assignUid();
860 QString error = checkEvent( ev ); 899 QString error = checkEvent( ev );
861 if ( !error.isNull() ) { 900 if ( !error.isNull() ) {
862 if ( QMessageBox::warning( this, tr("Error!"), 901 if ( QMessageBox::warning( this, tr("Error!"), error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 )
863 error, tr("Fix it"), tr("Continue"), 0, 0, 1 ) == 0 )
864 continue; 902 continue;
865 } 903 }
866 db->addEvent( ev ); 904 db->addEvent( ev );
867 emit newEvent(); 905 emit newEvent();
868 break; 906 break;
869 } 907 }