author | harlekin <harlekin> | 2002-09-18 09:52:51 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-18 09:52:51 (UTC) |
commit | 15ecc4aa71878039ad40ce270fae06282d8e98c2 (patch) (unidiff) | |
tree | 1b1cae7b89bdd3960da222542e99c05332610231 | |
parent | 01d31aeaa8d513bde8237a07ea0a48ac1b85c3c0 (diff) | |
download | opie-15ecc4aa71878039ad40ce270fae06282d8e98c2.zip opie-15ecc4aa71878039ad40ce270fae06282d8e98c2.tar.gz opie-15ecc4aa71878039ad40ce270fae06282d8e98c2.tar.bz2 |
reload plugins now on config change
-rw-r--r-- | core/pim/today/plugins/datebook/datebookevent.cpp | 4 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginwidget.cpp | 6 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 58 | ||||
-rw-r--r-- | core/pim/today/today.h | 9 | ||||
-rw-r--r-- | core/pim/today/todaybase.cpp | 16 | ||||
-rw-r--r-- | core/pim/today/todayconfig.cpp | 4 |
6 files changed, 40 insertions, 57 deletions
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp index 1caf061..d4e8e1e 100644 --- a/core/pim/today/plugins/datebook/datebookevent.cpp +++ b/core/pim/today/plugins/datebook/datebookevent.cpp | |||
@@ -9,48 +9,50 @@ | |||
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "datebookevent.h" | 17 | #include "datebookevent.h" |
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpe/timestring.h> | 19 | #include <qpe/timestring.h> |
20 | #include <qpe/qcopenvelope_qws.h> | 20 | #include <qpe/qcopenvelope_qws.h> |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | 22 | ||
23 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | 23 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, |
24 | QWidget* parent, | 24 | QWidget* parent, |
25 | int show_location, | 25 | int show_location, |
26 | int show_notes, | 26 | int show_notes, |
27 | // int onlyLater, | 27 | // int onlyLater, |
28 | int maxCharClip, | 28 | int maxCharClip, |
29 | const char* name, | 29 | const char* name, |
30 | WFlags fl) : | 30 | WFlags fl) : |
31 | OClickableLabel(parent,name,fl), event(ev) { | 31 | OClickableLabel(parent,name,fl), event(ev) { |
32 | 32 | ||
33 | setAlignment( AlignTop ); | ||
34 | |||
33 | QString msg; | 35 | QString msg; |
34 | 36 | ||
35 | Config config( "qpe" ); | 37 | Config config( "qpe" ); |
36 | config.setGroup( "Time" ); | 38 | config.setGroup( "Time" ); |
37 | // if 24 h format | 39 | // if 24 h format |
38 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 40 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
39 | 41 | ||
40 | msg += "<B>" + (ev).description() + "</B>"; | 42 | msg += "<B>" + (ev).description() + "</B>"; |
41 | if ( (ev).event().hasAlarm() ) { | 43 | if ( (ev).event().hasAlarm() ) { |
42 | msg += " <b>[with alarm]</b>"; | 44 | msg += " <b>[with alarm]</b>"; |
43 | } | 45 | } |
44 | 46 | ||
45 | // include location or not | 47 | // include location or not |
46 | if ( show_location == 1) { | 48 | if ( show_location == 1) { |
47 | msg += "<BR><i>" + (ev).location() + "</i>"; | 49 | msg += "<BR><i>" + (ev).location() + "</i>"; |
48 | } | 50 | } |
49 | 51 | ||
50 | if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) | 52 | if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) |
51 | && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59") ) { | 53 | && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59") ) { |
52 | msg += "<br>All day"; | 54 | msg += "<br>All day"; |
53 | } else { | 55 | } else { |
54 | // start time of event | 56 | // start time of event |
55 | msg += "<br>" + ampmTime(QTime( (ev).event().start().time() ) ) | 57 | msg += "<br>" + ampmTime(QTime( (ev).event().start().time() ) ) |
56 | // end time of event | 58 | // end time of event |
@@ -69,50 +71,48 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | |||
69 | 71 | ||
70 | 72 | ||
71 | QString DateBookEvent::ampmTime( QTime tm ) { | 73 | QString DateBookEvent::ampmTime( QTime tm ) { |
72 | 74 | ||
73 | QString s; | 75 | QString s; |
74 | if( ampm ) { | 76 | if( ampm ) { |
75 | int hour = tm.hour(); | 77 | int hour = tm.hour(); |
76 | if ( hour == 0 ) { | 78 | if ( hour == 0 ) { |
77 | hour = 12; | 79 | hour = 12; |
78 | } | 80 | } |
79 | if ( hour > 12 ) { | 81 | if ( hour > 12 ) { |
80 | hour -= 12; | 82 | hour -= 12; |
81 | } | 83 | } |
82 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | 84 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), |
83 | (tm.hour() >= 12) ? "PM" : "AM" ); | 85 | (tm.hour() >= 12) ? "PM" : "AM" ); |
84 | return s; | 86 | return s; |
85 | } else { | 87 | } else { |
86 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 88 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
87 | return s; | 89 | return s; |
88 | } | 90 | } |
89 | 91 | ||
90 | } | 92 | } |
91 | 93 | ||
92 | 94 | ||
93 | //extern QPEApplication *todayApp; | ||
94 | |||
95 | /* | 95 | /* |
96 | * starts the edit dialog as known from datebook | 96 | * starts the edit dialog as known from datebook |
97 | */ | 97 | */ |
98 | void DateBookEvent::editEventSlot( const Event &e ) { | 98 | void DateBookEvent::editEventSlot( const Event &e ) { |
99 | startDatebook(); | 99 | startDatebook(); |
100 | 100 | ||
101 | while( !QCopChannel::isRegistered( "QPE/Datebook" ) ) qApp->processEvents(); | 101 | while( !QCopChannel::isRegistered( "QPE/Datebook" ) ) qApp->processEvents(); |
102 | QCopEnvelope env( "QPE/Datebook", "editEvent(int)" ); | 102 | QCopEnvelope env( "QPE/Datebook", "editEvent(int)" ); |
103 | env << e.uid(); | 103 | env << e.uid(); |
104 | } | 104 | } |
105 | 105 | ||
106 | 106 | ||
107 | /** | 107 | /** |
108 | * launches datebook | 108 | * launches datebook |
109 | */ | 109 | */ |
110 | void DateBookEvent::startDatebook() { | 110 | void DateBookEvent::startDatebook() { |
111 | QCopEnvelope e("QPE/System", "execute(QString)"); | 111 | QCopEnvelope e("QPE/System", "execute(QString)"); |
112 | e << QString("datebook"); | 112 | e << QString("datebook"); |
113 | } | 113 | } |
114 | 114 | ||
115 | void DateBookEvent::editMe() { | 115 | void DateBookEvent::editMe() { |
116 | emit editEvent(event.event()); | 116 | emit editEvent(event.event()); |
117 | } | 117 | } |
118 | 118 | ||
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index e4667ae..7948656 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp | |||
@@ -38,77 +38,79 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name) | |||
38 | DatebookPluginWidget::~DatebookPluginWidget() { | 38 | DatebookPluginWidget::~DatebookPluginWidget() { |
39 | delete db; | 39 | delete db; |
40 | } | 40 | } |
41 | 41 | ||
42 | 42 | ||
43 | void DatebookPluginWidget::readConfig() { | 43 | void DatebookPluginWidget::readConfig() { |
44 | Config cfg( "todaydatebookplugin" ); | 44 | Config cfg( "todaydatebookplugin" ); |
45 | cfg.setGroup( "config" ); | 45 | cfg.setGroup( "config" ); |
46 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); | 46 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); |
47 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); | 47 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); |
48 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); | 48 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); |
49 | m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); | 49 | m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); |
50 | } | 50 | } |
51 | 51 | ||
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Get all events that are in the datebook xml file for today | 54 | * Get all events that are in the datebook xml file for today |
55 | */ | 55 | */ |
56 | void DatebookPluginWidget::getDates() { | 56 | void DatebookPluginWidget::getDates() { |
57 | 57 | ||
58 | 58 | ||
59 | QDate date = QDate::currentDate(); | 59 | QDate date = QDate::currentDate(); |
60 | 60 | ||
61 | QVBoxLayout* layoutDates = new QVBoxLayout( this ); | 61 | QVBoxLayout* layoutDates = new QVBoxLayout( this ); |
62 | layoutDates->setSpacing( 1 ); | ||
63 | layoutDates->setMargin( 1 ); | ||
62 | 64 | ||
63 | if ( db ) { | 65 | if ( db ) { |
64 | delete db; | 66 | delete db; |
65 | } | 67 | } |
66 | 68 | ||
67 | db = new DateBookDB; | 69 | db = new DateBookDB; |
68 | 70 | ||
69 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date ); | 71 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date ); |
70 | 72 | ||
71 | qBubbleSort( list ); | 73 | qBubbleSort( list ); |
72 | 74 | ||
73 | Config config( "qpe" ); | 75 | Config config( "qpe" ); |
74 | 76 | ||
75 | int count=0; | 77 | int count=0; |
76 | 78 | ||
77 | if ( list.count() > 0 ) { | 79 | if ( list.count() > 0 ) { |
78 | 80 | ||
79 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { | 81 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { |
80 | 82 | ||
81 | if ( count <= m_max_lines_meet ) { | 83 | if ( count <= m_max_lines_meet ) { |
82 | QTime time = QTime::currentTime(); | 84 | QTime time = QTime::currentTime(); |
83 | 85 | ||
84 | if ( !m_onlyLater ) { | 86 | if ( !m_onlyLater ) { |
85 | count++; | 87 | count++; |
86 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | 88 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); |
87 | layoutDates->addWidget( l ); | 89 | layoutDates->addWidget( l ); |
88 | QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); | 90 | QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); |
89 | } else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) { | 91 | } else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) { |
90 | count++; | 92 | count++; |
91 | // show only later appointments | 93 | // show only later appointments |
92 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); | 94 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes ); |
93 | layoutDates->addWidget( l ); | 95 | layoutDates->addWidget( l ); |
94 | QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); | 96 | QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) ); |
95 | } | 97 | } |
96 | } | 98 | } |
97 | } | 99 | } |
98 | if ( m_onlyLater && count == 0 ) { | 100 | if ( m_onlyLater && count == 0 ) { |
99 | QLabel* noMoreEvents = new QLabel( this ); | 101 | QLabel* noMoreEvents = new QLabel( this ); |
100 | noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); | 102 | noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); |
101 | layoutDates->addWidget( noMoreEvents ); | 103 | layoutDates->addWidget( noMoreEvents ); |
102 | } | 104 | } |
103 | } else { | 105 | } else { |
104 | QLabel* noEvents = new QLabel( this ); | 106 | QLabel* noEvents = new QLabel( this ); |
105 | noEvents->setText( QObject::tr( "No appointments today" ) ); | 107 | noEvents->setText( QObject::tr( "No appointments today" ) ); |
106 | layoutDates->addWidget( noEvents ); | 108 | layoutDates->addWidget( noEvents ); |
107 | } | 109 | } |
108 | 110 | //layoutDates->addStretch(0); | |
109 | layoutDates->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 111 | // layoutDates->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
110 | 112 | ||
111 | // how often refresh - later have qcop update calls in *db | 113 | // how often refresh - later have qcop update calls in *db |
112 | //QTimer::singleShot( 20*1000, this , SLOT( getDates() ) ); | 114 | //QTimer::singleShot( 20*1000, this , SLOT( getDates() ) ); |
113 | } | 115 | } |
114 | 116 | ||
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index f052a9f..7537631 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -43,51 +43,49 @@ struct TodayPlugin { | |||
43 | TodayPluginObject *guiPart; | 43 | TodayPluginObject *guiPart; |
44 | QWidget *guiBox; | 44 | QWidget *guiBox; |
45 | QString name; | 45 | QString name; |
46 | bool active; | 46 | bool active; |
47 | int pos; | 47 | int pos; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static QValueList<TodayPlugin> pluginList; | 50 | static QValueList<TodayPlugin> pluginList; |
51 | 51 | ||
52 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 52 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
53 | : TodayBase( parent, name, fl ) { | 53 | : TodayBase( parent, name, fl ) { |
54 | 54 | ||
55 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 55 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
56 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 56 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
57 | 57 | ||
58 | #if defined(Q_WS_QWS) | 58 | #if defined(Q_WS_QWS) |
59 | #if !defined(QT_NO_COP) | 59 | #if !defined(QT_NO_COP) |
60 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 60 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
61 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | 61 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), |
62 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | 62 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); |
63 | #endif | 63 | #endif |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | setOwnerField(); | 66 | setOwnerField(); |
67 | init(); | 67 | refresh(); |
68 | loadPlugins(); | ||
69 | draw(); | ||
70 | showMaximized(); | 68 | showMaximized(); |
71 | } | 69 | } |
72 | 70 | ||
73 | /** | 71 | /** |
74 | * Qcop receive method. | 72 | * Qcop receive method. |
75 | */ | 73 | */ |
76 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 74 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { |
77 | QDataStream stream( data, IO_ReadOnly ); | 75 | QDataStream stream( data, IO_ReadOnly ); |
78 | if ( msg == "message(QString)" ) { | 76 | if ( msg == "message(QString)" ) { |
79 | QString message; | 77 | QString message; |
80 | stream >> message; | 78 | stream >> message; |
81 | setOwnerField( message ); | 79 | setOwnerField( message ); |
82 | } | 80 | } |
83 | } | 81 | } |
84 | 82 | ||
85 | /** | 83 | /** |
86 | * Initialises the owner field with the default value, the username | 84 | * Initialises the owner field with the default value, the username |
87 | */ | 85 | */ |
88 | void Today::setOwnerField() { | 86 | void Today::setOwnerField() { |
89 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); | 87 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); |
90 | if ( QFile::exists( file ) ) { | 88 | if ( QFile::exists( file ) ) { |
91 | Contact cont = Contact::readVCard( file )[0]; | 89 | Contact cont = Contact::readVCard( file )[0]; |
92 | QString returnString = cont.fullName(); | 90 | QString returnString = cont.fullName(); |
93 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); | 91 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); |
@@ -97,225 +95,213 @@ void Today::setOwnerField() { | |||
97 | } | 95 | } |
98 | 96 | ||
99 | /** | 97 | /** |
100 | * Set the owner field with a given QString, for example per qcop. | 98 | * Set the owner field with a given QString, for example per qcop. |
101 | */ | 99 | */ |
102 | void Today::setOwnerField( QString &message ) { | 100 | void Today::setOwnerField( QString &message ) { |
103 | if ( !message.isEmpty() ) { | 101 | if ( !message.isEmpty() ) { |
104 | OwnerField->setText( "<b>" + message + "</b>" ); | 102 | OwnerField->setText( "<b>" + message + "</b>" ); |
105 | } | 103 | } |
106 | } | 104 | } |
107 | 105 | ||
108 | 106 | ||
109 | /** | 107 | /** |
110 | * Init stuff needed for today. Reads the config file. | 108 | * Init stuff needed for today. Reads the config file. |
111 | */ | 109 | */ |
112 | void Today::init() { | 110 | void Today::init() { |
113 | 111 | ||
114 | QDate date = QDate::currentDate(); | 112 | QDate date = QDate::currentDate(); |
115 | QString time = ( tr( date.toString() ) ); | 113 | QString time = ( tr( date.toString() ) ); |
116 | 114 | ||
117 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); | 115 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); |
118 | 116 | ||
119 | // read config | 117 | // read config |
120 | Config cfg( "today" ); | 118 | Config cfg( "today" ); |
121 | |||
122 | cfg.setGroup( "Applets" ); | 119 | cfg.setGroup( "Applets" ); |
123 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 120 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
124 | } | 121 | } |
125 | 122 | ||
126 | 123 | ||
127 | /** | 124 | /** |
128 | * Load the plugins | 125 | * Load the plugins |
129 | */ | 126 | */ |
130 | void Today::loadPlugins() { | 127 | void Today::loadPlugins() { |
131 | 128 | ||
132 | QValueList<TodayPlugin>::Iterator tit; | 129 | QValueList<TodayPlugin>::Iterator tit; |
133 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { | 130 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { |
134 | (*tit).library->unload(); | 131 | (*tit).library->unload(); |
135 | delete (*tit).library; | 132 | delete (*tit).library; |
136 | } | 133 | } |
137 | pluginList.clear(); | 134 | pluginList.clear(); |
138 | 135 | ||
136 | |||
139 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 137 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
140 | QDir dir( path, "lib*.so" ); | 138 | QDir dir( path, "lib*.so" ); |
141 | 139 | ||
142 | QStringList list = dir.entryList(); | 140 | QStringList list = dir.entryList(); |
143 | QStringList::Iterator it; | 141 | QStringList::Iterator it; |
144 | 142 | ||
145 | uint count = 0; | ||
146 | for ( it = list.begin(); it != list.end(); ++it ) { | 143 | for ( it = list.begin(); it != list.end(); ++it ) { |
147 | TodayPluginInterface *iface = 0; | 144 | TodayPluginInterface *iface = 0; |
148 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 145 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
149 | 146 | ||
150 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); | 147 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); |
151 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 148 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
152 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); | 149 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); |
153 | qDebug( QString(*it) ); | 150 | qDebug( QString(*it) ); |
154 | TodayPlugin plugin; | 151 | TodayPlugin plugin; |
155 | plugin.library = lib; | 152 | plugin.library = lib; |
156 | plugin.iface = iface; | 153 | plugin.iface = iface; |
157 | plugin.name = QString(*it); | 154 | plugin.name = QString(*it); |
158 | 155 | ||
156 | // find out if plugins should be shown | ||
159 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 157 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
160 | plugin.active = true; | 158 | plugin.active = true; |
161 | } else { | 159 | } else { |
162 | plugin.active = false; | 160 | plugin.active = false; |
163 | } | 161 | } |
164 | plugin.guiPart = plugin.iface->guiPart(); | 162 | plugin.guiPart = plugin.iface->guiPart(); |
165 | 163 | ||
166 | // package the whole thing into a qwidget so it can be shown and hidden | 164 | // package the whole thing into a qwidget so it can be shown and hidden |
167 | plugin.guiBox = new QWidget( this ); | 165 | plugin.guiBox = new QWidget( this ); |
168 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 166 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
169 | 167 | ||
170 | QPixmap plugPix; | 168 | QPixmap plugPix; |
171 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); | 169 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); |
172 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 170 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
173 | plugIcon->setPixmap( plugPix ); | 171 | plugIcon->setPixmap( plugPix ); |
174 | 172 | ||
175 | // a scrollview for each plugin | 173 | // a scrollview for each plugin |
176 | QScrollView* sv = new QScrollView( plugin.guiBox ); | 174 | QScrollView* sv = new QScrollView( plugin.guiBox ); |
177 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); | 175 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); |
178 | sv->setMinimumHeight( plugin.guiPart->minHeight() ); | 176 | sv->setMinimumHeight( plugin.guiPart->minHeight() ); |
179 | //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); | ||
180 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 177 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
181 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 178 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
182 | sv->setFrameShape( QFrame::NoFrame ); | 179 | sv->setFrameShape( QFrame::NoFrame ); |
183 | sv->addChild( plugWidget ); | 180 | sv->addChild( plugWidget ); |
184 | 181 | ||
185 | // make sure the icon is on the top alligned | 182 | // make sure the icon is on the top alligned |
186 | boxLayout->addWidget( plugIcon, 0, AlignTop ); | 183 | boxLayout->addWidget( plugIcon, 0, AlignTop ); |
187 | boxLayout->addWidget( sv, 0, AlignTop ); | 184 | boxLayout->addWidget( sv, 0, AlignTop ); |
188 | boxLayout->setStretchFactor( plugIcon, 1 ); | 185 | boxLayout->setStretchFactor( plugIcon, 1 ); |
189 | boxLayout->setStretchFactor( sv, 9 ); | 186 | boxLayout->setStretchFactor( sv, 9 ); |
190 | layout->addWidget( plugin.guiBox ); | 187 | layout->addWidget( plugin.guiBox ); |
191 | 188 | ||
192 | pluginList.append( plugin ); | 189 | pluginList.append( plugin ); |
193 | count++; | ||
194 | } else { | 190 | } else { |
195 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); | 191 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); |
196 | delete lib; | 192 | delete lib; |
197 | } | 193 | } |
198 | } | 194 | } |
199 | } | 195 | } |
200 | 196 | ||
201 | 197 | ||
202 | /** | 198 | /** |
203 | * Repaint method. Reread all fields. | 199 | * Repaint method. Reread all fields. |
204 | */ | 200 | */ |
205 | void Today::draw() { | 201 | void Today::draw() { |
206 | 202 | ||
207 | if ( pluginList.count() == 0 ) { | 203 | if ( pluginList.count() == 0 ) { |
208 | QLabel *noPlugins = new QLabel( this ); | 204 | QLabel *noPlugins = new QLabel( this ); |
209 | noPlugins->setText( tr( "No plugins found" ) ); | 205 | noPlugins->setText( tr( "No plugins found" ) ); |
210 | layout->addWidget( noPlugins ); | 206 | layout->addWidget( noPlugins ); |
211 | return; | 207 | return; |
212 | } | 208 | } |
213 | 209 | ||
214 | uint count = 0; | 210 | uint count = 0; |
215 | TodayPlugin plugin; | 211 | TodayPlugin plugin; |
216 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 212 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
217 | plugin = pluginList[i]; | 213 | plugin = pluginList[i]; |
218 | 214 | ||
219 | if ( plugin.active ) { | 215 | if ( plugin.active ) { |
220 | qDebug( plugin.name + " is ACTIVE " ); | 216 | qDebug( plugin.name + " is ACTIVE " ); |
221 | plugin.guiBox->show(); | 217 | plugin.guiBox->show(); |
222 | } else { | 218 | } else { |
223 | qDebug( plugin.name + " is INACTIVE" ); | 219 | qDebug( plugin.name + " is INACTIVE" ); |
224 | plugin.guiBox->hide(); | 220 | plugin.guiBox->hide(); |
225 | } | 221 | } |
226 | count++; | 222 | count++; |
227 | } | 223 | } |
228 | 224 | ||
229 | if ( count == 0 ) { | 225 | if ( count == 0 ) { |
230 | QLabel *noPluginsActive = new QLabel( this ); | 226 | QLabel *noPluginsActive = new QLabel( this ); |
231 | noPluginsActive->setText( tr( "No plugins activated" ) ); | 227 | noPluginsActive->setText( tr( "No plugins activated" ) ); |
232 | layout->addWidget( noPluginsActive ); | 228 | layout->addWidget( noPluginsActive ); |
233 | } | 229 | } |
234 | 230 | //layout->addStretch(0); | |
235 | layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 231 | //layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
236 | } | 232 | } |
237 | 233 | ||
238 | 234 | ||
239 | /** | 235 | /** |
240 | * The method for the configuration dialog. | 236 | * The method for the configuration dialog. |
241 | */ | 237 | */ |
242 | void Today::startConfig() { | 238 | void Today::startConfig() { |
243 | 239 | ||
244 | TodayConfig conf( this, "dialog", true ); | 240 | TodayConfig conf( this, "dialog", true ); |
245 | 241 | ||
246 | TodayPlugin plugin; | 242 | TodayPlugin plugin; |
247 | |||
248 | QList<ConfigWidget> configWidgetList; | 243 | QList<ConfigWidget> configWidgetList; |
249 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 244 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
250 | plugin = pluginList[i]; | 245 | plugin = pluginList[i]; |
251 | 246 | ||
252 | // load the config widgets in the tabs | 247 | // load the config widgets in the tabs |
253 | if ( plugin.guiPart->configWidget( this ) != 0l ) { | 248 | if ( plugin.guiPart->configWidget( this ) != 0l ) { |
254 | ConfigWidget* widget = plugin.guiPart->configWidget( this ); | 249 | ConfigWidget* widget = plugin.guiPart->configWidget( this ); |
255 | configWidgetList.append( widget ); | 250 | configWidgetList.append( widget ); |
256 | conf.TabWidget3->insertTab( widget, plugin.guiPart->appName() ); | 251 | conf.TabWidget3->insertTab( widget, plugin.guiPart->appName() ); |
257 | } | 252 | } |
258 | // set the order/activate tab | 253 | // set the order/activate tab |
259 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), | 254 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), |
260 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); | 255 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); |
261 | } | 256 | } |
262 | 257 | ||
263 | if ( conf.exec() == QDialog::Accepted ) { | 258 | if ( conf.exec() == QDialog::Accepted ) { |
264 | conf.writeConfig(); | 259 | conf.writeConfig(); |
265 | ConfigWidget *confWidget; | 260 | ConfigWidget *confWidget; |
266 | for ( confWidget = configWidgetList.first(); confWidget != 0; | 261 | for ( confWidget = configWidgetList.first(); confWidget != 0; |
267 | confWidget = configWidgetList.next() ) { | 262 | confWidget = configWidgetList.next() ) { |
268 | confWidget->writeConfig(); | 263 | confWidget->writeConfig(); |
269 | } | 264 | } |
265 | refresh(); | ||
266 | } | ||
267 | } | ||
270 | 268 | ||
271 | init(); | ||
272 | |||
273 | TodayPlugin plugin; | ||
274 | QValueList<TodayPlugin> plugList; | ||
275 | for ( uint i = 0; i < pluginList.count(); i++ ) { | ||
276 | plugin = pluginList[i]; | ||
277 | 269 | ||
278 | if ( m_excludeApplets.grep( plugin.name ).isEmpty() ) { | 270 | /** |
279 | qDebug("CONFIG " + plugin.name + " ACTIVE"); | 271 | * Refresh for the view. Reload all applets |
280 | plugin.active = true; | 272 | * |
281 | } else { | 273 | */ |
282 | qDebug("CONFIG " + plugin.name + " INACTIVE"); | 274 | void Today::refresh() { |
283 | plugin.active = false; | 275 | init(); |
284 | } | ||
285 | plugList.append( plugin ); | ||
286 | } | ||
287 | pluginList = plugList; | ||
288 | 276 | ||
289 | draw(); | 277 | if ( layout ) { |
278 | delete layout; | ||
290 | } | 279 | } |
291 | } | 280 | layout = new QVBoxLayout( this ); |
281 | layout->addWidget( Frame ); | ||
282 | layout->addWidget( OwnerField ); | ||
292 | 283 | ||
284 | loadPlugins(); | ||
285 | draw(); | ||
286 | } | ||
293 | 287 | ||
294 | void Today::startAddressbook() { | 288 | void Today::startAddressbook() { |
295 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 289 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
296 | e << QString( "addressbook" ); | 290 | e << QString( "addressbook" ); |
297 | } | 291 | } |
298 | 292 | ||
299 | 293 | ||
300 | /** | 294 | /** |
301 | * launch addressbook (personal card) | 295 | * launch addressbook (personal card) |
302 | */ | 296 | */ |
303 | void Today::editCard() { | 297 | void Today::editCard() { |
304 | startAddressbook(); | 298 | startAddressbook(); |
305 | while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { | 299 | while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { |
306 | qApp->processEvents(); | 300 | qApp->processEvents(); |
307 | } | 301 | } |
308 | QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); | 302 | QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); |
309 | } | 303 | } |
310 | 304 | ||
311 | /* | ||
312 | * launches an App | ||
313 | */ | ||
314 | void Today::launchApp( QString appName ) { | ||
315 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | ||
316 | e << QString( appName ); | ||
317 | } | ||
318 | |||
319 | Today::~Today() { | 305 | Today::~Today() { |
320 | } | 306 | } |
321 | 307 | ||
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 0a9a705..672adc4 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -21,53 +21,52 @@ | |||
21 | #include <opie/tododb.h> | 21 | #include <opie/tododb.h> |
22 | 22 | ||
23 | #include <qdatetime.h> | 23 | #include <qdatetime.h> |
24 | #include <qlist.h> | 24 | #include <qlist.h> |
25 | #include <qhbox.h> | 25 | #include <qhbox.h> |
26 | 26 | ||
27 | #include <qpe/qlibrary.h> | 27 | #include <qpe/qlibrary.h> |
28 | #include <qpe/event.h> | 28 | #include <qpe/event.h> |
29 | 29 | ||
30 | #include "todayconfig.h" | 30 | #include "todayconfig.h" |
31 | #include "todaybase.h" | 31 | #include "todaybase.h" |
32 | #include "todayplugininterface.h" | 32 | #include "todayplugininterface.h" |
33 | 33 | ||
34 | class QVBoxLayout; | 34 | class QVBoxLayout; |
35 | 35 | ||
36 | 36 | ||
37 | class Today : public TodayBase { | 37 | class Today : public TodayBase { |
38 | 38 | ||
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | 40 | ||
41 | public: | 41 | public: |
42 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 42 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
43 | ~Today(); | 43 | ~Today(); |
44 | 44 | ||
45 | private slots: | 45 | private slots: |
46 | void startConfig(); | 46 | void startConfig(); |
47 | void startAddressbook(); | 47 | void startAddressbook(); |
48 | void launchApp( QString appName ); | ||
49 | void editCard(); | 48 | void editCard(); |
50 | void draw(); | 49 | void refresh(); |
51 | 50 | ||
52 | private: | 51 | private: |
53 | void init(); | 52 | void init(); |
54 | void setOwnerField(); | 53 | void setOwnerField(); |
55 | void setOwnerField(QString &string); | 54 | void setOwnerField(QString &string); |
56 | void loadPlugins(); | 55 | void loadPlugins(); |
56 | void draw(); | ||
57 | |||
57 | 58 | ||
58 | private slots: | 59 | private slots: |
59 | void channelReceived(const QCString &msg, const QByteArray & data); | 60 | void channelReceived(const QCString &msg, const QByteArray & data); |
60 | 61 | ||
61 | private: | 62 | private: |
62 | TodayConfig *conf; | 63 | TodayConfig *conf; |
63 | QStringList m_excludeApplets; | 64 | QStringList m_excludeApplets; |
64 | 65 | ||
65 | QVBoxLayout *pluginLayout; | ||
66 | |||
67 | // QString m_autoStartTimer; | 66 | // QString m_autoStartTimer; |
68 | int m_newStart; | 67 | int m_newStart; |
69 | // int m_autoStart; | 68 | // int m_autoStart; |
70 | int m_maxCharClip; | 69 | int m_maxCharClip; |
71 | }; | 70 | }; |
72 | 71 | ||
73 | #endif | 72 | #endif |
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp index 74f4fa0..800ca5d 100644 --- a/core/pim/today/todaybase.cpp +++ b/core/pim/today/todaybase.cpp | |||
@@ -13,95 +13,93 @@ | |||
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #include "todaybase.h" | 17 | #include "todaybase.h" |
18 | 18 | ||
19 | #include <qframe.h> | 19 | #include <qframe.h> |
20 | #include <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qimage.h> | 21 | #include <qimage.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | #include <qapplication.h> | 23 | #include <qapplication.h> |
24 | 24 | ||
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | 26 | ||
27 | 27 | ||
28 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | 28 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) |
29 | : QWidget( parent, name, fl ) { | 29 | : QWidget( parent, name, fl ) { |
30 | 30 | ||
31 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo | 31 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo |
32 | QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla | 32 | QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla |
33 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon | 33 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon |
34 | 34 | ||
35 | layout = new QVBoxLayout( this ); | 35 | layout = new QVBoxLayout( this ); |
36 | 36 | ||
37 | QVBoxLayout *mainLayout = new QVBoxLayout( this ); | ||
38 | |||
37 | QPalette pal = this->palette(); | 39 | QPalette pal = this->palette(); |
38 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); | 40 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); |
39 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); | 41 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); |
40 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); | 42 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); |
41 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); | 43 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); |
42 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); | 44 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); |
43 | this->setPalette( pal ); | 45 | this->setPalette( pal ); |
44 | 46 | ||
45 | // --- logo Section --- | 47 | // --- logo Section --- |
46 | QPalette pal2; | 48 | QPalette pal2; |
47 | QColorGroup cg; | 49 | QColorGroup cg; |
48 | cg.setColor( QColorGroup::Text, white ); | 50 | cg.setColor( QColorGroup::Text, white ); |
49 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); | 51 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); |
50 | pal2.setActive( cg ); | 52 | pal2.setActive( cg ); |
51 | // today logo | 53 | // today logo |
52 | Frame = new QLabel( this, "Frame" ); | 54 | Frame = new QLabel( this, "Frame" ); |
53 | Frame->setPalette( pal2 ); | 55 | Frame->setPalette( pal2 ); |
54 | Frame->setFrameShape( QFrame::StyledPanel ); | 56 | Frame->setFrameShape( QFrame::StyledPanel ); |
55 | Frame->setFrameShadow( QFrame::Raised ); | 57 | Frame->setFrameShadow( QFrame::Raised ); |
56 | Frame->setLineWidth( 0 ); | 58 | Frame->setLineWidth( 0 ); |
57 | Frame->setMaximumHeight( 50 ); | 59 | Frame->setMaximumHeight( 50 ); |
58 | Frame->setMinimumHeight( 50 ); | 60 | Frame->setMinimumHeight( 50 ); |
59 | 61 | ||
60 | // Today text | 62 | // Today text |
61 | QLabel* TodayLabel = new QLabel( Frame, "TodayText" ); | 63 | QLabel* TodayLabel = new QLabel( Frame, "TodayText" ); |
62 | TodayLabel->setGeometry( QRect( 10, 0, 168, 40 ) ); | 64 | TodayLabel->setGeometry( QRect( 10, 0, 168, 40 ) ); |
63 | QFont TodayLabel_font( TodayLabel->font() ); | 65 | QFont TodayLabel_font( TodayLabel->font() ); |
64 | TodayLabel_font.setBold( TRUE ); | 66 | TodayLabel_font.setBold( TRUE ); |
65 | TodayLabel_font.setPointSize( 40 ); | 67 | TodayLabel_font.setPointSize( 40 ); |
66 | TodayLabel->setFont( TodayLabel_font ); | 68 | TodayLabel->setFont( TodayLabel_font ); |
67 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); | 69 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); |
68 | TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today²") +"</font>" ); | 70 | TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today²") +"</font>" ); |
69 | 71 | ||
70 | // date | 72 | // date |
71 | DateLabel = new QLabel( Frame, "TextLabel1" ); | 73 | DateLabel = new QLabel( Frame, "TextLabel1" ); |
72 | DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) ); | 74 | DateLabel->setGeometry( QRect( 10, 35, 168, 12 ) ); |
73 | QFont DateLabel_font( DateLabel->font() ); | 75 | QFont DateLabel_font( DateLabel->font() ); |
74 | DateLabel_font.setBold( TRUE ); | 76 | DateLabel_font.setBold( TRUE ); |
75 | DateLabel->setFont( DateLabel_font ); | 77 | DateLabel->setFont( DateLabel_font ); |
76 | DateLabel->setBackgroundOrigin( QLabel::ParentOrigin ); | 78 | DateLabel->setBackgroundOrigin( QLabel::ParentOrigin ); |
77 | DateLabel->setTextFormat( RichText ); | 79 | DateLabel->setTextFormat( RichText ); |
78 | 80 | ||
79 | // Opiezilla | 81 | // Opiezilla |
80 | QLabel* Opiezilla = new QLabel( Frame, "OpieZilla"); | 82 | QLabel* Opiezilla = new QLabel( Frame, "OpieZilla" ); |
81 | Opiezilla->setPixmap( opiezilla ); | 83 | Opiezilla->setPixmap( opiezilla ); |
82 | Opiezilla->setGeometry( QApplication::desktop()->width()-50 ,1, 45, 47); | 84 | Opiezilla->setGeometry( QApplication::desktop()->width()-50 ,1, 45, 47 ); |
83 | Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); | 85 | Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); |
84 | 86 | ||
85 | // Ownerfield | 87 | // Ownerfield |
86 | OwnerField = new OClickableLabel( this , "Owner" ); | 88 | OwnerField = new OClickableLabel( this , "Owner" ); |
87 | OwnerField->setGeometry( QRect( 0,0, this->width(), 12 )); | 89 | OwnerField->setGeometry( QRect( 0, 0, this->width(), 12 ) ); |
88 | OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) ); | 90 | OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) ); |
89 | OwnerField->setMaximumHeight(12); | 91 | OwnerField->setMaximumHeight(12); |
90 | 92 | ||
91 | // config | 93 | // config |
92 | ConfigButton = new OClickableLabel ( Frame, "PushButton1" ); | 94 | ConfigButton = new OClickableLabel ( Frame, "PushButton1" ); |
93 | ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 30, 25, 21 ) ); | 95 | ConfigButton->setGeometry( QRect( QApplication::desktop()->width()-80, 30, 25, 21 ) ); |
94 | ConfigButton->setPixmap( config ); | 96 | ConfigButton->setPixmap( config ); |
95 | ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); | 97 | ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); |
96 | |||
97 | // -- layout -- | ||
98 | layout->addWidget( Frame ); | ||
99 | layout->addWidget( OwnerField ); | ||
100 | } | 98 | } |
101 | 99 | ||
102 | /** | 100 | /** |
103 | * D' tor | 101 | * D' tor |
104 | */ | 102 | */ |
105 | TodayBase::~TodayBase() { | 103 | TodayBase::~TodayBase() { |
106 | } | 104 | } |
107 | 105 | ||
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index 79c4d1f..4f23471 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp | |||
@@ -36,50 +36,48 @@ public: | |||
36 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 36 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
37 | : QToolButton( parent, name ) { | 37 | : QToolButton( parent, name ) { |
38 | // setTextLabel( name ); | 38 | // setTextLabel( name ); |
39 | setPixmap( Resource::loadPixmap( icon ) ); | 39 | setPixmap( Resource::loadPixmap( icon ) ); |
40 | setAutoRaise( TRUE ); | 40 | setAutoRaise( TRUE ); |
41 | setFocusPolicy( QWidget::NoFocus ); | 41 | setFocusPolicy( QWidget::NoFocus ); |
42 | setToggleButton( t ); | 42 | setToggleButton( t ); |
43 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 43 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
44 | } | 44 | } |
45 | }; | 45 | }; |
46 | 46 | ||
47 | 47 | ||
48 | /** | 48 | /** |
49 | * The class has currently quite some duplicate code. | 49 | * The class has currently quite some duplicate code. |
50 | * By that way it would be real easy to have it as seperate app in settings tab | 50 | * By that way it would be real easy to have it as seperate app in settings tab |
51 | * | 51 | * |
52 | */ | 52 | */ |
53 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags fl ) | 53 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags fl ) |
54 | : QDialog( parent, name, modal, fl ) { | 54 | : QDialog( parent, name, modal, fl ) { |
55 | 55 | ||
56 | setCaption( tr( "Today config" ) ); | 56 | setCaption( tr( "Today config" ) ); |
57 | 57 | ||
58 | QVBoxLayout *layout = new QVBoxLayout( this ); | 58 | QVBoxLayout *layout = new QVBoxLayout( this ); |
59 | TabWidget3 = new QTabWidget( this, "TabWidget3" ); | 59 | TabWidget3 = new QTabWidget( this, "TabWidget3" ); |
60 | // TabWidget3->setFrameShape( QFrame::NoFrame ); | ||
61 | //TabWidget3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, TabWidget3->sizePolicy().hasHeightForWidth() ) ); | ||
62 | TabWidget3->setAutoMask( FALSE ); | 60 | TabWidget3->setAutoMask( FALSE ); |
63 | TabWidget3->setTabShape( QTabWidget::Rounded ); | 61 | TabWidget3->setTabShape( QTabWidget::Rounded ); |
64 | layout->addWidget( TabWidget3 ); | 62 | layout->addWidget( TabWidget3 ); |
65 | 63 | ||
66 | tab_2 = new QWidget( TabWidget3, "tab_2" ); | 64 | tab_2 = new QWidget( TabWidget3, "tab_2" ); |
67 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); | 65 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); |
68 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); | 66 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); |
69 | tab2Layout->addWidget( l ); | 67 | tab2Layout->addWidget( l ); |
70 | QHBox *hbox1 = new QHBox( tab_2 ); | 68 | QHBox *hbox1 = new QHBox( tab_2 ); |
71 | m_appletListView = new QListView( hbox1 ); | 69 | m_appletListView = new QListView( hbox1 ); |
72 | m_appletListView->addColumn( "PluginList" ); | 70 | m_appletListView->addColumn( "PluginList" ); |
73 | m_appletListView->header()->hide(); | 71 | m_appletListView->header()->hide(); |
74 | QVBox *vbox1 = new QVBox( hbox1 ); | 72 | QVBox *vbox1 = new QVBox( hbox1 ); |
75 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) ); | 73 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) ); |
76 | new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) ); | 74 | new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) ); |
77 | tab2Layout->addWidget( hbox1 ); | 75 | tab2Layout->addWidget( hbox1 ); |
78 | 76 | ||
79 | TabWidget3->insertTab( tab_2, tr( "active/order" ) ); | 77 | TabWidget3->insertTab( tab_2, tr( "active/order" ) ); |
80 | tab_3 = new QWidget( TabWidget3, "tab_3" ); | 78 | tab_3 = new QWidget( TabWidget3, "tab_3" ); |
81 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); | 79 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); |
82 | QHBox *hbox_clip = new QHBox( tab_3 ); | 80 | QHBox *hbox_clip = new QHBox( tab_3 ); |
83 | TextLabel1 = new QLabel( hbox_clip, "TextLabel1" ); | 81 | TextLabel1 = new QLabel( hbox_clip, "TextLabel1" ); |
84 | TextLabel1->setText( tr( "Clip after how\n" | 82 | TextLabel1->setText( tr( "Clip after how\n" |
85 | "many letters" ) ); | 83 | "many letters" ) ); |
@@ -101,49 +99,49 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags | |||
101 | m_applets_changed = false; | 99 | m_applets_changed = false; |
102 | 100 | ||
103 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); | 101 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); |
104 | 102 | ||
105 | readConfig(); | 103 | readConfig(); |
106 | showMaximized(); | 104 | showMaximized(); |
107 | } | 105 | } |
108 | 106 | ||
109 | 107 | ||
110 | /** | 108 | /** |
111 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 109 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
112 | * If registered against that today ist started on each resume. | 110 | * If registered against that today ist started on each resume. |
113 | */ | 111 | */ |
114 | void TodayConfig::setAutoStart() { | 112 | void TodayConfig::setAutoStart() { |
115 | Config cfg( "today" ); | 113 | Config cfg( "today" ); |
116 | cfg.setGroup( "Autostart" ); | 114 | cfg.setGroup( "Autostart" ); |
117 | int autostart = cfg.readNumEntry( "autostart", 1); | 115 | int autostart = cfg.readNumEntry( "autostart", 1); |
118 | if ( autostart ) { | 116 | if ( autostart ) { |
119 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); | 117 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); |
120 | e << QString( "add" ); | 118 | e << QString( "add" ); |
121 | e << QString( "today" ); | 119 | e << QString( "today" ); |
122 | e << m_autoStartTimer; | 120 | e << m_autoStartTimer; |
123 | } else { | 121 | } else { |
124 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); | 122 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); |
125 | e << QString( "remove"); | 123 | e << QString( "remove" ); |
126 | e << QString( "today" ); | 124 | e << QString( "today" ); |
127 | } | 125 | } |
128 | } | 126 | } |
129 | 127 | ||
130 | /** | 128 | /** |
131 | * Read the config part | 129 | * Read the config part |
132 | */ | 130 | */ |
133 | void TodayConfig::readConfig() { | 131 | void TodayConfig::readConfig() { |
134 | Config cfg( "today" ); | 132 | Config cfg( "today" ); |
135 | cfg.setGroup( "Autostart" ); | 133 | cfg.setGroup( "Autostart" ); |
136 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); | 134 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); |
137 | CheckBoxAuto->setChecked( m_autoStart ); | 135 | CheckBoxAuto->setChecked( m_autoStart ); |
138 | m_autoStartTimer = cfg.readEntry( "autostartdelay", "0" ); | 136 | m_autoStartTimer = cfg.readEntry( "autostartdelay", "0" ); |
139 | SpinBoxTime->setValue( m_autoStartTimer.toInt() ); | 137 | SpinBoxTime->setValue( m_autoStartTimer.toInt() ); |
140 | 138 | ||
141 | cfg.setGroup( "Applets" ); | 139 | cfg.setGroup( "Applets" ); |
142 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 140 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
143 | } | 141 | } |
144 | 142 | ||
145 | /** | 143 | /** |
146 | * Write the config part | 144 | * Write the config part |
147 | */ | 145 | */ |
148 | void TodayConfig::writeConfig() { | 146 | void TodayConfig::writeConfig() { |
149 | Config cfg( "today" ); | 147 | Config cfg( "today" ); |