-rw-r--r-- | core/pim/datebook/datebook.cpp | 50 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 7 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.cpp | 2 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.cpp | 124 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.h | 18 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettingsbase.ui | 59 | ||||
-rw-r--r-- | core/pim/datebook/datebooktypes.h | 7 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 5 |
8 files changed, 188 insertions, 84 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index a7f6691..8ae4f84 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -248,2 +248,3 @@ void DateBook::slotSettings() | |||
248 | frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); | 248 | frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); |
249 | frmSettings.setPluginList(db_holiday->pluginManager(),db_holiday->pluginLoader()); | ||
249 | 250 | ||
@@ -264,2 +265,5 @@ void DateBook::slotSettings() | |||
264 | if ( QPEApplication::execDialog( &frmSettings ) ) { | 265 | if ( QPEApplication::execDialog( &frmSettings ) ) { |
266 | db_holiday->pluginManager()->save(); | ||
267 | db_holiday->reloadPlugins(); | ||
268 | |||
265 | aPreset = frmSettings.alarmPreset(); | 269 | aPreset = frmSettings.alarmPreset(); |
@@ -1091,2 +1095,11 @@ DateBookHoliday::DateBookHoliday() | |||
1091 | m_pluginLoader->setAutoDelete(true); | 1095 | m_pluginLoader->setAutoDelete(true); |
1096 | m_pluginManager = new Opie::Core::OPluginManager(m_pluginLoader); | ||
1097 | m_pluginManager->load(); | ||
1098 | |||
1099 | init(); | ||
1100 | } | ||
1101 | |||
1102 | void DateBookHoliday::reloadPlugins() | ||
1103 | { | ||
1104 | deinit(); | ||
1092 | init(); | 1105 | init(); |
@@ -1098,2 +1111,3 @@ DateBookHoliday::~DateBookHoliday() | |||
1098 | delete m_pluginLoader; | 1111 | delete m_pluginLoader; |
1112 | delete m_pluginManager; | ||
1099 | } | 1113 | } |
@@ -1102,3 +1116,2 @@ void DateBookHoliday::deinit() | |||
1102 | { | 1116 | { |
1103 | /* | ||
1104 | QValueList<HPlugin*>::Iterator it; | 1117 | QValueList<HPlugin*>::Iterator it; |
@@ -1106,6 +1119,3 @@ void DateBookHoliday::deinit() | |||
1106 | HPlugin*_pl = *it; | 1119 | HPlugin*_pl = *it; |
1107 | // destructs itself? | 1120 | *it = 0; |
1108 | _pl->_if->release(); | ||
1109 | _pl->_lib->unload(); | ||
1110 | delete _pl->_lib; | ||
1111 | delete _pl; | 1121 | delete _pl; |
@@ -1113,3 +1123,2 @@ void DateBookHoliday::deinit() | |||
1113 | _pluginlist.clear(); | 1123 | _pluginlist.clear(); |
1114 | */ | ||
1115 | } | 1124 | } |
@@ -1125,6 +1134,5 @@ void DateBookHoliday::init() | |||
1125 | { | 1134 | { |
1126 | #if 0 | ||
1127 | deinit(); | 1135 | deinit(); |
1128 | #endif | 1136 | |
1129 | Opie::Core::OPluginItem::List lst = m_pluginLoader->allAvailable( false ); | 1137 | Opie::Core::OPluginItem::List lst = m_pluginLoader->filtered(true); |
1130 | // debugLst( lst ); | 1138 | // debugLst( lst ); |
@@ -1143,26 +1151,2 @@ void DateBookHoliday::init() | |||
1143 | } | 1151 | } |
1144 | #if 0 | ||
1145 | QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday"; | ||
1146 | QDir dir( path, "lib*.so" ); | ||
1147 | QStringList list = dir.entryList(); | ||
1148 | QStringList::Iterator it; | ||
1149 | for (it=list.begin();it!=list.end();++it) { | ||
1150 | Opie::Datebook::HolidayPluginIf*hif = 0; | ||
1151 | QLibrary*lib=new QLibrary(path+"/"+*it); | ||
1152 | if ((lib->queryInterface(IID_HOLIDAY_PLUGIN,(QUnknownInterface**)&hif) == QS_OK) && hif) { | ||
1153 | Opie::Datebook::HolidayPlugin*pl = hif->plugin(); | ||
1154 | if (pl) { | ||
1155 | HPlugin*_pl=new HPlugin; | ||
1156 | _pl->_plugin = pl; | ||
1157 | odebug << "Found holiday " << pl->description()<<oendl; | ||
1158 | _pl->_lib = lib; | ||
1159 | _pl->_if = hif; | ||
1160 | _pluginlist.append(_pl); | ||
1161 | } else { | ||
1162 | } | ||
1163 | } else { | ||
1164 | delete lib; | ||
1165 | } | ||
1166 | } | ||
1167 | #endif | ||
1168 | } | 1152 | } |
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 00ddd05..26f0303 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -365,6 +365,7 @@ void DateBookDay::getEvents() | |||
365 | QObject* object = 0; | 365 | QObject* object = 0; |
366 | |||
367 | /* this way we make sure that holiday dummy events are always | ||
368 | on top of the widgetlist. */ | ||
366 | for (sit=hdays.begin();sit!=hdays.end();++sit) { | 369 | for (sit=hdays.begin();sit!=hdays.end();++sit) { |
367 | object = m_allDays->addHoliday(*sit); | 370 | m_allDays->addHoliday(*sit); |
368 | if (!object) continue; | ||
369 | /* not to do something with it */ | ||
370 | } | 371 | } |
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp index 5b40246..27fce44 100644 --- a/core/pim/datebook/datebookdayallday.cpp +++ b/core/pim/datebook/datebookdayallday.cpp | |||
@@ -194,3 +194,3 @@ void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) | |||
194 | QPopupMenu m; | 194 | QPopupMenu m; |
195 | if (!m_holiday) { | 195 | if (ev.isValidUid()) { |
196 | m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); | 196 | m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); |
diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp index cb4b73b..861e266 100644 --- a/core/pim/datebook/datebooksettings.cpp +++ b/core/pim/datebook/datebooksettings.cpp | |||
@@ -22,2 +22,5 @@ | |||
22 | 22 | ||
23 | #include <opie2/opluginloader.h> | ||
24 | #include <opie2/odebug.h> | ||
25 | |||
23 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
@@ -26,2 +29,4 @@ | |||
26 | #include <qcheckbox.h> | 29 | #include <qcheckbox.h> |
30 | #include <qlistview.h> | ||
31 | #include <qheader.h> | ||
27 | 32 | ||
@@ -32,6 +37,10 @@ DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, | |||
32 | { | 37 | { |
33 | init(); | 38 | init(); |
34 | QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) ); | 39 | QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) ); |
35 | QArray<int> categories; | 40 | QArray<int> categories; |
36 | comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); | 41 | comboCategory->setCategories( categories, "Calendar", tr("Calendar") ); |
42 | m_loader = 0; | ||
43 | m_manager = 0; | ||
44 | m_PluginListView->header()->hide(); | ||
45 | m_PluginListView->setSorting(-1); | ||
37 | } | 46 | } |
@@ -45,13 +54,13 @@ void DateBookSettings::setStartTime( int newStartViewTime ) | |||
45 | if ( ampm ) { | 54 | if ( ampm ) { |
46 | if ( newStartViewTime >= 12 ) { | 55 | if ( newStartViewTime >= 12 ) { |
47 | newStartViewTime %= 12; | 56 | newStartViewTime %= 12; |
48 | if ( newStartViewTime == 0 ) | 57 | if ( newStartViewTime == 0 ) |
49 | newStartViewTime = 12; | 58 | newStartViewTime = 12; |
50 | spinStart->setSuffix( tr(":00 PM") ); | 59 | spinStart->setSuffix( tr(":00 PM") ); |
51 | } | 60 | } |
52 | else if ( newStartViewTime == 0 ) { | 61 | else if ( newStartViewTime == 0 ) { |
53 | newStartViewTime = 12; | 62 | newStartViewTime = 12; |
54 | spinStart->setSuffix( tr(":00 AM") ); | 63 | spinStart->setSuffix( tr(":00 AM") ); |
55 | } | 64 | } |
56 | oldtime = newStartViewTime; | 65 | oldtime = newStartViewTime; |
57 | } | 66 | } |
@@ -64,6 +73,6 @@ int DateBookSettings::startTime() const | |||
64 | if ( ampm ) { | 73 | if ( ampm ) { |
65 | if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) ) | 74 | if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) ) |
66 | returnMe += 12; | 75 | returnMe += 12; |
67 | else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE)) | 76 | else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE)) |
68 | returnMe = 0; | 77 | returnMe = 0; |
69 | } | 78 | } |
@@ -72,2 +81,29 @@ int DateBookSettings::startTime() const | |||
72 | 81 | ||
82 | void DateBookSettings::setPluginList(Opie::Core::OPluginManager*aManager,Opie::Core::OPluginLoader*aLoader) | ||
83 | { | ||
84 | m_manager = aManager; | ||
85 | m_loader = aLoader; | ||
86 | if (!aManager||!aLoader) return; | ||
87 | Opie::Core::OPluginItem::List inLst = m_loader->allAvailable(true); | ||
88 | QCheckListItem *pitem = 0; | ||
89 | |||
90 | for ( Opie::Core::OPluginItem::List::Iterator it = inLst.begin(); it != inLst.end(); ++it ) { | ||
91 | pitem = new QCheckListItem(m_PluginListView,(*it).name(),QCheckListItem::CheckBox); | ||
92 | pitem->setOn( (*it).isEnabled() ); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | void DateBookSettings::pluginItemClicked(QListViewItem *aItem) | ||
97 | { | ||
98 | if (!aItem||!m_manager||!m_loader) return; | ||
99 | QCheckListItem*pitem = ((QCheckListItem*)aItem); | ||
100 | |||
101 | Opie::Core::OPluginItem::List lst = m_loader->allAvailable( true ); | ||
102 | for ( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | ||
103 | if ( QString::compare( (*it).name() , pitem->text(0) ) == 0 ) { | ||
104 | m_manager->setEnabled((*it),pitem->isOn()); | ||
105 | break; | ||
106 | } | ||
107 | } | ||
108 | } | ||
73 | 109 | ||
@@ -77,3 +113,3 @@ void DateBookSettings::setAlarmPreset( bool bAlarm, int presetTime ) | |||
77 | if ( presetTime >=5 ) | 113 | if ( presetTime >=5 ) |
78 | spinPreset->setValue( presetTime ); | 114 | spinPreset->setValue( presetTime ); |
79 | } | 115 | } |
@@ -94,10 +130,10 @@ void DateBookSettings::slot12Hour( int i ) | |||
94 | if ( ampm ) { | 130 | if ( ampm ) { |
95 | if ( spinStart->suffix().contains( tr("AM"), FALSE ) ) { | 131 | if ( spinStart->suffix().contains( tr("AM"), FALSE ) ) { |
96 | if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 ) | 132 | if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 ) |
97 | spinStart->setSuffix( tr(":00 PM") ); | 133 | spinStart->setSuffix( tr(":00 PM") ); |
98 | } else { | 134 | } else { |
99 | if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 ) | 135 | if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 ) |
100 | spinStart->setSuffix( tr(":00 AM") ); | 136 | spinStart->setSuffix( tr(":00 AM") ); |
101 | } | 137 | } |
102 | oldtime = i; | 138 | oldtime = i; |
103 | } | 139 | } |
@@ -108,11 +144,11 @@ void DateBookSettings::init() | |||
108 | if ( ampm ) { | 144 | if ( ampm ) { |
109 | spinStart->setMinValue( 1 ); | 145 | spinStart->setMinValue( 1 ); |
110 | spinStart->setMaxValue( 12 ); | 146 | spinStart->setMaxValue( 12 ); |
111 | spinStart->setValue( 12 ); | 147 | spinStart->setValue( 12 ); |
112 | spinStart->setSuffix( tr(":00 AM") ); | 148 | spinStart->setSuffix( tr(":00 AM") ); |
113 | oldtime = 12; | 149 | oldtime = 12; |
114 | } else { | 150 | } else { |
115 | spinStart->setMinValue( 0 ); | 151 | spinStart->setMinValue( 0 ); |
116 | spinStart->setMaxValue( 23 ); | 152 | spinStart->setMaxValue( 23 ); |
117 | spinStart->setSuffix( tr(":00") ); | 153 | spinStart->setSuffix( tr(":00") ); |
118 | } | 154 | } |
@@ -125,7 +161,7 @@ void DateBookSettings::slotChangeClock( bool whichClock ) | |||
125 | if ( ampm && spinStart->suffix().contains( tr("AM"), FALSE ) ) { | 161 | if ( ampm && spinStart->suffix().contains( tr("AM"), FALSE ) ) { |
126 | if ( saveMe == 12 ) | 162 | if ( saveMe == 12 ) |
127 | saveMe = 0; | 163 | saveMe = 0; |
128 | } else if ( ampm && spinStart->suffix().contains( tr("PM"), FALSE ) ) { | 164 | } else if ( ampm && spinStart->suffix().contains( tr("PM"), FALSE ) ) { |
129 | if ( saveMe != 12 ) | 165 | if ( saveMe != 12 ) |
130 | saveMe += 12; | 166 | saveMe += 12; |
131 | } | 167 | } |
@@ -138,3 +174,3 @@ void DateBookSettings::setJumpToCurTime( bool bJump ) | |||
138 | { | 174 | { |
139 | chkJumpToCurTime->setChecked( bJump ); | 175 | chkJumpToCurTime->setChecked( bJump ); |
140 | } | 176 | } |
@@ -143,3 +179,3 @@ bool DateBookSettings::jumpToCurTime() const | |||
143 | { | 179 | { |
144 | return chkJumpToCurTime->isChecked(); | 180 | return chkJumpToCurTime->isChecked(); |
145 | } | 181 | } |
@@ -148,3 +184,3 @@ void DateBookSettings::setRowStyle( int style ) | |||
148 | { | 184 | { |
149 | comboRowStyle->setCurrentItem( style ); | 185 | comboRowStyle->setCurrentItem( style ); |
150 | } | 186 | } |
@@ -153,3 +189,3 @@ int DateBookSettings::rowStyle() const | |||
153 | { | 189 | { |
154 | return comboRowStyle->currentItem(); | 190 | return comboRowStyle->currentItem(); |
155 | } | 191 | } |
diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h index cf8a0ff..df7d32c 100644 --- a/core/pim/datebook/datebooksettings.h +++ b/core/pim/datebook/datebooksettings.h | |||
@@ -25,2 +25,13 @@ | |||
25 | 25 | ||
26 | namespace Opie { | ||
27 | namespace Core { | ||
28 | class OPluginManager; | ||
29 | class OGenericPluginLoader; | ||
30 | class OPluginLoader; | ||
31 | } | ||
32 | namespace Ui { | ||
33 | class OPluginConfigWidget; | ||
34 | } | ||
35 | } | ||
36 | |||
26 | class DateBookSettings : public DateBookSettingsBase | 37 | class DateBookSettings : public DateBookSettingsBase |
@@ -45,2 +56,3 @@ public: | |||
45 | 56 | ||
57 | void setPluginList(Opie::Core::OPluginManager*,Opie::Core::OPluginLoader*); | ||
46 | private slots: | 58 | private slots: |
@@ -48,4 +60,6 @@ private slots: | |||
48 | void slotChangeClock( bool ); | 60 | void slotChangeClock( bool ); |
61 | protected slots: | ||
62 | virtual void pluginItemClicked(QListViewItem *); | ||
49 | 63 | ||
50 | private: | 64 | protected: |
51 | void init(); | 65 | void init(); |
@@ -53,2 +67,4 @@ private: | |||
53 | int oldtime; | 67 | int oldtime; |
68 | Opie::Core::OPluginManager*m_manager; | ||
69 | Opie::Core::OPluginLoader*m_loader; | ||
54 | }; | 70 | }; |
diff --git a/core/pim/datebook/datebooksettingsbase.ui b/core/pim/datebook/datebooksettingsbase.ui index e613db1..7b3e591 100644 --- a/core/pim/datebook/datebooksettingsbase.ui +++ b/core/pim/datebook/datebooksettingsbase.ui | |||
@@ -61,3 +61,9 @@ | |||
61 | <name>name</name> | 61 | <name>name</name> |
62 | <cstring>TabWidget2</cstring> | 62 | <cstring>TabWidget</cstring> |
63 | </property> | ||
64 | <property> | ||
65 | <name>layoutMargin</name> | ||
66 | </property> | ||
67 | <property> | ||
68 | <name>layoutSpacing</name> | ||
63 | </property> | 69 | </property> |
@@ -670,2 +676,44 @@ | |||
670 | </widget> | 676 | </widget> |
677 | <widget> | ||
678 | <class>QWidget</class> | ||
679 | <property stdset="1"> | ||
680 | <name>name</name> | ||
681 | <cstring>plugintab</cstring> | ||
682 | </property> | ||
683 | <attribute> | ||
684 | <name>title</name> | ||
685 | <string>Plugins</string> | ||
686 | </attribute> | ||
687 | <vbox> | ||
688 | <property stdset="1"> | ||
689 | <name>margin</name> | ||
690 | <number>2</number> | ||
691 | </property> | ||
692 | <property stdset="1"> | ||
693 | <name>spacing</name> | ||
694 | <number>2</number> | ||
695 | </property> | ||
696 | <widget> | ||
697 | <class>QListView</class> | ||
698 | <column> | ||
699 | <property> | ||
700 | <name>text</name> | ||
701 | <string>Pluginlist</string> | ||
702 | </property> | ||
703 | <property> | ||
704 | <name>clickable</name> | ||
705 | <bool>true</bool> | ||
706 | </property> | ||
707 | <property> | ||
708 | <name>resizeable</name> | ||
709 | <bool>true</bool> | ||
710 | </property> | ||
711 | </column> | ||
712 | <property stdset="1"> | ||
713 | <name>name</name> | ||
714 | <cstring>m_PluginListView</cstring> | ||
715 | </property> | ||
716 | </widget> | ||
717 | </vbox> | ||
718 | </widget> | ||
671 | </widget> | 719 | </widget> |
@@ -708,4 +756,11 @@ | |||
708 | </connection> | 756 | </connection> |
709 | <slot access="public">slotChangeClock( bool )</slot> | 757 | <connection> |
758 | <sender>m_PluginListView</sender> | ||
759 | <signal>clicked(QListViewItem*)</signal> | ||
760 | <receiver>DateBookSettingsBase</receiver> | ||
761 | <slot>pluginItemClicked(QListViewItem *)</slot> | ||
762 | </connection> | ||
763 | <slot access="protected">pluginItemClicked(QListViewItem *)</slot> | ||
710 | <slot access="public">slot12Hour( int )</slot> | 764 | <slot access="public">slot12Hour( int )</slot> |
765 | <slot access="public">slotChangeClock( bool )</slot> | ||
711 | </connections> | 766 | </connections> |
diff --git a/core/pim/datebook/datebooktypes.h b/core/pim/datebook/datebooktypes.h index f944e84..2966814 100644 --- a/core/pim/datebook/datebooktypes.h +++ b/core/pim/datebook/datebooktypes.h | |||
@@ -15,2 +15,3 @@ namespace Core { | |||
15 | class OPluginLoader; | 15 | class OPluginLoader; |
16 | class OPluginManager; | ||
16 | } | 17 | } |
@@ -37,2 +38,7 @@ public: | |||
37 | 38 | ||
39 | void reloadPlugins(); | ||
40 | |||
41 | Opie::Core::OPluginLoader*pluginLoader(){return m_pluginLoader;} | ||
42 | Opie::Core::OPluginManager*pluginManager(){return m_pluginManager;} | ||
43 | |||
38 | protected: | 44 | protected: |
@@ -48,2 +54,3 @@ protected: | |||
48 | Opie::Core::OPluginLoader*m_pluginLoader; | 54 | Opie::Core::OPluginLoader*m_pluginLoader; |
55 | Opie::Core::OPluginManager*m_pluginManager; | ||
49 | }; | 56 | }; |
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index b0e78f1..3c871ea 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -217,3 +217,8 @@ void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) | |||
217 | { | 217 | { |
218 | if (!event.event().isValidUid()) { | ||
219 | // this is just such a holiday event. | ||
220 | return; | ||
221 | } | ||
218 | popmenue = new QPopupMenu; | 222 | popmenue = new QPopupMenu; |
223 | |||
219 | popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); | 224 | popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe())); |