author | alwin <alwin> | 2005-03-18 12:49:14 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-18 12:49:14 (UTC) |
commit | b7996a25adab32e6f2e4d278a9d9801ad66f90c7 (patch) (unidiff) | |
tree | f90bf3aa5cd274c467a8ff3e84566fdfa6a1a6c5 /core/pim | |
parent | d7fdcc3dac4a1d8cbd823d17ea52d17cb67b16f8 (diff) | |
download | opie-b7996a25adab32e6f2e4d278a9d9801ad66f90c7.zip opie-b7996a25adab32e6f2e4d278a9d9801ad66f90c7.tar.gz opie-b7996a25adab32e6f2e4d278a9d9801ad66f90c7.tar.bz2 |
made plugins configureable, eg, if them will load or not (or switch on/off
at runtime)
events generated from plugins will not editable and so on (check for a
wrong Uid) so them are just text inside datebook.
-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 | 36 | ||||
-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, 144 insertions, 40 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 | |||
@@ -237,40 +237,44 @@ DateBook::~DateBook() | |||
237 | delete db_holiday; | 237 | delete db_holiday; |
238 | } | 238 | } |
239 | 239 | ||
240 | void DateBook::slotSettings() | 240 | void DateBook::slotSettings() |
241 | { | 241 | { |
242 | DateBookSettings frmSettings( ampm, this ); | 242 | DateBookSettings frmSettings( ampm, this ); |
243 | frmSettings.setStartTime( startTime ); | 243 | frmSettings.setStartTime( startTime ); |
244 | frmSettings.setAlarmPreset( aPreset, presetTime ); | 244 | frmSettings.setAlarmPreset( aPreset, presetTime ); |
245 | frmSettings.setJumpToCurTime( bJumpToCurTime ); | 245 | frmSettings.setJumpToCurTime( bJumpToCurTime ); |
246 | frmSettings.setRowStyle( rowStyle ); | 246 | frmSettings.setRowStyle( rowStyle ); |
247 | frmSettings.comboDefaultView->setCurrentItem(defaultView-1); | 247 | frmSettings.comboDefaultView->setCurrentItem(defaultView-1); |
248 | frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); | 248 | frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); |
249 | frmSettings.setPluginList(db_holiday->pluginManager(),db_holiday->pluginLoader()); | ||
249 | 250 | ||
250 | bool found=false; | 251 | bool found=false; |
251 | for (int i=0; i<(frmSettings.comboLocation->count()); i++) { | 252 | for (int i=0; i<(frmSettings.comboLocation->count()); i++) { |
252 | if ( frmSettings.comboLocation->text(i) == defaultLocation ) { | 253 | if ( frmSettings.comboLocation->text(i) == defaultLocation ) { |
253 | frmSettings.comboLocation->setCurrentItem(i); | 254 | frmSettings.comboLocation->setCurrentItem(i); |
254 | found=true; | 255 | found=true; |
255 | break; | 256 | break; |
256 | } | 257 | } |
257 | } | 258 | } |
258 | if(!found) { | 259 | if(!found) { |
259 | frmSettings.comboLocation->insertItem(defaultLocation); | 260 | frmSettings.comboLocation->insertItem(defaultLocation); |
260 | frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1); | 261 | frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1); |
261 | } | 262 | } |
262 | frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar")); | 263 | frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar")); |
263 | 264 | ||
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(); |
266 | presetTime = frmSettings.presetTime(); | 270 | presetTime = frmSettings.presetTime(); |
267 | startTime = frmSettings.startTime(); | 271 | startTime = frmSettings.startTime(); |
268 | bJumpToCurTime = frmSettings.jumpToCurTime(); | 272 | bJumpToCurTime = frmSettings.jumpToCurTime(); |
269 | rowStyle = frmSettings.rowStyle(); | 273 | rowStyle = frmSettings.rowStyle(); |
270 | defaultView=frmSettings.comboDefaultView->currentItem()+1; | 274 | defaultView=frmSettings.comboDefaultView->currentItem()+1; |
271 | weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); | 275 | weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); |
272 | defaultLocation=frmSettings.comboLocation->currentText(); | 276 | defaultLocation=frmSettings.comboLocation->currentText(); |
273 | defaultCategories=frmSettings.comboCategory->currentCategories(); | 277 | defaultCategories=frmSettings.comboCategory->currentCategories(); |
274 | 278 | ||
275 | if ( dayView ) { | 279 | if ( dayView ) { |
276 | dayView->setStartViewTime( startTime ); | 280 | dayView->setStartViewTime( startTime ); |
@@ -1080,100 +1084,80 @@ Event DateBookDBHack::eventByUID(int uid) { | |||
1080 | if ((*it).uid() == uid) return *it; | 1084 | if ((*it).uid() == uid) return *it; |
1081 | } | 1085 | } |
1082 | 1086 | ||
1083 | Event ev; | 1087 | Event ev; |
1084 | return ev; // return at least | 1088 | return ev; // return at least |
1085 | } | 1089 | } |
1086 | 1090 | ||
1087 | DateBookHoliday::DateBookHoliday() | 1091 | DateBookHoliday::DateBookHoliday() |
1088 | { | 1092 | { |
1089 | _pluginlist.clear(); | 1093 | _pluginlist.clear(); |
1090 | m_pluginLoader = new Opie::Core::OPluginLoader("holidays",false); | 1094 | m_pluginLoader = new Opie::Core::OPluginLoader("holidays",false); |
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(); |
1093 | } | 1106 | } |
1094 | 1107 | ||
1095 | DateBookHoliday::~DateBookHoliday() | 1108 | DateBookHoliday::~DateBookHoliday() |
1096 | { | 1109 | { |
1097 | deinit(); | 1110 | deinit(); |
1098 | delete m_pluginLoader; | 1111 | delete m_pluginLoader; |
1112 | delete m_pluginManager; | ||
1099 | } | 1113 | } |
1100 | 1114 | ||
1101 | void DateBookHoliday::deinit() | 1115 | void DateBookHoliday::deinit() |
1102 | { | 1116 | { |
1103 | /* | ||
1104 | QValueList<HPlugin*>::Iterator it; | 1117 | QValueList<HPlugin*>::Iterator it; |
1105 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { | 1118 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { |
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; |
1112 | } | 1122 | } |
1113 | _pluginlist.clear(); | 1123 | _pluginlist.clear(); |
1114 | */ | ||
1115 | } | 1124 | } |
1116 | 1125 | ||
1117 | #if 0 | 1126 | #if 0 |
1118 | void debugLst( const Opie::Core::OPluginItem::List& lst ) { | 1127 | void debugLst( const Opie::Core::OPluginItem::List& lst ) { |
1119 | for ( Opie::Core::OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it ) | 1128 | for ( Opie::Core::OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it ) |
1120 | odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl; | 1129 | odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl; |
1121 | } | 1130 | } |
1122 | #endif | 1131 | #endif |
1123 | 1132 | ||
1124 | void DateBookHoliday::init() | 1133 | 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 ); |
1131 | for( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){ | 1139 | for( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){ |
1132 | Opie::Datebook::HolidayPluginIf*hif = m_pluginLoader->load<Opie::Datebook::HolidayPluginIf>(*it,IID_HOLIDAY_PLUGIN); | 1140 | Opie::Datebook::HolidayPluginIf*hif = m_pluginLoader->load<Opie::Datebook::HolidayPluginIf>(*it,IID_HOLIDAY_PLUGIN); |
1133 | if (hif) { | 1141 | if (hif) { |
1134 | Opie::Datebook::HolidayPlugin*pl = hif->plugin(); | 1142 | Opie::Datebook::HolidayPlugin*pl = hif->plugin(); |
1135 | if (pl) { | 1143 | if (pl) { |
1136 | HPlugin*_pl=new HPlugin; | 1144 | HPlugin*_pl=new HPlugin; |
1137 | _pl->_plugin = pl; | 1145 | _pl->_plugin = pl; |
1138 | odebug << "Found holiday " << pl->description()<<oendl; | 1146 | odebug << "Found holiday " << pl->description()<<oendl; |
1139 | _pluginlist.append(_pl); | 1147 | _pluginlist.append(_pl); |
1140 | //_pl->_if = hif; | 1148 | //_pl->_if = hif; |
1141 | } | 1149 | } |
1142 | } | 1150 | } |
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 | } |
1169 | 1153 | ||
1170 | QStringList DateBookHoliday::holidaylist(const QDate&aDate) | 1154 | QStringList DateBookHoliday::holidaylist(const QDate&aDate) |
1171 | { | 1155 | { |
1172 | QStringList ret; | 1156 | QStringList ret; |
1173 | QValueList<HPlugin*>::Iterator it; | 1157 | QValueList<HPlugin*>::Iterator it; |
1174 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { | 1158 | for (it=_pluginlist.begin();it!=_pluginlist.end();++it) { |
1175 | HPlugin*_pl = *it; | 1159 | HPlugin*_pl = *it; |
1176 | ret+=_pl->_plugin->entries(aDate); | 1160 | ret+=_pl->_plugin->entries(aDate); |
1177 | } | 1161 | } |
1178 | return ret; | 1162 | return ret; |
1179 | } | 1163 | } |
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 | |||
@@ -354,28 +354,29 @@ void DateBookDay::redraw() | |||
354 | 354 | ||
355 | void DateBookDay::getEvents() | 355 | void DateBookDay::getEvents() |
356 | { | 356 | { |
357 | widgetList.clear(); | 357 | widgetList.clear(); |
358 | 358 | ||
359 | /* clear the AllDay List */ | 359 | /* clear the AllDay List */ |
360 | m_allDays->hide(); // just in case | 360 | m_allDays->hide(); // just in case |
361 | m_allDays->removeAllEvents(); | 361 | m_allDays->removeAllEvents(); |
362 | 362 | ||
363 | QStringList hdays = _holiday_db->holidaylist(currDate); | 363 | QStringList hdays = _holiday_db->holidaylist(currDate); |
364 | QStringList::Iterator sit; | 364 | QStringList::Iterator sit; |
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 | } |
371 | QValueList<EffectiveEvent> eventList = db->getEffectiveEventsNoHoliday( currDate, currDate ); | 372 | QValueList<EffectiveEvent> eventList = db->getEffectiveEventsNoHoliday( currDate, currDate ); |
372 | QValueListIterator<EffectiveEvent> it; | 373 | QValueListIterator<EffectiveEvent> it; |
373 | 374 | ||
374 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { | 375 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { |
375 | EffectiveEvent ev=*it; | 376 | EffectiveEvent ev=*it; |
376 | if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) { // Skip events ending at 00:00 starting at another day. | 377 | if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) { // Skip events ending at 00:00 starting at another day. |
377 | if (ev.event().type() == Event::AllDay ) { | 378 | if (ev.event().type() == Event::AllDay ) { |
378 | object = m_allDays->addEvent( ev ); | 379 | object = m_allDays->addEvent( ev ); |
379 | if (!object) | 380 | if (!object) |
380 | continue; | 381 | continue; |
381 | }else { | 382 | }else { |
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 | |||
@@ -183,25 +183,25 @@ void DatebookAlldayDisp::beam_single_event() | |||
183 | m_Event.setEnd ( end ); | 183 | m_Event.setEnd ( end ); |
184 | emit beamMe( m_Event ); | 184 | emit beamMe( m_Event ); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) | 188 | void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) |
189 | { | 189 | { |
190 | Event ev = m_Ev.event(); | 190 | Event ev = m_Ev.event(); |
191 | QColor b = backgroundColor(); | 191 | QColor b = backgroundColor(); |
192 | setBackgroundColor(green); | 192 | setBackgroundColor(green); |
193 | update(); | 193 | update(); |
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 ); |
197 | m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 ); | 197 | m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 ); |
198 | m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 ); | 198 | m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 ); |
199 | if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 ); | 199 | if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 ); |
200 | if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 ); | 200 | if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 ); |
201 | } | 201 | } |
202 | m.insertItem( tr( "Info"),6); | 202 | m.insertItem( tr( "Info"),6); |
203 | int r = m.exec( e->globalPos() ); | 203 | int r = m.exec( e->globalPos() ); |
204 | setBackgroundColor(b); | 204 | setBackgroundColor(b); |
205 | update(); | 205 | update(); |
206 | switch (r) { | 206 | switch (r) { |
207 | case 1: | 207 | case 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 | |||
@@ -11,38 +11,47 @@ | |||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "datebooksettings.h" | 21 | #include "datebooksettings.h" |
22 | 22 | ||
23 | #include <opie2/opluginloader.h> | ||
24 | #include <opie2/odebug.h> | ||
25 | |||
23 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
24 | 27 | ||
25 | #include <qspinbox.h> | 28 | #include <qspinbox.h> |
26 | #include <qcheckbox.h> | 29 | #include <qcheckbox.h> |
30 | #include <qlistview.h> | ||
31 | #include <qheader.h> | ||
27 | 32 | ||
28 | DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, | 33 | DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent, |
29 | const char *name, bool modal, WFlags fl ) | 34 | const char *name, bool modal, WFlags fl ) |
30 | : DateBookSettingsBase( parent, name, modal, fl ), | 35 | : DateBookSettingsBase( parent, name, modal, fl ), |
31 | ampm( whichClock ) | 36 | ampm( whichClock ) |
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 | } |
38 | 47 | ||
39 | DateBookSettings::~DateBookSettings() | 48 | DateBookSettings::~DateBookSettings() |
40 | { | 49 | { |
41 | } | 50 | } |
42 | 51 | ||
43 | void DateBookSettings::setStartTime( int newStartViewTime ) | 52 | void DateBookSettings::setStartTime( int newStartViewTime ) |
44 | { | 53 | { |
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 ) |
@@ -61,24 +70,51 @@ void DateBookSettings::setStartTime( int newStartViewTime ) | |||
61 | int DateBookSettings::startTime() const | 70 | int DateBookSettings::startTime() const |
62 | { | 71 | { |
63 | int returnMe = spinStart->value(); | 72 | int returnMe = spinStart->value(); |
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 | } |
70 | return returnMe; | 79 | return returnMe; |
71 | } | 80 | } |
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 | ||
74 | void DateBookSettings::setAlarmPreset( bool bAlarm, int presetTime ) | 110 | void DateBookSettings::setAlarmPreset( bool bAlarm, int presetTime ) |
75 | { | 111 | { |
76 | chkAlarmPreset->setChecked( bAlarm ); | 112 | chkAlarmPreset->setChecked( bAlarm ); |
77 | if ( presetTime >=5 ) | 113 | if ( presetTime >=5 ) |
78 | spinPreset->setValue( presetTime ); | 114 | spinPreset->setValue( presetTime ); |
79 | } | 115 | } |
80 | 116 | ||
81 | bool DateBookSettings::alarmPreset() const | 117 | bool DateBookSettings::alarmPreset() const |
82 | { | 118 | { |
83 | return chkAlarmPreset->isChecked(); | 119 | return chkAlarmPreset->isChecked(); |
84 | } | 120 | } |
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 | |||
@@ -14,42 +14,58 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
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 | #include <qpe/categoryselect.h> |
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 |
27 | { | 38 | { |
28 | Q_OBJECT | 39 | Q_OBJECT |
29 | public: | 40 | public: |
30 | DateBookSettings( bool whichClock, QWidget *parent = 0, | 41 | DateBookSettings( bool whichClock, QWidget *parent = 0, |
31 | const char *name = 0, bool modal = TRUE, WFlags = 0 ); | 42 | const char *name = 0, bool modal = TRUE, WFlags = 0 ); |
32 | ~DateBookSettings(); | 43 | ~DateBookSettings(); |
33 | void setStartTime( int newStartViewTime ); | 44 | void setStartTime( int newStartViewTime ); |
34 | int startTime() const; | 45 | int startTime() const; |
35 | void setAlarmPreset( bool bAlarm, int presetTime ); | 46 | void setAlarmPreset( bool bAlarm, int presetTime ); |
36 | bool alarmPreset() const; | 47 | bool alarmPreset() const; |
37 | int presetTime() const; | 48 | int presetTime() const; |
38 | void setAlarmType( int alarmType ); | 49 | void setAlarmType( int alarmType ); |
39 | int alarmType() const; | 50 | int alarmType() const; |
40 | 51 | ||
41 | void setJumpToCurTime( bool bJump ); | 52 | void setJumpToCurTime( bool bJump ); |
42 | bool jumpToCurTime() const; | 53 | bool jumpToCurTime() const; |
43 | void setRowStyle( int style ); | 54 | void setRowStyle( int style ); |
44 | int rowStyle() const; | 55 | int rowStyle() const; |
45 | 56 | ||
57 | void setPluginList(Opie::Core::OPluginManager*,Opie::Core::OPluginLoader*); | ||
46 | private slots: | 58 | private slots: |
47 | void slot12Hour( int ); | 59 | void slot12Hour( int ); |
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(); |
52 | bool ampm; | 66 | bool ampm; |
53 | int oldtime; | 67 | int oldtime; |
68 | Opie::Core::OPluginManager*m_manager; | ||
69 | Opie::Core::OPluginLoader*m_loader; | ||
54 | }; | 70 | }; |
55 | #endif | 71 | #endif |
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 | |||
@@ -50,25 +50,31 @@ | |||
50 | <property stdset="1"> | 50 | <property stdset="1"> |
51 | <name>margin</name> | 51 | <name>margin</name> |
52 | <number>11</number> | 52 | <number>11</number> |
53 | </property> | 53 | </property> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>spacing</name> | 55 | <name>spacing</name> |
56 | <number>6</number> | 56 | <number>6</number> |
57 | </property> | 57 | </property> |
58 | <widget> | 58 | <widget> |
59 | <class>QTabWidget</class> | 59 | <class>QTabWidget</class> |
60 | <property stdset="1"> | 60 | <property stdset="1"> |
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> |
64 | <widget> | 70 | <widget> |
65 | <class>QWidget</class> | 71 | <class>QWidget</class> |
66 | <property stdset="1"> | 72 | <property stdset="1"> |
67 | <name>name</name> | 73 | <name>name</name> |
68 | <cstring>tab</cstring> | 74 | <cstring>tab</cstring> |
69 | </property> | 75 | </property> |
70 | <attribute> | 76 | <attribute> |
71 | <name>title</name> | 77 | <name>title</name> |
72 | <string>Views</string> | 78 | <string>Views</string> |
73 | </attribute> | 79 | </attribute> |
74 | <vbox> | 80 | <vbox> |
@@ -659,24 +665,66 @@ | |||
659 | <class>CategorySelect</class> | 665 | <class>CategorySelect</class> |
660 | <property stdset="1"> | 666 | <property stdset="1"> |
661 | <name>name</name> | 667 | <name>name</name> |
662 | <cstring>comboCategory</cstring> | 668 | <cstring>comboCategory</cstring> |
663 | </property> | 669 | </property> |
664 | </widget> | 670 | </widget> |
665 | </hbox> | 671 | </hbox> |
666 | </widget> | 672 | </widget> |
667 | </vbox> | 673 | </vbox> |
668 | </widget> | 674 | </widget> |
669 | </vbox> | 675 | </vbox> |
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> |
672 | </vbox> | 720 | </vbox> |
673 | </widget> | 721 | </widget> |
674 | <customwidgets> | 722 | <customwidgets> |
675 | <customwidget> | 723 | <customwidget> |
676 | <class>CategorySelect</class> | 724 | <class>CategorySelect</class> |
677 | <header location="global">qpe/categoryselect.h</header> | 725 | <header location="global">qpe/categoryselect.h</header> |
678 | <sizehint> | 726 | <sizehint> |
679 | <width>-1</width> | 727 | <width>-1</width> |
680 | <height>-1</height> | 728 | <height>-1</height> |
681 | </sizehint> | 729 | </sizehint> |
682 | <container>0</container> | 730 | <container>0</container> |
@@ -697,16 +745,23 @@ | |||
697 | <connection> | 745 | <connection> |
698 | <sender>chkAlarmPreset</sender> | 746 | <sender>chkAlarmPreset</sender> |
699 | <signal>toggled(bool)</signal> | 747 | <signal>toggled(bool)</signal> |
700 | <receiver>spinPreset</receiver> | 748 | <receiver>spinPreset</receiver> |
701 | <slot>setEnabled(bool)</slot> | 749 | <slot>setEnabled(bool)</slot> |
702 | </connection> | 750 | </connection> |
703 | <connection> | 751 | <connection> |
704 | <sender>spinStart</sender> | 752 | <sender>spinStart</sender> |
705 | <signal>valueChanged(int)</signal> | 753 | <signal>valueChanged(int)</signal> |
706 | <receiver>DateBookSettingsBase</receiver> | 754 | <receiver>DateBookSettingsBase</receiver> |
707 | <slot>slot12Hour( int )</slot> | 755 | <slot>slot12Hour( int )</slot> |
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> |
712 | </UI> | 767 | </UI> |
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 | |||
@@ -4,57 +4,64 @@ | |||
4 | #include <qpe/datebookdb.h> | 4 | #include <qpe/datebookdb.h> |
5 | 5 | ||
6 | #include <qvaluelist.h> | 6 | #include <qvaluelist.h> |
7 | #include <qstringlist.h> | 7 | #include <qstringlist.h> |
8 | 8 | ||
9 | namespace Opie { | 9 | namespace Opie { |
10 | namespace Datebook { | 10 | namespace Datebook { |
11 | class HolidayPlugin; | 11 | class HolidayPlugin; |
12 | class HolidayPluginIf; | 12 | class HolidayPluginIf; |
13 | } | 13 | } |
14 | namespace Core { | 14 | namespace Core { |
15 | class OPluginLoader; | 15 | class OPluginLoader; |
16 | class OPluginManager; | ||
16 | } | 17 | } |
17 | } | 18 | } |
18 | 19 | ||
19 | class QLibrary; | 20 | class QLibrary; |
20 | 21 | ||
21 | class DateBookDBHack : virtual public DateBookDB { | 22 | class DateBookDBHack : virtual public DateBookDB { |
22 | public: | 23 | public: |
23 | virtual ~DateBookDBHack(){} | 24 | virtual ~DateBookDBHack(){} |
24 | Event eventByUID(int id); | 25 | Event eventByUID(int id); |
25 | }; | 26 | }; |
26 | 27 | ||
27 | class DateBookHoliday | 28 | class DateBookHoliday |
28 | { | 29 | { |
29 | public: | 30 | public: |
30 | DateBookHoliday(); | 31 | DateBookHoliday(); |
31 | virtual ~DateBookHoliday(); | 32 | virtual ~DateBookHoliday(); |
32 | 33 | ||
33 | QStringList holidaylist(const QDate&); | 34 | QStringList holidaylist(const QDate&); |
34 | QStringList holidaylist(unsigned year, unsigned month, unsigned day); | 35 | QStringList holidaylist(unsigned year, unsigned month, unsigned day); |
35 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); | 36 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); |
36 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); | 37 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); |
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: |
39 | void init(); | 45 | void init(); |
40 | void deinit(); | 46 | void deinit(); |
41 | 47 | ||
42 | struct HPlugin { | 48 | struct HPlugin { |
43 | Opie::Datebook::HolidayPlugin*_plugin; | 49 | Opie::Datebook::HolidayPlugin*_plugin; |
44 | //QLibrary*_lib; | 50 | //QLibrary*_lib; |
45 | //Opie::Datebook::HolidayPluginIf*_if; | 51 | //Opie::Datebook::HolidayPluginIf*_if; |
46 | }; | 52 | }; |
47 | QValueList<HPlugin*>_pluginlist; | 53 | QValueList<HPlugin*>_pluginlist; |
48 | Opie::Core::OPluginLoader*m_pluginLoader; | 54 | Opie::Core::OPluginLoader*m_pluginLoader; |
55 | Opie::Core::OPluginManager*m_pluginManager; | ||
49 | }; | 56 | }; |
50 | 57 | ||
51 | class DateBookDBHoliday:virtual public DateBookDBHack { | 58 | class DateBookDBHoliday:virtual public DateBookDBHack { |
52 | public: | 59 | public: |
53 | DateBookDBHoliday():DateBookDBHack(){db_holiday=0;} | 60 | DateBookDBHoliday():DateBookDBHack(){db_holiday=0;} |
54 | virtual ~DateBookDBHoliday(){} | 61 | virtual ~DateBookDBHoliday(){} |
55 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); | 62 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to ); |
56 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); | 63 | virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start); |
57 | virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDate &from,const QDate &to ); | 64 | virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDate &from,const QDate &to ); |
58 | virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDateTime &start); | 65 | virtual QValueList<EffectiveEvent> getEffectiveEventsNoHoliday(const QDateTime &start); |
59 | 66 | ||
60 | DateBookHoliday*db_holiday; | 67 | DateBookHoliday*db_holiday; |
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 | |||
@@ -206,25 +206,30 @@ void DateBookWeekLstEvent::duplicateMe() | |||
206 | } | 206 | } |
207 | void DateBookWeekLstEvent::deleteMe() | 207 | void DateBookWeekLstEvent::deleteMe() |
208 | { | 208 | { |
209 | emit removeEvent(event.event()); | 209 | emit removeEvent(event.event()); |
210 | emit redraw(); | 210 | emit redraw(); |
211 | } | 211 | } |
212 | void DateBookWeekLstEvent::beamMe() | 212 | void DateBookWeekLstEvent::beamMe() |
213 | { | 213 | { |
214 | emit beamEvent( event.event() ); | 214 | emit beamEvent( event.event() ); |
215 | } | 215 | } |
216 | void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e ) | 216 | 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())); |
220 | popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe())); | 225 | popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe())); |
221 | popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe())); | 226 | popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe())); |
222 | if(Ir::supported()) | 227 | if(Ir::supported()) |
223 | popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe())); | 228 | popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe())); |
224 | popmenue->popup( mapToGlobal( e->pos() )); | 229 | popmenue->popup( mapToGlobal( e->pos() )); |
225 | } | 230 | } |
226 | 231 | ||
227 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | 232 | DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, |
228 | const QDate &d, bool onM, | 233 | const QDate &d, bool onM, |
229 | QWidget* parent, | 234 | QWidget* parent, |
230 | const char* name, WFlags fl) | 235 | const char* name, WFlags fl) |