-rw-r--r-- | core/pim/datebook/datebook.cpp | 108 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 32 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.cpp | 7 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.h | 1 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettingsbase.ui | 173 |
5 files changed, 250 insertions, 71 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 | |||
@@ -241,8 +241,22 @@ void DateBook::slotSettings() | |||
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 | ||
@@ -254,8 +268,10 @@ void DateBook::slotSettings() | |||
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 ); |
@@ -384,10 +400,12 @@ void DateBook::viewMonth() { | |||
384 | } | 400 | } |
385 | 401 | ||
386 | void DateBook::insertEvent( const Event &e ) | 402 | void 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 | ||
393 | void DateBook::duplicateEvent( const Event &e ) | 411 | void DateBook::duplicateEvent( const Event &e ) |
@@ -605,8 +623,17 @@ void DateBook::loadSettings() | |||
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 | ||
611 | void DateBook::saveSettings() | 638 | void DateBook::saveSettings() |
612 | { | 639 | { |
@@ -619,8 +646,15 @@ void DateBook::saveSettings() | |||
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 | ||
625 | void DateBook::appMessage(const QCString& msg, const QByteArray& data) | 659 | void DateBook::appMessage(const QCString& msg, const QByteArray& data) |
626 | { | 660 | { |
@@ -824,50 +858,54 @@ void DateBook::slotNewEventFromKey( const QString &str ) | |||
824 | } | 858 | } |
825 | slotNewEntry(start, end, str); | 859 | slotNewEntry(start, end, str); |
826 | } | 860 | } |
827 | void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location) { | 861 | void DateBook::slotNewEntry(const QDateTime &start, const QDateTime &end, const QString &str, const QString &location) { |
828 | // argh! This really needs to be encapsulated in a class | 862 | // argh! This really needs to be encapsulated in a class |
829 | // or function. | 863 | // or function. |
830 | QDialog newDlg( this, 0, TRUE ); | 864 | QDialog newDlg( this, 0, TRUE ); |
831 | newDlg.setCaption( DateEntryBase::tr("New Event") ); | 865 | newDlg.setCaption( DateEntryBase::tr("New Event") ); |
832 | DateEntry *e; | 866 | DateEntry *e; |
833 | QVBoxLayout *vb = new QVBoxLayout( &newDlg ); | 867 | QVBoxLayout *vb = new QVBoxLayout( &newDlg ); |
834 | QScrollView *sv = new QScrollView( &newDlg ); | 868 | QScrollView *sv = new QScrollView( &newDlg ); |
835 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 869 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
836 | sv->setFrameStyle( QFrame::NoFrame ); | 870 | sv->setFrameStyle( QFrame::NoFrame ); |
837 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 871 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
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) { |
844 | ev.setLocation( tr("(Unknown)") ); | 878 | if(defaultLocation.isEmpty()) { |
879 | ev.setLocation(tr("(Unknown)")); | ||
880 | } else { | ||
881 | ev.setLocation( defaultLocation ); | ||
882 | } | ||
845 | } else { | 883 | } else { |
846 | ev.setLocation(location); | 884 | ev.setLocation(location); |
847 | } | 885 | } |
848 | ev.setStart( start ); | 886 | ev.setCategories(defaultCategories); |
849 | ev.setEnd( end ); | 887 | ev.setStart( start ); |
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 ); |
854 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 893 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
855 | newDlg.showMaximized(); | 894 | newDlg.showMaximized(); |
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 ) | 902 | continue; |
864 | continue; | 903 | } |
904 | db->addEvent( ev ); | ||
905 | emit newEvent(); | ||
906 | break; | ||
865 | } | 907 | } |
866 | db->addEvent( ev ); | ||
867 | emit newEvent(); | ||
868 | break; | ||
869 | } | ||
870 | } | 908 | } |
871 | 909 | ||
872 | void DateBook::setDocument( const QString &filename ) | 910 | void DateBook::setDocument( const QString &filename ) |
873 | { | 911 | { |
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 | |||
@@ -107,27 +107,29 @@ private: | |||
107 | void loadSettings(); | 107 | void loadSettings(); |
108 | void saveSettings(); | 108 | void saveSettings(); |
109 | 109 | ||
110 | private: | 110 | private: |
111 | DateBookDBHack *db; | 111 | DateBookDBHack *db; |
112 | QWidgetStack *views; | 112 | QWidgetStack *views; |
113 | DateBookDay *dayView; | 113 | DateBookDay *dayView; |
114 | DateBookWeek *weekView; | 114 | DateBookWeek *weekView; |
115 | DateBookMonth *monthView; | 115 | DateBookMonth *monthView; |
116 | DateBookWeekLst *weekLstView; | 116 | DateBookWeekLst *weekLstView; |
117 | QAction *dayAction, *weekAction, *weekLstAction, *monthAction; | 117 | QAction *dayAction, *weekAction, *weekLstAction, *monthAction; |
118 | int weeklistviewconfig; | 118 | int weeklistviewconfig; |
119 | bool aPreset; // have everything set to alarm? | 119 | bool aPreset; // have everything set to alarm? |
120 | int presetTime; // the standard time for the alarm | 120 | int presetTime; // the standard time for the alarm |
121 | int startTime; | 121 | int startTime; |
122 | int rowStyle; | 122 | int rowStyle; |
123 | int defaultView; | 123 | int defaultView; |
124 | QArray<int> defaultCategories; | ||
125 | QString defaultLocation; | ||
124 | bool bJumpToCurTime; //should jump to current time in dayview? | 126 | bool bJumpToCurTime; //should jump to current time in dayview? |
125 | bool ampm; | 127 | bool ampm; |
126 | bool onMonday; | 128 | bool onMonday; |
127 | 129 | ||
128 | bool syncing; | 130 | bool syncing; |
129 | bool inSearch; | 131 | bool inSearch; |
130 | 132 | ||
131 | int alarmCounter; | 133 | int alarmCounter; |
132 | 134 | ||
133 | QString checkEvent(const Event &); | 135 | QString checkEvent(const Event &); |
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 | |||
@@ -30,11 +30,12 @@ DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, | |||
30 | const char *name, bool modal, WFlags fl ) | 30 | const char *name, bool modal, WFlags fl ) |
31 | : DateBookSettingsBase( parent, name, modal, fl ), | 31 | : DateBookSettingsBase( parent, name, modal, fl ), |
32 | ampm( whichClock ) | 32 | ampm( whichClock ) |
33 | { | 33 | { |
34 | init(); | 34 | init(); |
35 | QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), | 35 | QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), this, SLOT( slotChangeClock( bool ) ) ); |
36 | this, SLOT( slotChangeClock( bool ) ) ); | 36 | QArray<int> categories; |
37 | comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); | ||
37 | } | 38 | } |
38 | 39 | ||
39 | DateBookSettings::~DateBookSettings() | 40 | DateBookSettings::~DateBookSettings() |
40 | { | 41 | { |
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 | |||
@@ -20,8 +20,9 @@ | |||
20 | 20 | ||
21 | #ifndef DATEBOOKSETTINGS_H | 21 | #ifndef DATEBOOKSETTINGS_H |
22 | #define DATEBOOKSETTINGS_H | 22 | #define DATEBOOKSETTINGS_H |
23 | #include "datebooksettingsbase.h" | 23 | #include "datebooksettingsbase.h" |
24 | #include <qpe/categoryselect.h> | ||
24 | 25 | ||
25 | class DateBookSettings : public DateBookSettingsBase | 26 | class DateBookSettings : public DateBookSettingsBase |
26 | { | 27 | { |
27 | public: | 28 | public: |
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 | |||
@@ -32,9 +32,9 @@ | |||
32 | <rect> | 32 | <rect> |
33 | <x>0</x> | 33 | <x>0</x> |
34 | <y>0</y> | 34 | <y>0</y> |
35 | <width>273</width> | 35 | <width>273</width> |
36 | <height>303</height> | 36 | <height>340</height> |
37 | </rect> | 37 | </rect> |
38 | </property> | 38 | </property> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>caption</name> | 40 | <name>caption</name> |
@@ -529,34 +529,171 @@ | |||
529 | </hbox> | 529 | </hbox> |
530 | </widget> | 530 | </widget> |
531 | </vbox> | 531 | </vbox> |
532 | </widget> | 532 | </widget> |
533 | <spacer> | 533 | <widget> |
534 | <property> | 534 | <class>QGroupBox</class> |
535 | <name>name</name> | ||
536 | <cstring>Spacer9</cstring> | ||
537 | </property> | ||
538 | <property stdset="1"> | 535 | <property stdset="1"> |
539 | <name>orientation</name> | 536 | <name>name</name> |
540 | <enum>Vertical</enum> | 537 | <cstring>GroupBox5_2_2</cstring> |
541 | </property> | 538 | </property> |
542 | <property stdset="1"> | 539 | <property stdset="1"> |
543 | <name>sizeType</name> | 540 | <name>title</name> |
544 | <enum>Expanding</enum> | 541 | <string>Defaults</string> |
545 | </property> | ||
546 | <property> | ||
547 | <name>sizeHint</name> | ||
548 | <size> | ||
549 | <width>20</width> | ||
550 | <height>20</height> | ||
551 | </size> | ||
552 | </property> | 542 | </property> |
553 | </spacer> | 543 | <vbox> |
544 | <property stdset="1"> | ||
545 | <name>margin</name> | ||
546 | <number>11</number> | ||
547 | </property> | ||
548 | <property stdset="1"> | ||
549 | <name>spacing</name> | ||
550 | <number>6</number> | ||
551 | </property> | ||
552 | <widget> | ||
553 | <class>QLayoutWidget</class> | ||
554 | <property stdset="1"> | ||
555 | <name>name</name> | ||
556 | <cstring>Layout6_2</cstring> | ||
557 | </property> | ||
558 | <hbox> | ||
559 | <property stdset="1"> | ||
560 | <name>margin</name> | ||
561 | <number>0</number> | ||
562 | </property> | ||
563 | <property stdset="1"> | ||
564 | <name>spacing</name> | ||
565 | <number>6</number> | ||
566 | </property> | ||
567 | <widget> | ||
568 | <class>QLabel</class> | ||
569 | <property stdset="1"> | ||
570 | <name>name</name> | ||
571 | <cstring>TextLabel2_2_3</cstring> | ||
572 | </property> | ||
573 | <property stdset="1"> | ||
574 | <name>frameShape</name> | ||
575 | <enum>MShape</enum> | ||
576 | </property> | ||
577 | <property stdset="1"> | ||
578 | <name>frameShadow</name> | ||
579 | <enum>MShadow</enum> | ||
580 | </property> | ||
581 | <property stdset="1"> | ||
582 | <name>text</name> | ||
583 | <string>Location:</string> | ||
584 | </property> | ||
585 | </widget> | ||
586 | <widget> | ||
587 | <class>QComboBox</class> | ||
588 | <item> | ||
589 | <property> | ||
590 | <name>text</name> | ||
591 | <string></string> | ||
592 | </property> | ||
593 | </item> | ||
594 | <item> | ||
595 | <property> | ||
596 | <name>text</name> | ||
597 | <string>Office</string> | ||
598 | </property> | ||
599 | </item> | ||
600 | <item> | ||
601 | <property> | ||
602 | <name>text</name> | ||
603 | <string>Home</string> | ||
604 | </property> | ||
605 | </item> | ||
606 | <property stdset="1"> | ||
607 | <name>name</name> | ||
608 | <cstring>comboLocation</cstring> | ||
609 | </property> | ||
610 | <property stdset="1"> | ||
611 | <name>sizePolicy</name> | ||
612 | <sizepolicy> | ||
613 | <hsizetype>7</hsizetype> | ||
614 | <vsizetype>0</vsizetype> | ||
615 | </sizepolicy> | ||
616 | </property> | ||
617 | <property stdset="1"> | ||
618 | <name>editable</name> | ||
619 | <bool>true</bool> | ||
620 | </property> | ||
621 | <property stdset="1"> | ||
622 | <name>currentItem</name> | ||
623 | <number>0</number> | ||
624 | </property> | ||
625 | <property stdset="1"> | ||
626 | <name>duplicatesEnabled</name> | ||
627 | <bool>false</bool> | ||
628 | </property> | ||
629 | </widget> | ||
630 | </hbox> | ||
631 | </widget> | ||
632 | <widget> | ||
633 | <class>QLayoutWidget</class> | ||
634 | <property stdset="1"> | ||
635 | <name>name</name> | ||
636 | <cstring>Layout7_2</cstring> | ||
637 | </property> | ||
638 | <hbox> | ||
639 | <property stdset="1"> | ||
640 | <name>margin</name> | ||
641 | <number>0</number> | ||
642 | </property> | ||
643 | <property stdset="1"> | ||
644 | <name>spacing</name> | ||
645 | <number>6</number> | ||
646 | </property> | ||
647 | <widget> | ||
648 | <class>QLabel</class> | ||
649 | <property stdset="1"> | ||
650 | <name>name</name> | ||
651 | <cstring>TextLabel2_2_2_2</cstring> | ||
652 | </property> | ||
653 | <property stdset="1"> | ||
654 | <name>text</name> | ||
655 | <string>Category:</string> | ||
656 | </property> | ||
657 | </widget> | ||
658 | <widget> | ||
659 | <class>CategorySelect</class> | ||
660 | <property stdset="1"> | ||
661 | <name>name</name> | ||
662 | <cstring>comboCategory</cstring> | ||
663 | </property> | ||
664 | </widget> | ||
665 | </hbox> | ||
666 | </widget> | ||
667 | </vbox> | ||
668 | </widget> | ||
554 | </vbox> | 669 | </vbox> |
555 | </widget> | 670 | </widget> |
556 | </widget> | 671 | </widget> |
557 | </vbox> | 672 | </vbox> |
558 | </widget> | 673 | </widget> |
674 | <customwidgets> | ||
675 | <customwidget> | ||
676 | <class>CategorySelect</class> | ||
677 | <header location="global">qpe/categoryselect.h</header> | ||
678 | <sizehint> | ||
679 | <width>-1</width> | ||
680 | <height>-1</height> | ||
681 | </sizehint> | ||
682 | <container>0</container> | ||
683 | <sizepolicy> | ||
684 | <hordata>7</hordata> | ||
685 | <verdata>1</verdata> | ||
686 | </sizepolicy> | ||
687 | <pixmap>image0</pixmap> | ||
688 | </customwidget> | ||
689 | </customwidgets> | ||
690 | <images> | ||
691 | <image> | ||
692 | <name>image0</name> | ||
693 | <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> | ||
694 | </image> | ||
695 | </images> | ||
559 | <connections> | 696 | <connections> |
560 | <connection> | 697 | <connection> |
561 | <sender>chkAlarmPreset</sender> | 698 | <sender>chkAlarmPreset</sender> |
562 | <signal>toggled(bool)</signal> | 699 | <signal>toggled(bool)</signal> |