summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-09-20 20:19:14 (UTC)
committer harlekin <harlekin>2002-09-20 20:19:14 (UTC)
commitd2d73b6391fbc7f743199f48387d13e887bbac1e (patch) (unidiff)
tree7f289628796ee4bf0bf1f32d952b5455a42b17bd
parent681e6e75efaa5577d376d0bb191afdf323cb4e75 (diff)
downloadopie-d2d73b6391fbc7f743199f48387d13e887bbac1e.zip
opie-d2d73b6391fbc7f743199f48387d13e887bbac1e.tar.gz
opie-d2d73b6391fbc7f743199f48387d13e887bbac1e.tar.bz2
fixed the crash when closing config dialog and also sorting of the plugins is working now
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp54
-rw-r--r--core/pim/today/today.h3
-rw-r--r--core/pim/today/todayconfig.cpp51
3 files changed, 66 insertions, 42 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 7537631..d8b427d 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -109,14 +109,10 @@ void Today::setOwnerField( QString &message ) {
109 */ 109 */
110void Today::init() { 110void Today::init() {
111
112 QDate date = QDate::currentDate();
113 QString time = ( tr( date.toString() ) );
114
115 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
116
117 // read config 111 // read config
118 Config cfg( "today" ); 112 Config cfg( "today" );
119 cfg.setGroup( "Applets" ); 113 cfg.setGroup( "Plugins" );
114
120 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 115 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
116 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
121} 117}
122 118
@@ -134,5 +130,4 @@ void Today::loadPlugins() {
134 pluginList.clear(); 130 pluginList.clear();
135 131
136
137 QString path = QPEApplication::qpeDir() + "/plugins/today"; 132 QString path = QPEApplication::qpeDir() + "/plugins/today";
138 QDir dir( path, "lib*.so" ); 133 QDir dir( path, "lib*.so" );
@@ -141,4 +136,7 @@ void Today::loadPlugins() {
141 QStringList::Iterator it; 136 QStringList::Iterator it;
142 137
138
139 QMap<QString, TodayPlugin> tempList;
140
143 for ( it = list.begin(); it != list.end(); ++it ) { 141 for ( it = list.begin(); it != list.end(); ++it ) {
144 TodayPluginInterface *iface = 0; 142 TodayPluginInterface *iface = 0;
@@ -165,10 +163,8 @@ void Today::loadPlugins() {
165 plugin.guiBox = new QWidget( this ); 163 plugin.guiBox = new QWidget( this );
166 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); 164 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
167
168 QPixmap plugPix; 165 QPixmap plugPix;
169 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); 166 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 );
170 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); 167 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
171 plugIcon->setPixmap( plugPix ); 168 plugIcon->setPixmap( plugPix );
172
173 // a scrollview for each plugin 169 // a scrollview for each plugin
174 QScrollView* sv = new QScrollView( plugin.guiBox ); 170 QScrollView* sv = new QScrollView( plugin.guiBox );
@@ -179,5 +175,4 @@ void Today::loadPlugins() {
179 sv->setFrameShape( QFrame::NoFrame ); 175 sv->setFrameShape( QFrame::NoFrame );
180 sv->addChild( plugWidget ); 176 sv->addChild( plugWidget );
181
182 // make sure the icon is on the top alligned 177 // make sure the icon is on the top alligned
183 boxLayout->addWidget( plugIcon, 0, AlignTop ); 178 boxLayout->addWidget( plugIcon, 0, AlignTop );
@@ -185,7 +180,12 @@ void Today::loadPlugins() {
185 boxLayout->setStretchFactor( plugIcon, 1 ); 180 boxLayout->setStretchFactor( plugIcon, 1 );
186 boxLayout->setStretchFactor( sv, 9 ); 181 boxLayout->setStretchFactor( sv, 9 );
187 layout->addWidget( plugin.guiBox ); 182 // "prebuffer" it in one more list, to get the sorting done
183 tempList.insert( plugin.name, plugin );
188 184
189 pluginList.append( plugin ); 185 // on first start the list is off course empty
186 if ( m_allApplets.isEmpty() ) {
187 layout->addWidget( plugin.guiBox );
188 pluginList.append( plugin );
189 }
190 } else { 190 } else {
191 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); 191 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
@@ -193,4 +193,16 @@ void Today::loadPlugins() {
193 } 193 }
194 } 194 }
195
196 if ( !m_allApplets.isEmpty() ) {
197 TodayPlugin tempPlugin;
198 QStringList::Iterator stringit;
199 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
200 tempPlugin = ( tempList.find( *stringit ) ).data();
201 if ( !( (tempPlugin.name).isEmpty() ) ) {
202 layout->addWidget( tempPlugin.guiBox );
203 pluginList.append( tempPlugin );
204 }
205 }
206 }
195} 207}
196 208
@@ -228,6 +240,5 @@ void Today::draw() {
228 layout->addWidget( noPluginsActive ); 240 layout->addWidget( noPluginsActive );
229 } 241 }
230 //layout->addStretch(0); 242 layout->addStretch(0);
231 //layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
232} 243}
233 244
@@ -242,10 +253,11 @@ void Today::startConfig() {
242 TodayPlugin plugin; 253 TodayPlugin plugin;
243 QList<ConfigWidget> configWidgetList; 254 QList<ConfigWidget> configWidgetList;
244 for ( uint i = 0; i < pluginList.count(); i++ ) { 255
256 for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) {
245 plugin = pluginList[i]; 257 plugin = pluginList[i];
246 258
247 // load the config widgets in the tabs 259 // load the config widgets in the tabs
248 if ( plugin.guiPart->configWidget( this ) != 0l ) { 260 if ( plugin.guiPart->configWidget( this ) != 0l ) {
249 ConfigWidget* widget = plugin.guiPart->configWidget( this ); 261 ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
250 configWidgetList.append( widget ); 262 configWidgetList.append( widget );
251 conf.TabWidget3->insertTab( widget, plugin.guiPart->appName() ); 263 conf.TabWidget3->insertTab( widget, plugin.guiPart->appName() );
@@ -275,4 +287,10 @@ void Today::refresh() {
275 init(); 287 init();
276 288
289 // set the date in top label
290 QDate date = QDate::currentDate();
291 QString time = ( tr( date.toString() ) );
292
293 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
294
277 if ( layout ) { 295 if ( layout ) {
278 delete layout; 296 delete layout;
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index 672adc4..b35c9b1 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -35,4 +35,5 @@ class QVBoxLayout;
35 35
36 36
37
37class Today : public TodayBase { 38class Today : public TodayBase {
38 39
@@ -56,5 +57,4 @@ private:
56 void draw(); 57 void draw();
57 58
58
59private slots: 59private slots:
60 void channelReceived(const QCString &msg, const QByteArray & data); 60 void channelReceived(const QCString &msg, const QByteArray & data);
@@ -63,4 +63,5 @@ private slots:
63 TodayConfig *conf; 63 TodayConfig *conf;
64 QStringList m_excludeApplets; 64 QStringList m_excludeApplets;
65 QStringList m_allApplets;
65 66
66 // QString m_autoStartTimer; 67 // QString m_autoStartTimer;
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index 4f23471..532d126 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -36,5 +36,4 @@ 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 );
39 setPixmap( Resource::loadPixmap( icon ) ); 38 setPixmap( Resource::loadPixmap( icon ) );
40 setAutoRaise( TRUE ); 39 setAutoRaise( TRUE );
@@ -70,27 +69,22 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags
70 m_appletListView->addColumn( "PluginList" ); 69 m_appletListView->addColumn( "PluginList" );
71 m_appletListView->header()->hide(); 70 m_appletListView->header()->hide();
71 m_appletListView->setSorting( -1 );
72 QVBox *vbox1 = new QVBox( hbox1 ); 72 QVBox *vbox1 = new QVBox( hbox1 );
73 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) ); 73 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", this , SLOT( moveSelectedUp() ) );
74 new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) ); 74 new ToolButton( vbox1, tr( "Move Down" ),"opieplayer/down", this , SLOT( moveSelectedDown() ) );
75 tab2Layout->addWidget( hbox1 ); 75 tab2Layout->addWidget( hbox1 );
76
77 TabWidget3->insertTab( tab_2, tr( "active/order" ) ); 76 TabWidget3->insertTab( tab_2, tr( "active/order" ) );
77
78 tab_3 = new QWidget( TabWidget3, "tab_3" ); 78 tab_3 = new QWidget( TabWidget3, "tab_3" );
79 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); 79 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 );
80 QHBox *hbox_clip = new QHBox( tab_3 ); 80 tab3Layout->setMargin( 20 );
81 TextLabel1 = new QLabel( hbox_clip, "TextLabel1" );
82 TextLabel1->setText( tr( "Clip after how\n"
83 "many letters" ) );
84 SpinBox7 = new QSpinBox( hbox_clip, "SpinBox7" );
85 SpinBox7->setMaxValue( 80 );
86 QHBox *hbox_auto = new QHBox( tab_3 ); 81 QHBox *hbox_auto = new QHBox( tab_3 );
87 TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); 82 TextLabel2 = new QLabel( hbox_auto, "AutoStart" );
88 TextLabel2->setText( tr( "autostart on \nresume? (Opie only)" ) ); 83 TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) );
89 CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); 84 CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" );
90 QHBox *hbox_inactive = new QHBox( tab_3 ); 85 QHBox *hbox_inactive = new QHBox( tab_3 );
91 TimeLabel = new QLabel( hbox_inactive , "TimeLabel" ); 86 TimeLabel = new QLabel( hbox_inactive , "TimeLabel" );
92 TimeLabel->setText( tr( "minutes inactive" ) ); 87 TimeLabel->setText( tr( "minutes inactive" ) );
93 SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner"); 88 SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" );
94 tab3Layout->addWidget( hbox_clip );
95 tab3Layout->addWidget( hbox_auto ); 89 tab3Layout->addWidget( hbox_auto );
96 tab3Layout->addWidget( hbox_inactive ); 90 tab3Layout->addWidget( hbox_inactive );
@@ -113,5 +107,5 @@ void TodayConfig::setAutoStart() {
113 Config cfg( "today" ); 107 Config cfg( "today" );
114 cfg.setGroup( "Autostart" ); 108 cfg.setGroup( "Autostart" );
115 int autostart = cfg.readNumEntry( "autostart", 1); 109 int autostart = cfg.readNumEntry( "autostart", 1 );
116 if ( autostart ) { 110 if ( autostart ) {
117 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); 111 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" );
@@ -137,5 +131,5 @@ void TodayConfig::readConfig() {
137 SpinBoxTime->setValue( m_autoStartTimer.toInt() ); 131 SpinBoxTime->setValue( m_autoStartTimer.toInt() );
138 132
139 cfg.setGroup( "Applets" ); 133 cfg.setGroup( "Plugins" );
140 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 134 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
141} 135}
@@ -146,23 +140,34 @@ void TodayConfig::readConfig() {
146void TodayConfig::writeConfig() { 140void TodayConfig::writeConfig() {
147 Config cfg( "today" ); 141 Config cfg( "today" );
148 cfg. setGroup ( "Applets" ); 142 cfg.setGroup( "Plugins" );
149 if ( m_applets_changed ) { 143 if ( m_applets_changed ) {
150 QStringList exclude; 144 QStringList exclude;
151 QStringList include; 145 QStringList include;
152 QMap <QString, QCheckListItem *>::Iterator it; 146 QStringList all_applets;
153 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { 147
154 if ( !(*it)-> isOn () ) { 148 QListViewItemIterator list_it( m_appletListView );
155 exclude << it.key(); 149
156 } else { 150 // this makes sure the names get saved in the order selected
157 include << it.key(); 151 for ( ; list_it.current(); ++list_it ) {
152 QMap <QString, QCheckListItem *>::Iterator it;
153 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) {
154 if ( list_it.current() == (*it) && !(*it)-> isOn () ) {
155 exclude << it.key();
156 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){
157 include << it.key();
158 }
159 if ( list_it.current() == (*it) ) {
160 all_applets << it.key();
161 }
158 } 162 }
159 } 163 }
160 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 164 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
161 cfg.writeEntry( "IncludeApplets", include, ',' ); 165 cfg.writeEntry( "IncludeApplets", include, ',' );
166 cfg.writeEntry( "AllApplets", all_applets, ',' );
162 } 167 }
163 168
164 cfg.setGroup( "Autostart" ); 169 cfg.setGroup( "Autostart" );
165 m_autoStart = CheckBoxAuto->isChecked(); 170 m_autoStart = CheckBoxAuto->isChecked();
166 cfg.writeEntry( "autostart", m_autoStart ); 171 cfg.writeEntry( "autostart", m_autoStart );
167 m_autoStartTimer = SpinBoxTime->value(); 172 m_autoStartTimer = SpinBoxTime->value();
168 cfg.readEntry( "autostartdelay", m_autoStartTimer ); 173 cfg.readEntry( "autostartdelay", m_autoStartTimer );
@@ -172,5 +177,5 @@ void TodayConfig::writeConfig() {
172void TodayConfig::moveSelectedUp() { 177void TodayConfig::moveSelectedUp() {
173 QListViewItem *item = m_appletListView->selectedItem(); 178 QListViewItem *item = m_appletListView->selectedItem();
174 if ( item && item->itemAbove() ) { 179 if ( item && item->itemAbove() ) {
175 item->itemAbove()->moveItem( item ); 180 item->itemAbove()->moveItem( item );
176 } 181 }
@@ -198,8 +203,8 @@ void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon
198 } 203 }
199 204
200 qDebug (" SUCHNAME: " + name );
201 if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { 205 if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) {
202 item->setOn( TRUE ); 206 item->setOn( TRUE );
203 } 207 }
208
204 m_applets[libName] = item; 209 m_applets[libName] = item;
205} 210}