summaryrefslogtreecommitdiff
path: root/core/pim/today
authorharlekin <harlekin>2002-09-20 20:19:14 (UTC)
committer harlekin <harlekin>2002-09-20 20:19:14 (UTC)
commitd2d73b6391fbc7f743199f48387d13e887bbac1e (patch) (side-by-side diff)
tree7f289628796ee4bf0bf1f32d952b5455a42b17bd /core/pim/today
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 (limited to 'core/pim/today') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/today.cpp50
-rw-r--r--core/pim/today/today.h3
-rw-r--r--core/pim/today/todayconfig.cpp35
3 files changed, 56 insertions, 32 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
@@ -110,12 +110,8 @@ void Today::setOwnerField( QString &message ) {
void Today::init() {
-
- QDate date = QDate::currentDate();
- QString time = ( tr( date.toString() ) );
-
- DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
-
// read config
Config cfg( "today" );
- cfg.setGroup( "Applets" );
+ cfg.setGroup( "Plugins" );
+
m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
+ m_allApplets = cfg.readListEntry( "AllApplets", ',' );
}
@@ -135,3 +131,2 @@ void Today::loadPlugins() {
-
QString path = QPEApplication::qpeDir() + "/plugins/today";
@@ -142,2 +137,5 @@ void Today::loadPlugins() {
+
+ QMap<QString, TodayPlugin> tempList;
+
for ( it = list.begin(); it != list.end(); ++it ) {
@@ -166,3 +164,2 @@ void Today::loadPlugins() {
QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
-
QPixmap plugPix;
@@ -171,3 +168,2 @@ void Today::loadPlugins() {
plugIcon->setPixmap( plugPix );
-
// a scrollview for each plugin
@@ -180,3 +176,2 @@ void Today::loadPlugins() {
sv->addChild( plugWidget );
-
// make sure the icon is on the top alligned
@@ -186,5 +181,10 @@ void Today::loadPlugins() {
boxLayout->setStretchFactor( sv, 9 );
- layout->addWidget( plugin.guiBox );
+ // "prebuffer" it in one more list, to get the sorting done
+ tempList.insert( plugin.name, plugin );
+ // on first start the list is off course empty
+ if ( m_allApplets.isEmpty() ) {
+ layout->addWidget( plugin.guiBox );
pluginList.append( plugin );
+ }
} else {
@@ -194,2 +194,14 @@ void Today::loadPlugins() {
}
+
+ if ( !m_allApplets.isEmpty() ) {
+ TodayPlugin tempPlugin;
+ QStringList::Iterator stringit;
+ for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
+ tempPlugin = ( tempList.find( *stringit ) ).data();
+ if ( !( (tempPlugin.name).isEmpty() ) ) {
+ layout->addWidget( tempPlugin.guiBox );
+ pluginList.append( tempPlugin );
+ }
+ }
+ }
}
@@ -229,4 +241,3 @@ void Today::draw() {
}
- //layout->addStretch(0);
- //layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
+ layout->addStretch(0);
}
@@ -243,3 +254,4 @@ void Today::startConfig() {
QList<ConfigWidget> configWidgetList;
- for ( uint i = 0; i < pluginList.count(); i++ ) {
+
+ for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) {
plugin = pluginList[i];
@@ -248,3 +260,3 @@ void Today::startConfig() {
if ( plugin.guiPart->configWidget( this ) != 0l ) {
- ConfigWidget* widget = plugin.guiPart->configWidget( this );
+ ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
configWidgetList.append( widget );
@@ -276,2 +288,8 @@ void Today::refresh() {
+ // set the date in top label
+ QDate date = QDate::currentDate();
+ QString time = ( tr( date.toString() ) );
+
+ DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
+
if ( 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
@@ -36,2 +36,3 @@ class QVBoxLayout;
+
class Today : public TodayBase {
@@ -57,3 +58,2 @@ private:
-
private slots:
@@ -64,2 +64,3 @@ private slots:
QStringList m_excludeApplets;
+ QStringList m_allApplets;
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
@@ -37,3 +37,2 @@ public:
: QToolButton( parent, name ) {
- // setTextLabel( name );
setPixmap( Resource::loadPixmap( icon ) );
@@ -71,2 +70,3 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags
m_appletListView->header()->hide();
+ m_appletListView->setSorting( -1 );
QVBox *vbox1 = new QVBox( hbox1 );
@@ -75,15 +75,10 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags
tab2Layout->addWidget( hbox1 );
-
TabWidget3->insertTab( tab_2, tr( "active/order" ) );
+
tab_3 = new QWidget( TabWidget3, "tab_3" );
QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 );
- QHBox *hbox_clip = new QHBox( tab_3 );
- TextLabel1 = new QLabel( hbox_clip, "TextLabel1" );
- TextLabel1->setText( tr( "Clip after how\n"
- "many letters" ) );
- SpinBox7 = new QSpinBox( hbox_clip, "SpinBox7" );
- SpinBox7->setMaxValue( 80 );
+ tab3Layout->setMargin( 20 );
QHBox *hbox_auto = new QHBox( tab_3 );
TextLabel2 = new QLabel( hbox_auto, "AutoStart" );
- TextLabel2->setText( tr( "autostart on \nresume? (Opie only)" ) );
+ TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) );
CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" );
@@ -93,3 +88,2 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags
SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner");
- tab3Layout->addWidget( hbox_clip );
tab3Layout->addWidget( hbox_auto );
@@ -138,3 +132,3 @@ void TodayConfig::readConfig() {
- cfg.setGroup( "Applets" );
+ cfg.setGroup( "Plugins" );
m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
@@ -147,3 +141,3 @@ void TodayConfig::writeConfig() {
Config cfg( "today" );
- cfg. setGroup ( "Applets" );
+ cfg.setGroup( "Plugins" );
if ( m_applets_changed ) {
@@ -151,9 +145,19 @@ void TodayConfig::writeConfig() {
QStringList include;
+ QStringList all_applets;
+
+ QListViewItemIterator list_it( m_appletListView );
+
+ // this makes sure the names get saved in the order selected
+ for ( ; list_it.current(); ++list_it ) {
QMap <QString, QCheckListItem *>::Iterator it;
for ( it = m_applets.begin(); it != m_applets. end (); ++it ) {
- if ( !(*it)-> isOn () ) {
+ if ( list_it.current() == (*it) && !(*it)-> isOn () ) {
exclude << it.key();
- } else {
+ } else if ( list_it.current() == (*it) && (*it)-> isOn () ){
include << it.key();
}
+ if ( list_it.current() == (*it) ) {
+ all_applets << it.key();
+ }
+ }
}
@@ -161,2 +165,3 @@ void TodayConfig::writeConfig() {
cfg.writeEntry( "IncludeApplets", include, ',' );
+ cfg.writeEntry( "AllApplets", all_applets, ',' );
}
@@ -199,3 +204,2 @@ void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon
- qDebug (" SUCHNAME: " + name );
if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) {
@@ -203,2 +207,3 @@ void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon
}
+
m_applets[libName] = item;