Diffstat (limited to 'core/pim/datebook/datebooksettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebooksettings.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
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 | } |