Diffstat (limited to 'core/pim/today/todayconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/today/todayconfig.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index 3fc5830..097965b 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp | |||
@@ -20,24 +20,25 @@ | |||
20 | #include <qpe/resource.h> | 20 | #include <qpe/resource.h> |
21 | #include <qpe/qcopenvelope_qws.h> | 21 | #include <qpe/qcopenvelope_qws.h> |
22 | 22 | ||
23 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
24 | #include <qlabel.h> | 24 | #include <qlabel.h> |
25 | #include <qspinbox.h> | 25 | #include <qspinbox.h> |
26 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qheader.h> | 28 | #include <qheader.h> |
29 | #include <qhbox.h> | 29 | #include <qhbox.h> |
30 | #include <qvbox.h> | 30 | #include <qvbox.h> |
31 | #include <qtoolbutton.h> | 31 | #include <qtoolbutton.h> |
32 | #include <qtooltip.h> | ||
32 | 33 | ||
33 | class ToolButton : public QToolButton { | 34 | class ToolButton : public QToolButton { |
34 | 35 | ||
35 | public: | 36 | public: |
36 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 37 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
37 | : QToolButton( parent, name ) { | 38 | : QToolButton( parent, name ) { |
38 | setPixmap( Resource::loadPixmap( icon ) ); | 39 | setPixmap( Resource::loadPixmap( icon ) ); |
39 | setAutoRaise( TRUE ); | 40 | setAutoRaise( TRUE ); |
40 | setFocusPolicy( QWidget::NoFocus ); | 41 | setFocusPolicy( QWidget::NoFocus ); |
41 | setToggleButton( t ); | 42 | setToggleButton( t ); |
42 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 43 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
43 | } | 44 | } |
@@ -72,70 +73,82 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal, WFlags | |||
72 | new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); | 73 | new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); |
73 | tab2Layout->addWidget( hbox1 ); | 74 | tab2Layout->addWidget( hbox1 ); |
74 | TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); | 75 | TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); |
75 | 76 | ||
76 | tab_3 = new QWidget( TabWidget3, "tab_3" ); | 77 | tab_3 = new QWidget( TabWidget3, "tab_3" ); |
77 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); | 78 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); |
78 | tab3Layout->setMargin( 20 ); | 79 | tab3Layout->setMargin( 20 ); |
79 | QHBox *hbox_auto = new QHBox( tab_3 ); | 80 | QHBox *hbox_auto = new QHBox( tab_3 ); |
80 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); | 81 | TextLabel2 = new QLabel( hbox_auto, "AutoStart" ); |
81 | TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); | 82 | TextLabel2->setText( tr( "autostart on \nresume?\n (Opie only)" ) ); |
82 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); | 83 | CheckBoxAuto = new QCheckBox( hbox_auto, "CheckBoxAuto" ); |
83 | QHBox *hbox_inactive = new QHBox( tab_3 ); | 84 | QHBox *hbox_inactive = new QHBox( tab_3 ); |
84 | TimeLabel = new QLabel( hbox_inactive , "TimeLabel" ); | 85 | TimeLabel = new QLabel( hbox_inactive, "TimeLabel" ); |
85 | TimeLabel->setText( tr( "minutes inactive" ) ); | 86 | TimeLabel->setText( tr( "minutes inactive" ) ); |
86 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" ); | 87 | SpinBoxTime = new QSpinBox( hbox_inactive, "TimeSpinner" ); |
88 | QHBox *hbox_iconSize = new QHBox( tab_3 ); | ||
89 | QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" ); | ||
90 | iconSizeLabel->setText( tr( "Icon size" ) ); | ||
91 | // iconSizeLabel->setToolTip( tr( "Set the icon size in pixel" ) ); | ||
92 | SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" ); | ||
93 | SpinBoxIconSize->setMaxValue( 32 ); | ||
94 | |||
87 | tab3Layout->addWidget( hbox_auto ); | 95 | tab3Layout->addWidget( hbox_auto ); |
88 | tab3Layout->addWidget( hbox_inactive ); | 96 | tab3Layout->addWidget( hbox_inactive ); |
97 | tab3Layout->addWidget( hbox_iconSize ); | ||
89 | TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); | 98 | TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); |
90 | 99 | ||
91 | m_applets_changed = false; | 100 | m_applets_changed = false; |
92 | 101 | ||
93 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); | 102 | connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); |
94 | 103 | ||
95 | readConfig(); | 104 | readConfig(); |
96 | showMaximized(); | 105 | showMaximized(); |
97 | } | 106 | } |
98 | 107 | ||
99 | 108 | ||
100 | /** | 109 | /** |
101 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 110 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
102 | * If registered against that today ist started on each resume. | 111 | * If registered against that today ist started on each resume. |
103 | */ | 112 | */ |
104 | void TodayConfig::setAutoStart() { | 113 | void TodayConfig::setAutoStart() { |
105 | Config cfg( "today" ); | 114 | Config cfg( "today" ); |
106 | cfg.setGroup( "Autostart" ); | 115 | cfg.setGroup( "Autostart" ); |
107 | if ( m_autoStart ) { | 116 | if ( m_autoStart ) { |
108 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); | 117 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); |
109 | e << QString( "add" ); | 118 | e << QString( "add" ); |
110 | e << QString( "today" ); | 119 | e << QString( "today" ); |
111 | e << QString("%1").arg( m_autoStartTimer ); | 120 | e << QString( "%1" ).arg( m_autoStartTimer ); |
112 | } else { | 121 | } else { |
113 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); | 122 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); |
114 | e << QString( "remove" ); | 123 | e << QString( "remove" ); |
115 | e << QString( "today" ); | 124 | e << QString( "today" ); |
116 | } | 125 | } |
117 | } | 126 | } |
118 | 127 | ||
119 | /** | 128 | /** |
120 | * Read the config part | 129 | * Read the config part |
121 | */ | 130 | */ |
122 | void TodayConfig::readConfig() { | 131 | void TodayConfig::readConfig() { |
123 | Config cfg( "today" ); | 132 | Config cfg( "today" ); |
124 | cfg.setGroup( "Autostart" ); | 133 | cfg.setGroup( "Autostart" ); |
125 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); | 134 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); |
126 | CheckBoxAuto->setChecked( m_autoStart ); | 135 | CheckBoxAuto->setChecked( m_autoStart ); |
127 | m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); | 136 | m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); |
128 | SpinBoxTime->setValue( m_autoStartTimer ); | 137 | SpinBoxTime->setValue( m_autoStartTimer ); |
129 | 138 | ||
139 | cfg.setGroup( "General" ); | ||
140 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | ||
141 | SpinBoxIconSize->setValue( m_iconSize ); | ||
142 | |||
130 | cfg.setGroup( "Plugins" ); | 143 | cfg.setGroup( "Plugins" ); |
131 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 144 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
132 | } | 145 | } |
133 | 146 | ||
134 | /** | 147 | /** |
135 | * Write the config part | 148 | * Write the config part |
136 | */ | 149 | */ |
137 | void TodayConfig::writeConfig() { | 150 | void TodayConfig::writeConfig() { |
138 | Config cfg( "today" ); | 151 | Config cfg( "today" ); |
139 | cfg.setGroup( "Plugins" ); | 152 | cfg.setGroup( "Plugins" ); |
140 | if ( m_applets_changed ) { | 153 | if ( m_applets_changed ) { |
141 | QStringList exclude; | 154 | QStringList exclude; |
@@ -159,24 +172,29 @@ void TodayConfig::writeConfig() { | |||
159 | } | 172 | } |
160 | } | 173 | } |
161 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); | 174 | cfg.writeEntry( "ExcludeApplets", exclude, ',' ); |
162 | cfg.writeEntry( "IncludeApplets", include, ',' ); | 175 | cfg.writeEntry( "IncludeApplets", include, ',' ); |
163 | cfg.writeEntry( "AllApplets", all_applets, ',' ); | 176 | cfg.writeEntry( "AllApplets", all_applets, ',' ); |
164 | } | 177 | } |
165 | 178 | ||
166 | cfg.setGroup( "Autostart" ); | 179 | cfg.setGroup( "Autostart" ); |
167 | m_autoStart = CheckBoxAuto->isChecked(); | 180 | m_autoStart = CheckBoxAuto->isChecked(); |
168 | cfg.writeEntry( "autostart", m_autoStart ); | 181 | cfg.writeEntry( "autostart", m_autoStart ); |
169 | m_autoStartTimer = SpinBoxTime->value(); | 182 | m_autoStartTimer = SpinBoxTime->value(); |
170 | cfg.writeEntry( "autostartdelay", m_autoStartTimer ); | 183 | cfg.writeEntry( "autostartdelay", m_autoStartTimer ); |
184 | m_iconSize = SpinBoxIconSize->value(); | ||
185 | |||
186 | cfg.setGroup( "General" ); | ||
187 | cfg.writeEntry( "IconSize", m_iconSize ); | ||
188 | |||
171 | 189 | ||
172 | // set autostart settings | 190 | // set autostart settings |
173 | setAutoStart(); | 191 | setAutoStart(); |
174 | } | 192 | } |
175 | 193 | ||
176 | 194 | ||
177 | void TodayConfig::moveSelectedUp() { | 195 | void TodayConfig::moveSelectedUp() { |
178 | QListViewItem *item = m_appletListView->selectedItem(); | 196 | QListViewItem *item = m_appletListView->selectedItem(); |
179 | if ( item && item->itemAbove() ) { | 197 | if ( item && item->itemAbove() ) { |
180 | item->itemAbove()->moveItem( item ); | 198 | item->itemAbove()->moveItem( item ); |
181 | } | 199 | } |
182 | } | 200 | } |