summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp50
-rw-r--r--core/pim/datebook/datebookday.cpp7
-rw-r--r--core/pim/datebook/datebookdayallday.cpp2
-rw-r--r--core/pim/datebook/datebooksettings.cpp124
-rw-r--r--core/pim/datebook/datebooksettings.h18
-rw-r--r--core/pim/datebook/datebooksettingsbase.ui59
-rw-r--r--core/pim/datebook/datebooktypes.h7
-rw-r--r--core/pim/datebook/datebookweeklst.cpp5
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
@@ -243,12 +243,13 @@ void DateBook::slotSettings()
frmSettings.setStartTime( startTime );
frmSettings.setAlarmPreset( aPreset, presetTime );
frmSettings.setJumpToCurTime( bJumpToCurTime );
frmSettings.setRowStyle( rowStyle );
frmSettings.comboDefaultView->setCurrentItem(defaultView-1);
frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig);
+ frmSettings.setPluginList(db_holiday->pluginManager(),db_holiday->pluginLoader());
bool found=false;
for (int i=0; i<(frmSettings.comboLocation->count()); i++) {
if ( frmSettings.comboLocation->text(i) == defaultLocation ) {
frmSettings.comboLocation->setCurrentItem(i);
found=true;
@@ -259,12 +260,15 @@ void DateBook::slotSettings()
frmSettings.comboLocation->insertItem(defaultLocation);
frmSettings.comboLocation->setCurrentItem(frmSettings.comboLocation->count()-1);
}
frmSettings.comboCategory->setCategories(defaultCategories,"Calendar", tr("Calendar"));
if ( QPEApplication::execDialog( &frmSettings ) ) {
+ db_holiday->pluginManager()->save();
+ db_holiday->reloadPlugins();
+
aPreset = frmSettings.alarmPreset();
presetTime = frmSettings.presetTime();
startTime = frmSettings.startTime();
bJumpToCurTime = frmSettings.jumpToCurTime();
rowStyle = frmSettings.rowStyle();
defaultView=frmSettings.comboDefaultView->currentItem()+1;
@@ -1086,50 +1090,54 @@ Event DateBookDBHack::eventByUID(int uid) {
DateBookHoliday::DateBookHoliday()
{
_pluginlist.clear();
m_pluginLoader = new Opie::Core::OPluginLoader("holidays",false);
m_pluginLoader->setAutoDelete(true);
+ m_pluginManager = new Opie::Core::OPluginManager(m_pluginLoader);
+ m_pluginManager->load();
+
+ init();
+}
+
+void DateBookHoliday::reloadPlugins()
+{
+ deinit();
init();
}
DateBookHoliday::~DateBookHoliday()
{
deinit();
delete m_pluginLoader;
+ delete m_pluginManager;
}
void DateBookHoliday::deinit()
{
-/*
QValueList<HPlugin*>::Iterator it;
for (it=_pluginlist.begin();it!=_pluginlist.end();++it) {
HPlugin*_pl = *it;
- // destructs itself?
- _pl->_if->release();
- _pl->_lib->unload();
- delete _pl->_lib;
+ *it = 0;
delete _pl;
}
_pluginlist.clear();
-*/
}
#if 0
void debugLst( const Opie::Core::OPluginItem::List& lst ) {
for ( Opie::Core::OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it )
odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl;
}
#endif
void DateBookHoliday::init()
{
-#if 0
deinit();
-#endif
- Opie::Core::OPluginItem::List lst = m_pluginLoader->allAvailable( false );
+
+ Opie::Core::OPluginItem::List lst = m_pluginLoader->filtered(true);
// debugLst( lst );
for( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){
Opie::Datebook::HolidayPluginIf*hif = m_pluginLoader->load<Opie::Datebook::HolidayPluginIf>(*it,IID_HOLIDAY_PLUGIN);
if (hif) {
Opie::Datebook::HolidayPlugin*pl = hif->plugin();
if (pl) {
@@ -1138,36 +1146,12 @@ void DateBookHoliday::init()
odebug << "Found holiday " << pl->description()<<oendl;
_pluginlist.append(_pl);
//_pl->_if = hif;
}
}
}
-#if 0
- QString path = QPEApplication::qpeDir() + "plugins/datebook/holiday";
- QDir dir( path, "lib*.so" );
- QStringList list = dir.entryList();
- QStringList::Iterator it;
- for (it=list.begin();it!=list.end();++it) {
- Opie::Datebook::HolidayPluginIf*hif = 0;
- QLibrary*lib=new QLibrary(path+"/"+*it);
- if ((lib->queryInterface(IID_HOLIDAY_PLUGIN,(QUnknownInterface**)&hif) == QS_OK) && hif) {
- Opie::Datebook::HolidayPlugin*pl = hif->plugin();
- if (pl) {
- HPlugin*_pl=new HPlugin;
- _pl->_plugin = pl;
- odebug << "Found holiday " << pl->description()<<oendl;
- _pl->_lib = lib;
- _pl->_if = hif;
- _pluginlist.append(_pl);
- } else {
- }
- } else {
- delete lib;
- }
- }
-#endif
}
QStringList DateBookHoliday::holidaylist(const QDate&aDate)
{
QStringList ret;
QValueList<HPlugin*>::Iterator it;
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
@@ -360,16 +360,17 @@ void DateBookDay::getEvents()
m_allDays->hide(); // just in case
m_allDays->removeAllEvents();
QStringList hdays = _holiday_db->holidaylist(currDate);
QStringList::Iterator sit;
QObject* object = 0;
+
+ /* this way we make sure that holiday dummy events are always
+ on top of the widgetlist. */
for (sit=hdays.begin();sit!=hdays.end();++sit) {
- object = m_allDays->addHoliday(*sit);
- if (!object) continue;
- /* not to do something with it */
+ m_allDays->addHoliday(*sit);
}
QValueList<EffectiveEvent> eventList = db->getEffectiveEventsNoHoliday( currDate, currDate );
QValueListIterator<EffectiveEvent> it;
for ( it = eventList.begin(); it != eventList.end(); ++it ) {
EffectiveEvent ev=*it;
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
@@ -189,13 +189,13 @@ void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e)
{
Event ev = m_Ev.event();
QColor b = backgroundColor();
setBackgroundColor(green);
update();
QPopupMenu m;
- if (!m_holiday) {
+ if (ev.isValidUid()) {
m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 );
m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 );
m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 );
if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 );
if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 );
}
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
@@ -17,68 +17,104 @@
** not clear to you.
**
**********************************************************************/
#include "datebooksettings.h"
+#include <opie2/opluginloader.h>
+#include <opie2/odebug.h>
+
#include <qpe/qpeapplication.h>
#include <qspinbox.h>
#include <qcheckbox.h>
+#include <qlistview.h>
+#include <qheader.h>
DateBookSettings::DateBookSettings( bool whichClock, QWidget *parent,
const char *name, bool modal, WFlags fl )
: DateBookSettingsBase( parent, name, modal, fl ),
ampm( whichClock )
{
- init();
- QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) );
- QArray<int> categories;
- comboCategory->setCategories( categories, "Calendar", tr("Calendar") );
+ init();
+ QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( slotChangeClock(bool) ) );
+ QArray<int> categories;
+ comboCategory->setCategories( categories, "Calendar", tr("Calendar") );
+ m_loader = 0;
+ m_manager = 0;
+ m_PluginListView->header()->hide();
+ m_PluginListView->setSorting(-1);
}
DateBookSettings::~DateBookSettings()
{
}
void DateBookSettings::setStartTime( int newStartViewTime )
{
if ( ampm ) {
- if ( newStartViewTime >= 12 ) {
- newStartViewTime %= 12;
- if ( newStartViewTime == 0 )
- newStartViewTime = 12;
- spinStart->setSuffix( tr(":00 PM") );
- }
- else if ( newStartViewTime == 0 ) {
- newStartViewTime = 12;
- spinStart->setSuffix( tr(":00 AM") );
- }
- oldtime = newStartViewTime;
+ if ( newStartViewTime >= 12 ) {
+ newStartViewTime %= 12;
+ if ( newStartViewTime == 0 )
+ newStartViewTime = 12;
+ spinStart->setSuffix( tr(":00 PM") );
+ }
+ else if ( newStartViewTime == 0 ) {
+ newStartViewTime = 12;
+ spinStart->setSuffix( tr(":00 AM") );
+ }
+ oldtime = newStartViewTime;
}
spinStart->setValue( newStartViewTime );
}
int DateBookSettings::startTime() const
{
int returnMe = spinStart->value();
if ( ampm ) {
- if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) )
- returnMe += 12;
- else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE))
- returnMe = 0;
+ if ( returnMe != 12 && spinStart->suffix().contains(tr("PM"), FALSE) )
+ returnMe += 12;
+ else if (returnMe == 12 && spinStart->suffix().contains(tr("AM"), TRUE))
+ returnMe = 0;
}
return returnMe;
}
+void DateBookSettings::setPluginList(Opie::Core::OPluginManager*aManager,Opie::Core::OPluginLoader*aLoader)
+{
+ m_manager = aManager;
+ m_loader = aLoader;
+ if (!aManager||!aLoader) return;
+ Opie::Core::OPluginItem::List inLst = m_loader->allAvailable(true);
+ QCheckListItem *pitem = 0;
+
+ for ( Opie::Core::OPluginItem::List::Iterator it = inLst.begin(); it != inLst.end(); ++it ) {
+ pitem = new QCheckListItem(m_PluginListView,(*it).name(),QCheckListItem::CheckBox);
+ pitem->setOn( (*it).isEnabled() );
+ }
+}
+
+void DateBookSettings::pluginItemClicked(QListViewItem *aItem)
+{
+ if (!aItem||!m_manager||!m_loader) return;
+ QCheckListItem*pitem = ((QCheckListItem*)aItem);
+
+ Opie::Core::OPluginItem::List lst = m_loader->allAvailable( true );
+ for ( Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) {
+ if ( QString::compare( (*it).name() , pitem->text(0) ) == 0 ) {
+ m_manager->setEnabled((*it),pitem->isOn());
+ break;
+ }
+ }
+}
void DateBookSettings::setAlarmPreset( bool bAlarm, int presetTime )
{
chkAlarmPreset->setChecked( bAlarm );
if ( presetTime >=5 )
- spinPreset->setValue( presetTime );
+ spinPreset->setValue( presetTime );
}
bool DateBookSettings::alarmPreset() const
{
return chkAlarmPreset->isChecked();
}
@@ -89,67 +125,67 @@ int DateBookSettings::presetTime() const
}
void DateBookSettings::slot12Hour( int i )
{
if ( ampm ) {
- if ( spinStart->suffix().contains( tr("AM"), FALSE ) ) {
- if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 )
- spinStart->setSuffix( tr(":00 PM") );
- } else {
- if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 )
- spinStart->setSuffix( tr(":00 AM") );
- }
- oldtime = i;
+ if ( spinStart->suffix().contains( tr("AM"), FALSE ) ) {
+ if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 )
+ spinStart->setSuffix( tr(":00 PM") );
+ } else {
+ if ( oldtime == 12 && i == 11 || oldtime == 11 && i == 12 )
+ spinStart->setSuffix( tr(":00 AM") );
+ }
+ oldtime = i;
}
}
void DateBookSettings::init()
{
if ( ampm ) {
- spinStart->setMinValue( 1 );
- spinStart->setMaxValue( 12 );
- spinStart->setValue( 12 );
- spinStart->setSuffix( tr(":00 AM") );
- oldtime = 12;
+ spinStart->setMinValue( 1 );
+ spinStart->setMaxValue( 12 );
+ spinStart->setValue( 12 );
+ spinStart->setSuffix( tr(":00 AM") );
+ oldtime = 12;
} else {
- spinStart->setMinValue( 0 );
- spinStart->setMaxValue( 23 );
- spinStart->setSuffix( tr(":00") );
+ spinStart->setMinValue( 0 );
+ spinStart->setMaxValue( 23 );
+ spinStart->setSuffix( tr(":00") );
}
}
void DateBookSettings::slotChangeClock( bool whichClock )
{
int saveMe;
saveMe = spinStart->value();
if ( ampm && spinStart->suffix().contains( tr("AM"), FALSE ) ) {
- if ( saveMe == 12 )
- saveMe = 0;
+ if ( saveMe == 12 )
+ saveMe = 0;
} else if ( ampm && spinStart->suffix().contains( tr("PM"), FALSE ) ) {
- if ( saveMe != 12 )
- saveMe += 12;
+ if ( saveMe != 12 )
+ saveMe += 12;
}
ampm = whichClock;
init();
setStartTime( saveMe );
}
void DateBookSettings::setJumpToCurTime( bool bJump )
{
- chkJumpToCurTime->setChecked( bJump );
+ chkJumpToCurTime->setChecked( bJump );
}
bool DateBookSettings::jumpToCurTime() const
{
- return chkJumpToCurTime->isChecked();
+ return chkJumpToCurTime->isChecked();
}
void DateBookSettings::setRowStyle( int style )
{
- comboRowStyle->setCurrentItem( style );
+ comboRowStyle->setCurrentItem( style );
}
int DateBookSettings::rowStyle() const
{
- return comboRowStyle->currentItem();
+ return comboRowStyle->currentItem();
}
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
@@ -20,12 +20,23 @@
#ifndef DATEBOOKSETTINGS_H
#define DATEBOOKSETTINGS_H
#include "datebooksettingsbase.h"
#include <qpe/categoryselect.h>
+namespace Opie {
+namespace Core {
+ class OPluginManager;
+ class OGenericPluginLoader;
+ class OPluginLoader;
+}
+namespace Ui {
+ class OPluginConfigWidget;
+}
+}
+
class DateBookSettings : public DateBookSettingsBase
{
Q_OBJECT
public:
DateBookSettings( bool whichClock, QWidget *parent = 0,
const char *name = 0, bool modal = TRUE, WFlags = 0 );
@@ -40,16 +51,21 @@ public:
void setJumpToCurTime( bool bJump );
bool jumpToCurTime() const;
void setRowStyle( int style );
int rowStyle() const;
+ void setPluginList(Opie::Core::OPluginManager*,Opie::Core::OPluginLoader*);
private slots:
void slot12Hour( int );
void slotChangeClock( bool );
+protected slots:
+ virtual void pluginItemClicked(QListViewItem *);
-private:
+protected:
void init();
bool ampm;
int oldtime;
+ Opie::Core::OPluginManager*m_manager;
+ Opie::Core::OPluginLoader*m_loader;
};
#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
@@ -56,13 +56,19 @@
<number>6</number>
</property>
<widget>
<class>QTabWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>TabWidget2</cstring>
+ <cstring>TabWidget</cstring>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
</property>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
@@ -665,12 +671,54 @@
</hbox>
</widget>
</vbox>
</widget>
</vbox>
</widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>plugintab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Plugins</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>2</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget>
+ <class>QListView</class>
+ <column>
+ <property>
+ <name>text</name>
+ <string>Pluginlist</string>
+ </property>
+ <property>
+ <name>clickable</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>resizeable</name>
+ <bool>true</bool>
+ </property>
+ </column>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>m_PluginListView</cstring>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
</widget>
</vbox>
</widget>
<customwidgets>
<customwidget>
<class>CategorySelect</class>
@@ -703,10 +751,17 @@
<connection>
<sender>spinStart</sender>
<signal>valueChanged(int)</signal>
<receiver>DateBookSettingsBase</receiver>
<slot>slot12Hour( int )</slot>
</connection>
- <slot access="public">slotChangeClock( bool )</slot>
+ <connection>
+ <sender>m_PluginListView</sender>
+ <signal>clicked(QListViewItem*)</signal>
+ <receiver>DateBookSettingsBase</receiver>
+ <slot>pluginItemClicked(QListViewItem *)</slot>
+ </connection>
+ <slot access="protected">pluginItemClicked(QListViewItem *)</slot>
<slot access="public">slot12Hour( int )</slot>
+ <slot access="public">slotChangeClock( bool )</slot>
</connections>
</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
@@ -10,12 +10,13 @@ namespace Opie {
namespace Datebook {
class HolidayPlugin;
class HolidayPluginIf;
}
namespace Core {
class OPluginLoader;
+ class OPluginManager;
}
}
class QLibrary;
class DateBookDBHack : virtual public DateBookDB {
@@ -32,23 +33,29 @@ public:
QStringList holidaylist(const QDate&);
QStringList holidaylist(unsigned year, unsigned month, unsigned day);
virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDate &from,const QDate &to );
virtual QValueList<EffectiveEvent> getEffectiveEvents(const QDateTime &start);
+ void reloadPlugins();
+
+ Opie::Core::OPluginLoader*pluginLoader(){return m_pluginLoader;}
+ Opie::Core::OPluginManager*pluginManager(){return m_pluginManager;}
+
protected:
void init();
void deinit();
struct HPlugin {
Opie::Datebook::HolidayPlugin*_plugin;
//QLibrary*_lib;
//Opie::Datebook::HolidayPluginIf*_if;
};
QValueList<HPlugin*>_pluginlist;
Opie::Core::OPluginLoader*m_pluginLoader;
+ Opie::Core::OPluginManager*m_pluginManager;
};
class DateBookDBHoliday:virtual public DateBookDBHack {
public:
DateBookDBHoliday():DateBookDBHack(){db_holiday=0;}
virtual ~DateBookDBHoliday(){}
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
@@ -212,13 +212,18 @@ void DateBookWeekLstEvent::deleteMe()
void DateBookWeekLstEvent::beamMe()
{
emit beamEvent( event.event() );
}
void DateBookWeekLstEvent::mousePressEvent( QMouseEvent *e )
{
+ if (!event.event().isValidUid()) {
+ // this is just such a holiday event.
+ return;
+ }
popmenue = new QPopupMenu;
+
popmenue->insertItem( tr( "Edit" ), this, SLOT(editMe()));
popmenue->insertItem( tr( "Duplicate" ), this, SLOT(duplicateMe()));
popmenue->insertItem( tr( "Delete" ), this, SLOT(deleteMe()));
if(Ir::supported())
popmenue->insertItem( tr( "Beam" ), this, SLOT(beamMe()));
popmenue->popup( mapToGlobal( e->pos() ));