author | harlekin <harlekin> | 2003-12-10 22:34:29 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-12-10 22:34:29 (UTC) |
commit | 35e556fc2a9d07e6e2c73cac6f05cfb4c0c3e4f1 (patch) (unidiff) | |
tree | cf9c57d312570cc8d30946d53d6b0fc8c14d38f5 | |
parent | dffe105588cace5d96792155cee3a32a70a05017 (diff) | |
download | opie-35e556fc2a9d07e6e2c73cac6f05cfb4c0c3e4f1.zip opie-35e556fc2a9d07e6e2c73cac6f05cfb4c0c3e4f1.tar.gz opie-35e556fc2a9d07e6e2c73cac6f05cfb4c0c3e4f1.tar.bz2 |
less includes
-rw-r--r-- | core/settings/launcher/doctabsettings.cpp | 3 | ||||
-rw-r--r-- | core/settings/launcher/inputmethodsettings.cpp | 2 | ||||
-rw-r--r-- | core/settings/launcher/launchersettings.cpp | 1 | ||||
-rw-r--r-- | core/settings/launcher/main.cpp | 1 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 3 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 1 | ||||
-rw-r--r-- | core/settings/launcher/taskbarsettings.cpp | 1 | ||||
-rw-r--r-- | core/settings/security/main.cpp | 3 | ||||
-rw-r--r-- | core/settings/security/security.cpp | 1 |
9 files changed, 0 insertions, 16 deletions
diff --git a/core/settings/launcher/doctabsettings.cpp b/core/settings/launcher/doctabsettings.cpp index 8077b8c..179a7f9 100644 --- a/core/settings/launcher/doctabsettings.cpp +++ b/core/settings/launcher/doctabsettings.cpp | |||
@@ -1,71 +1,68 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | 3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
4 | .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> | 4 | .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "doctabsettings.h" | 29 | #include "doctabsettings.h" |
30 | 30 | ||
31 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
32 | #include <qpe/qlibrary.h> | ||
33 | #include <qpe/qpeapplication.h> | ||
34 | 32 | ||
35 | #include <qspinbox.h> | ||
36 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
37 | #include <qlayout.h> | 34 | #include <qlayout.h> |
38 | #include <qlabel.h> | 35 | #include <qlabel.h> |
39 | #include <qwhatsthis.h> | 36 | #include <qwhatsthis.h> |
40 | 37 | ||
41 | DocTabSettings::DocTabSettings( QWidget *parent, const char *name ):QWidget( parent, name ) | 38 | DocTabSettings::DocTabSettings( QWidget *parent, const char *name ):QWidget( parent, name ) |
42 | { | 39 | { |
43 | QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); | 40 | QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); |
44 | 41 | ||
45 | _enable = new QCheckBox( tr( "Enable the Documents Tab" ), this ); | 42 | _enable = new QCheckBox( tr( "Enable the Documents Tab" ), this ); |
46 | 43 | ||
47 | Config cfg( "Launcher" ); | 44 | Config cfg( "Launcher" ); |
48 | cfg.setGroup( "DocTab" ); | 45 | cfg.setGroup( "DocTab" ); |
49 | _enable->setChecked( cfg.readBoolEntry( "Enable", true ) ); | 46 | _enable->setChecked( cfg.readBoolEntry( "Enable", true ) ); |
50 | 47 | ||
51 | lay->addWidget( _enable ); | 48 | lay->addWidget( _enable ); |
52 | lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); | 49 | lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); |
53 | 50 | ||
54 | lay->addStretch(); | 51 | lay->addStretch(); |
55 | 52 | ||
56 | QWhatsThis::add( _enable, tr( "Check, if you want the Documents Tab to be visible." ) ); | 53 | QWhatsThis::add( _enable, tr( "Check, if you want the Documents Tab to be visible." ) ); |
57 | } | 54 | } |
58 | 55 | ||
59 | void DocTabSettings::appletChanged() | 56 | void DocTabSettings::appletChanged() |
60 | { | 57 | { |
61 | } | 58 | } |
62 | 59 | ||
63 | void DocTabSettings::accept() | 60 | void DocTabSettings::accept() |
64 | { | 61 | { |
65 | qDebug( "DocTabSettings::accept()" ); | 62 | qDebug( "DocTabSettings::accept()" ); |
66 | Config cfg( "Launcher" ); | 63 | Config cfg( "Launcher" ); |
67 | cfg.setGroup( "DocTab" ); | 64 | cfg.setGroup( "DocTab" ); |
68 | cfg.writeEntry( "Enable", _enable->isChecked() ); | 65 | cfg.writeEntry( "Enable", _enable->isChecked() ); |
69 | cfg.write(); | 66 | cfg.write(); |
70 | } | 67 | } |
71 | 68 | ||
diff --git a/core/settings/launcher/inputmethodsettings.cpp b/core/settings/launcher/inputmethodsettings.cpp index 147a00d..e342c09 100644 --- a/core/settings/launcher/inputmethodsettings.cpp +++ b/core/settings/launcher/inputmethodsettings.cpp | |||
@@ -1,86 +1,84 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | 3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
4 | .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> | 4 | .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "inputmethodsettings.h" | 29 | #include "inputmethodsettings.h" |
30 | 30 | ||
31 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
32 | #include <qpe/qlibrary.h> | ||
33 | #include <qpe/qpeapplication.h> | ||
34 | 32 | ||
35 | #include <qspinbox.h> | 33 | #include <qspinbox.h> |
36 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
37 | #include <qlayout.h> | 35 | #include <qlayout.h> |
38 | #include <qlabel.h> | 36 | #include <qlabel.h> |
39 | #include <qwhatsthis.h> | 37 | #include <qwhatsthis.h> |
40 | 38 | ||
41 | InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name ) | 39 | InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name ) |
42 | { | 40 | { |
43 | QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); | 41 | QBoxLayout *lay = new QVBoxLayout( this, 4, 4 ); |
44 | 42 | ||
45 | _resize = new QCheckBox( tr( "Resize application on Popup" ), this ); | 43 | _resize = new QCheckBox( tr( "Resize application on Popup" ), this ); |
46 | _float = new QCheckBox( tr( "Enable floating and resizing" ), this ); | 44 | _float = new QCheckBox( tr( "Enable floating and resizing" ), this ); |
47 | 45 | ||
48 | QHBoxLayout* hbox = new QHBoxLayout( lay, 4 ); | 46 | QHBoxLayout* hbox = new QHBoxLayout( lay, 4 ); |
49 | hbox->addWidget( new QLabel( "Initial Width:", this ) ); | 47 | hbox->addWidget( new QLabel( "Initial Width:", this ) ); |
50 | _size = new QSpinBox( 10, 100, 10, this ); | 48 | _size = new QSpinBox( 10, 100, 10, this ); |
51 | _size->setSuffix( "%" ); | 49 | _size->setSuffix( "%" ); |
52 | hbox->addWidget( _size ); | 50 | hbox->addWidget( _size ); |
53 | hbox->addStretch(); | 51 | hbox->addStretch(); |
54 | 52 | ||
55 | Config cfg( "Launcher" ); | 53 | Config cfg( "Launcher" ); |
56 | cfg.setGroup( "InputMethods" ); | 54 | cfg.setGroup( "InputMethods" ); |
57 | _resize->setChecked( cfg.readBoolEntry( "Resize", true ) ); | 55 | _resize->setChecked( cfg.readBoolEntry( "Resize", true ) ); |
58 | _float->setChecked( cfg.readBoolEntry( "Float", false ) ); | 56 | _float->setChecked( cfg.readBoolEntry( "Float", false ) ); |
59 | _size->setValue( cfg.readNumEntry( "Width", 100 ) ); | 57 | _size->setValue( cfg.readNumEntry( "Width", 100 ) ); |
60 | 58 | ||
61 | lay->addWidget( _resize ); | 59 | lay->addWidget( _resize ); |
62 | lay->addWidget( _float ); | 60 | lay->addWidget( _float ); |
63 | lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); | 61 | lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) ); |
64 | 62 | ||
65 | lay->addStretch(); | 63 | lay->addStretch(); |
66 | 64 | ||
67 | QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) ); | 65 | QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) ); |
68 | QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) ); | 66 | QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) ); |
69 | QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) ); | 67 | QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) ); |
70 | } | 68 | } |
71 | 69 | ||
72 | void InputMethodSettings::appletChanged() | 70 | void InputMethodSettings::appletChanged() |
73 | { | 71 | { |
74 | } | 72 | } |
75 | 73 | ||
76 | void InputMethodSettings::accept() | 74 | void InputMethodSettings::accept() |
77 | { | 75 | { |
78 | qDebug( "InputMethodSettings::accept()" ); | 76 | qDebug( "InputMethodSettings::accept()" ); |
79 | Config cfg( "Launcher" ); | 77 | Config cfg( "Launcher" ); |
80 | cfg.setGroup( "InputMethods" ); | 78 | cfg.setGroup( "InputMethods" ); |
81 | cfg.writeEntry( "Resize", _resize->isChecked() ); | 79 | cfg.writeEntry( "Resize", _resize->isChecked() ); |
82 | cfg.writeEntry( "Float", _float->isChecked() ); | 80 | cfg.writeEntry( "Float", _float->isChecked() ); |
83 | cfg.writeEntry( "Width", _size->value() ); | 81 | cfg.writeEntry( "Width", _size->value() ); |
84 | cfg.write(); | 82 | cfg.write(); |
85 | } | 83 | } |
86 | 84 | ||
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp index e129849..5c11cc8 100644 --- a/core/settings/launcher/launchersettings.cpp +++ b/core/settings/launcher/launchersettings.cpp | |||
@@ -1,80 +1,79 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | =. This file is part of the OPIE Project | 3 | =. This file is part of the OPIE Project |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qapplication.h> | ||
31 | 30 | ||
32 | #include <opie/otabwidget.h> | 31 | #include <opie/otabwidget.h> |
33 | 32 | ||
34 | #include "launchersettings.h" | 33 | #include "launchersettings.h" |
35 | #include "tabssettings.h" | 34 | #include "tabssettings.h" |
36 | #include "menusettings.h" | 35 | #include "menusettings.h" |
37 | #include "taskbarsettings.h" | 36 | #include "taskbarsettings.h" |
38 | #include "inputmethodsettings.h" | 37 | #include "inputmethodsettings.h" |
39 | #include "doctabsettings.h" | 38 | #include "doctabsettings.h" |
40 | 39 | ||
41 | LauncherSettings::LauncherSettings (QWidget*,const char*, WFlags) | 40 | LauncherSettings::LauncherSettings (QWidget*,const char*, WFlags) |
42 | : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp ) | 41 | : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp ) |
43 | { | 42 | { |
44 | setCaption ( tr( "Launcher Settings" )); | 43 | setCaption ( tr( "Launcher Settings" )); |
45 | 44 | ||
46 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 45 | QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); |
47 | 46 | ||
48 | OTabWidget *tw = new OTabWidget ( this, "otab" ); | 47 | OTabWidget *tw = new OTabWidget ( this, "otab" ); |
49 | lay-> addWidget ( tw ); | 48 | lay-> addWidget ( tw ); |
50 | 49 | ||
51 | m_tabs = new TabsSettings ( tw ); | 50 | m_tabs = new TabsSettings ( tw ); |
52 | m_taskbar = new TaskbarSettings ( tw ); | 51 | m_taskbar = new TaskbarSettings ( tw ); |
53 | m_menu = new MenuSettings ( tw ); | 52 | m_menu = new MenuSettings ( tw ); |
54 | m_imethods = new InputMethodSettings ( tw ); | 53 | m_imethods = new InputMethodSettings ( tw ); |
55 | m_doctab = new DocTabSettings ( tw ); | 54 | m_doctab = new DocTabSettings ( tw ); |
56 | 55 | ||
57 | tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" )); | 56 | tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" )); |
58 | tw-> addTab ( m_menu, "go", tr( "O-Menu" )); | 57 | tw-> addTab ( m_menu, "go", tr( "O-Menu" )); |
59 | tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); | 58 | tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); |
60 | tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" )); | 59 | tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" )); |
61 | tw-> addTab ( m_doctab, "DocsIcon", tr( "DocTab" ) ); | 60 | tw-> addTab ( m_doctab, "DocsIcon", tr( "DocTab" ) ); |
62 | tw-> setCurrentTab ( m_taskbar ); | 61 | tw-> setCurrentTab ( m_taskbar ); |
63 | } | 62 | } |
64 | 63 | ||
65 | void LauncherSettings::accept ( ) | 64 | void LauncherSettings::accept ( ) |
66 | { | 65 | { |
67 | m_taskbar-> accept ( ); | 66 | m_taskbar-> accept ( ); |
68 | m_menu-> accept ( ); | 67 | m_menu-> accept ( ); |
69 | m_tabs-> accept ( ); | 68 | m_tabs-> accept ( ); |
70 | m_imethods-> accept ( ); | 69 | m_imethods-> accept ( ); |
71 | m_doctab-> accept ( ); | 70 | m_doctab-> accept ( ); |
72 | 71 | ||
73 | QDialog::accept ( ); | 72 | QDialog::accept ( ); |
74 | } | 73 | } |
75 | 74 | ||
76 | void LauncherSettings::done ( int r ) | 75 | void LauncherSettings::done ( int r ) |
77 | { | 76 | { |
78 | QDialog::done ( r ); | 77 | QDialog::done ( r ); |
79 | close ( ); | 78 | close ( ); |
80 | } | 79 | } |
diff --git a/core/settings/launcher/main.cpp b/core/settings/launcher/main.cpp index 4cc1d35..bcfdcf6 100644 --- a/core/settings/launcher/main.cpp +++ b/core/settings/launcher/main.cpp | |||
@@ -1,35 +1,34 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "launchersettings.h" | 28 | #include "launchersettings.h" |
29 | 29 | ||
30 | #include <qpe/qpeapplication.h> | ||
31 | #include <opie/oapplicationfactory.h> | 30 | #include <opie/oapplicationfactory.h> |
32 | 31 | ||
33 | OPIE_EXPORT_APP( OApplicationFactory<LauncherSettings> ) | 32 | OPIE_EXPORT_APP( OApplicationFactory<LauncherSettings> ) |
34 | 33 | ||
35 | 34 | ||
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index de99a09..f79ad40 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -1,516 +1,513 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/config.h> | ||
30 | #include <qpe/applnk.h> | ||
31 | 29 | ||
32 | #include <qlayout.h> | 30 | #include <qlayout.h> |
33 | #include <qvbox.h> | 31 | #include <qvbox.h> |
34 | #include <qtabbar.h> | 32 | #include <qtabbar.h> |
35 | #include <qiconview.h> | 33 | #include <qiconview.h> |
36 | #include <qapplication.h> | 34 | #include <qapplication.h> |
37 | #include <qlabel.h> | 35 | #include <qlabel.h> |
38 | #include <qradiobutton.h> | 36 | #include <qradiobutton.h> |
39 | #include <qbuttongroup.h> | 37 | #include <qbuttongroup.h> |
40 | #include <qpushbutton.h> | ||
41 | #include <qwhatsthis.h> | 38 | #include <qwhatsthis.h> |
42 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
43 | 40 | ||
44 | #include <opie/ofontselector.h> | 41 | #include <opie/ofontselector.h> |
45 | #include <opie/otabwidget.h> | 42 | #include <opie/otabwidget.h> |
46 | #include <opie/ocolorbutton.h> | 43 | #include <opie/ocolorbutton.h> |
47 | #include <opie/ofiledialog.h> | 44 | #include <opie/ofiledialog.h> |
48 | 45 | ||
49 | #include "tabdialog.h" | 46 | #include "tabdialog.h" |
50 | 47 | ||
51 | 48 | ||
52 | class SampleItem : public QIconViewItem { | 49 | class SampleItem : public QIconViewItem { |
53 | public: | 50 | public: |
54 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) | 51 | SampleItem ( QIconView *v, const QString &text, const QPixmap &pix ) : QIconViewItem ( v, text ) |
55 | { | 52 | { |
56 | m_large = pix; | 53 | m_large = pix; |
57 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); | 54 | m_small. convertFromImage ( pix. convertToImage ( ). smoothScale ( pix. width ( ) / 2, pix. height ( ) / 2 )); |
58 | } | 55 | } |
59 | 56 | ||
60 | void sizeChange ( ) | 57 | void sizeChange ( ) |
61 | { | 58 | { |
62 | calcRect ( ); | 59 | calcRect ( ); |
63 | repaint ( ); | 60 | repaint ( ); |
64 | } | 61 | } |
65 | 62 | ||
66 | QPixmap *pixmap ( ) const | 63 | QPixmap *pixmap ( ) const |
67 | { | 64 | { |
68 | if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) | 65 | if ( iconView ( )-> itemTextPos ( ) == QIconView::Right ) |
69 | return (QPixmap *) &m_small; | 66 | return (QPixmap *) &m_small; |
70 | else | 67 | else |
71 | return (QPixmap *) &m_large; | 68 | return (QPixmap *) &m_large; |
72 | } | 69 | } |
73 | 70 | ||
74 | private: | 71 | private: |
75 | QPixmap m_large, m_small; | 72 | QPixmap m_large, m_small; |
76 | }; | 73 | }; |
77 | 74 | ||
78 | class SampleView : public QIconView { | 75 | class SampleView : public QIconView { |
79 | public: | 76 | public: |
80 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) | 77 | SampleView ( QWidget *parent = 0, const char *name = 0 ) : QIconView ( parent, name ) |
81 | { | 78 | { |
82 | setItemsMovable ( false ); | 79 | setItemsMovable ( false ); |
83 | setAutoArrange ( true ); | 80 | setAutoArrange ( true ); |
84 | setSorting ( true ); | 81 | setSorting ( true ); |
85 | setFrameStyle ( QFrame::NoFrame ); | 82 | setFrameStyle ( QFrame::NoFrame ); |
86 | setSpacing ( 4 ); | 83 | setSpacing ( 4 ); |
87 | setMargin ( 0 ); | 84 | setMargin ( 0 ); |
88 | setSelectionMode ( QIconView::NoSelection ); | 85 | setSelectionMode ( QIconView::NoSelection ); |
89 | setBackgroundMode ( PaletteBase ); | 86 | setBackgroundMode ( PaletteBase ); |
90 | setViewMode ( TabConfig::Icon ); | 87 | setViewMode ( TabConfig::Icon ); |
91 | calculateGrid ( Bottom ); | 88 | calculateGrid ( Bottom ); |
92 | 89 | ||
93 | 90 | ||
94 | new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); | 91 | new SampleItem ( this, QObject::tr( "Sample 1" ), Resource::loadPixmap ( "datebook/DateBook" )); |
95 | new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); | 92 | new SampleItem ( this, QObject::tr( "Sample 2" ), Resource::loadPixmap ( "Calibrate" )); |
96 | new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); | 93 | new SampleItem ( this, QObject::tr( "Sample 3" ), Resource::loadPixmap ( "UnknownDocument" )); |
97 | 94 | ||
98 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 95 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
99 | 96 | ||
100 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); | 97 | setMaximumHeight ( firstItem ( )-> height ( ) + 16 ); |
101 | } | 98 | } |
102 | 99 | ||
103 | void setViewMode ( TabConfig::ViewMode m ) | 100 | void setViewMode ( TabConfig::ViewMode m ) |
104 | { | 101 | { |
105 | viewport ( )-> setUpdatesEnabled ( false ); | 102 | viewport ( )-> setUpdatesEnabled ( false ); |
106 | 103 | ||
107 | switch ( m ) { | 104 | switch ( m ) { |
108 | case TabConfig::List: | 105 | case TabConfig::List: |
109 | setItemTextPos( QIconView::Right ); | 106 | setItemTextPos( QIconView::Right ); |
110 | break; | 107 | break; |
111 | case TabConfig::Icon: | 108 | case TabConfig::Icon: |
112 | setItemTextPos( QIconView::Bottom ); | 109 | setItemTextPos( QIconView::Bottom ); |
113 | break; | 110 | break; |
114 | } | 111 | } |
115 | // hideOrShowItems ( false ); | 112 | // hideOrShowItems ( false ); |
116 | 113 | ||
117 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) | 114 | for ( QIconViewItem *it = firstItem ( ); it; it = it-> nextItem ( )) |
118 | ((SampleItem *) it )-> sizeChange ( ); | 115 | ((SampleItem *) it )-> sizeChange ( ); |
119 | arrangeItemsInGrid ( true ); | 116 | arrangeItemsInGrid ( true ); |
120 | viewport ( )-> setUpdatesEnabled ( true ); | 117 | viewport ( )-> setUpdatesEnabled ( true ); |
121 | update ( ); | 118 | update ( ); |
122 | } | 119 | } |
123 | 120 | ||
124 | 121 | ||
125 | void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) | 122 | void setBackgroundType( TabConfig::BackgroundType t, const QString &val ) |
126 | { | 123 | { |
127 | switch ( t ) { | 124 | switch ( t ) { |
128 | case TabConfig::Ruled: { | 125 | case TabConfig::Ruled: { |
129 | QPixmap bg ( width ( ), 9 ); | 126 | QPixmap bg ( width ( ), 9 ); |
130 | QPainter painter ( &bg ); | 127 | QPainter painter ( &bg ); |
131 | for ( int i = 0; i < 3; i++ ) { | 128 | for ( int i = 0; i < 3; i++ ) { |
132 | painter. setPen ( white ); | 129 | painter. setPen ( white ); |
133 | painter. drawLine ( 0, i*3, width()-1, i*3 ); | 130 | painter. drawLine ( 0, i*3, width()-1, i*3 ); |
134 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); | 131 | painter. drawLine ( 0, i*3+1, width()-1, i*3+1 ); |
135 | painter. setPen ( colorGroup().background().light(105) ); | 132 | painter. setPen ( colorGroup().background().light(105) ); |
136 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); | 133 | painter. drawLine ( 0, i*3+2, width()-1, i*3+2 ); |
137 | } | 134 | } |
138 | painter.end ( ); | 135 | painter.end ( ); |
139 | setBackgroundPixmap ( bg ); | 136 | setBackgroundPixmap ( bg ); |
140 | break; | 137 | break; |
141 | } | 138 | } |
142 | 139 | ||
143 | case TabConfig::SolidColor: { | 140 | case TabConfig::SolidColor: { |
144 | setBackgroundPixmap ( QPixmap ( )); | 141 | setBackgroundPixmap ( QPixmap ( )); |
145 | if ( val. isEmpty ( )) | 142 | if ( val. isEmpty ( )) |
146 | setBackgroundColor ( colorGroup ( ). base ( )); | 143 | setBackgroundColor ( colorGroup ( ). base ( )); |
147 | else | 144 | else |
148 | setBackgroundColor ( val ); | 145 | setBackgroundColor ( val ); |
149 | break; | 146 | break; |
150 | } | 147 | } |
151 | 148 | ||
152 | case TabConfig::Image: { | 149 | case TabConfig::Image: { |
153 | qDebug( "Loading image: %s", val.latin1() ); | 150 | qDebug( "Loading image: %s", val.latin1() ); |
154 | QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); | 151 | QPixmap bg ( Resource::loadPixmap ( "wallpaper/" + val )); |
155 | if ( bg. isNull ( )) { | 152 | if ( bg. isNull ( )) { |
156 | QImageIO imgio; | 153 | QImageIO imgio; |
157 | imgio. setFileName ( val ); | 154 | imgio. setFileName ( val ); |
158 | QSize ds = qApp-> desktop ( )-> size ( ); | 155 | QSize ds = qApp-> desktop ( )-> size ( ); |
159 | QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr | 156 | QString param ( "Scale( %1, %2, ScaleMin )" ); // No tr |
160 | imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); | 157 | imgio. setParameters ( param. arg ( ds. width ( )). arg ( ds. height ( )). latin1 ( )); |
161 | imgio. read ( ); | 158 | imgio. read ( ); |
162 | bg = imgio. image ( ); | 159 | bg = imgio. image ( ); |
163 | } | 160 | } |
164 | setBackgroundPixmap ( bg ); | 161 | setBackgroundPixmap ( bg ); |
165 | break; | 162 | break; |
166 | } | 163 | } |
167 | } | 164 | } |
168 | m_bgtype = t; | 165 | m_bgtype = t; |
169 | viewport ( )-> update ( ); | 166 | viewport ( )-> update ( ); |
170 | } | 167 | } |
171 | 168 | ||
172 | void setTextColor ( const QColor &tc ) | 169 | void setTextColor ( const QColor &tc ) |
173 | { | 170 | { |
174 | m_textcolor = tc; | 171 | m_textcolor = tc; |
175 | QColorGroup cg = colorGroup ( ); | 172 | QColorGroup cg = colorGroup ( ); |
176 | cg. setColor ( QColorGroup::Text, tc ); | 173 | cg. setColor ( QColorGroup::Text, tc ); |
177 | setPalette ( QPalette ( cg, cg, cg )); | 174 | setPalette ( QPalette ( cg, cg, cg )); |
178 | viewport ( )-> update ( ); | 175 | viewport ( )-> update ( ); |
179 | } | 176 | } |
180 | 177 | ||
181 | void setViewFont ( const QFont &f ) | 178 | void setViewFont ( const QFont &f ) |
182 | { | 179 | { |
183 | setFont ( f ); | 180 | setFont ( f ); |
184 | } | 181 | } |
185 | 182 | ||
186 | void setItemTextPos ( ItemTextPos pos ) | 183 | void setItemTextPos ( ItemTextPos pos ) |
187 | { | 184 | { |
188 | calculateGrid ( pos ); | 185 | calculateGrid ( pos ); |
189 | QIconView::setItemTextPos( pos ); | 186 | QIconView::setItemTextPos( pos ); |
190 | } | 187 | } |
191 | 188 | ||
192 | void calculateGrid ( ItemTextPos pos ) | 189 | void calculateGrid ( ItemTextPos pos ) |
193 | { | 190 | { |
194 | int dw = QApplication::desktop ( )-> width ( ); | 191 | int dw = QApplication::desktop ( )-> width ( ); |
195 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); | 192 | int viewerWidth = dw - style ( ).scrollBarExtent ( ). width ( ); |
196 | if ( pos == Bottom ) { | 193 | if ( pos == Bottom ) { |
197 | int cols = 3; | 194 | int cols = 3; |
198 | if ( viewerWidth <= 200 ) | 195 | if ( viewerWidth <= 200 ) |
199 | cols = 2; | 196 | cols = 2; |
200 | else if ( viewerWidth >= 400 ) | 197 | else if ( viewerWidth >= 400 ) |
201 | cols = viewerWidth/96; | 198 | cols = viewerWidth/96; |
202 | setSpacing ( 4 ); | 199 | setSpacing ( 4 ); |
203 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 200 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
204 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); | 201 | setGridY ( fontMetrics ( ). height ( ) * 2 + 24 ); |
205 | } | 202 | } |
206 | else { | 203 | else { |
207 | int cols = 2; | 204 | int cols = 2; |
208 | if ( viewerWidth < 150 ) | 205 | if ( viewerWidth < 150 ) |
209 | cols = 1; | 206 | cols = 1; |
210 | else if ( viewerWidth >= 400 ) | 207 | else if ( viewerWidth >= 400 ) |
211 | cols = viewerWidth / 150; | 208 | cols = viewerWidth / 150; |
212 | setSpacing ( 2 ); | 209 | setSpacing ( 2 ); |
213 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); | 210 | setGridX (( viewerWidth - ( cols + 1 ) * spacing ( )) / cols ); |
214 | setGridY ( fontMetrics ( ). height ( ) + 2 ); | 211 | setGridY ( fontMetrics ( ). height ( ) + 2 ); |
215 | } | 212 | } |
216 | } | 213 | } |
217 | 214 | ||
218 | void paletteChange( const QPalette &p ) | 215 | void paletteChange( const QPalette &p ) |
219 | { | 216 | { |
220 | static bool excllock = false; | 217 | static bool excllock = false; |
221 | 218 | ||
222 | if ( excllock ) | 219 | if ( excllock ) |
223 | return; | 220 | return; |
224 | excllock = true; | 221 | excllock = true; |
225 | 222 | ||
226 | unsetPalette ( ); | 223 | unsetPalette ( ); |
227 | QIconView::paletteChange ( p ); | 224 | QIconView::paletteChange ( p ); |
228 | if ( m_bgtype == TabConfig::Ruled ) | 225 | if ( m_bgtype == TabConfig::Ruled ) |
229 | setBackgroundType ( TabConfig::Ruled, QString::null ); | 226 | setBackgroundType ( TabConfig::Ruled, QString::null ); |
230 | QColorGroup cg = colorGroup ( ); | 227 | QColorGroup cg = colorGroup ( ); |
231 | cg.setColor ( QColorGroup::Text, m_textcolor ); | 228 | cg.setColor ( QColorGroup::Text, m_textcolor ); |
232 | setPalette ( QPalette ( cg, cg, cg )); | 229 | setPalette ( QPalette ( cg, cg, cg )); |
233 | 230 | ||
234 | excllock = false; | 231 | excllock = false; |
235 | } | 232 | } |
236 | 233 | ||
237 | void setBackgroundPixmap ( const QPixmap &pm ) | 234 | void setBackgroundPixmap ( const QPixmap &pm ) |
238 | { | 235 | { |
239 | m_bgpix = pm; | 236 | m_bgpix = pm; |
240 | } | 237 | } |
241 | 238 | ||
242 | void setBackgroundColor ( const QColor &c ) | 239 | void setBackgroundColor ( const QColor &c ) |
243 | { | 240 | { |
244 | m_bgcolor = c; | 241 | m_bgcolor = c; |
245 | } | 242 | } |
246 | 243 | ||
247 | void drawBackground ( QPainter *p, const QRect &r ) | 244 | void drawBackground ( QPainter *p, const QRect &r ) |
248 | { | 245 | { |
249 | if ( !m_bgpix. isNull ( )) { | 246 | if ( !m_bgpix. isNull ( )) { |
250 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), | 247 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), |
251 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); | 248 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); |
252 | } | 249 | } |
253 | else | 250 | else |
254 | p-> fillRect ( r, m_bgcolor ); | 251 | p-> fillRect ( r, m_bgcolor ); |
255 | } | 252 | } |
256 | 253 | ||
257 | private: | 254 | private: |
258 | QColor m_textcolor; | 255 | QColor m_textcolor; |
259 | QColor m_bgcolor; | 256 | QColor m_bgcolor; |
260 | QPixmap m_bgpix; | 257 | QPixmap m_bgpix; |
261 | TabConfig::BackgroundType m_bgtype; | 258 | TabConfig::BackgroundType m_bgtype; |
262 | }; | 259 | }; |
263 | 260 | ||
264 | 261 | ||
265 | 262 | ||
266 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) | 263 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) |
267 | : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) | 264 | : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) |
268 | { | 265 | { |
269 | setCaption ( tr( "Edit Tab" )); | 266 | setCaption ( tr( "Edit Tab" )); |
270 | 267 | ||
271 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); | 268 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); |
272 | 269 | ||
273 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 270 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
274 | QWidget *bgtab; | 271 | QWidget *bgtab; |
275 | 272 | ||
276 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); | 273 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); |
277 | tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); | 274 | tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); |
278 | tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); | 275 | tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); |
279 | 276 | ||
280 | tw-> setCurrentTab ( bgtab ); | 277 | tw-> setCurrentTab ( bgtab ); |
281 | 278 | ||
282 | QWidget *sample = new QVBox ( this ); | 279 | QWidget *sample = new QVBox ( this ); |
283 | QTabBar *tb = new QTabBar ( sample ); | 280 | QTabBar *tb = new QTabBar ( sample ); |
284 | QString name ( tr( "Previewing %1" ). arg ( tabname )); | 281 | QString name ( tr( "Previewing %1" ). arg ( tabname )); |
285 | 282 | ||
286 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); | 283 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); |
287 | 284 | ||
288 | m_sample = new SampleView ( sample ); | 285 | m_sample = new SampleView ( sample ); |
289 | 286 | ||
290 | lay-> addWidget ( tw, 10 ); | 287 | lay-> addWidget ( tw, 10 ); |
291 | lay-> addWidget ( sample, 1 ); | 288 | lay-> addWidget ( sample, 1 ); |
292 | 289 | ||
293 | m_iconsize-> setButton ( tc. m_view ); | 290 | m_iconsize-> setButton ( tc. m_view ); |
294 | iconSizeClicked ( tc. m_view ); | 291 | iconSizeClicked ( tc. m_view ); |
295 | //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); | 292 | //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); |
296 | iconColorClicked ( m_iconcolor-> color ( )); | 293 | iconColorClicked ( m_iconcolor-> color ( )); |
297 | m_bgtype-> setButton ( tc. m_bg_type ); | 294 | m_bgtype-> setButton ( tc. m_bg_type ); |
298 | //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); | 295 | //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); |
299 | m_bgimage = tc. m_bg_image; | 296 | m_bgimage = tc. m_bg_image; |
300 | bgTypeClicked ( tc. m_bg_type ); | 297 | bgTypeClicked ( tc. m_bg_type ); |
301 | m_fontuse-> setChecked ( tc. m_font_use ); | 298 | m_fontuse-> setChecked ( tc. m_font_use ); |
302 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); | 299 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); |
303 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); | 300 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); |
304 | fontClicked ( m_fontselect-> selectedFont ( )); | 301 | fontClicked ( m_fontselect-> selectedFont ( )); |
305 | 302 | ||
306 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); | 303 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); |
307 | } | 304 | } |
308 | 305 | ||
309 | 306 | ||
310 | TabDialog::~TabDialog ( ) | 307 | TabDialog::~TabDialog ( ) |
311 | { | 308 | { |
312 | } | 309 | } |
313 | 310 | ||
314 | QWidget *TabDialog::createFontTab ( QWidget *parent ) | 311 | QWidget *TabDialog::createFontTab ( QWidget *parent ) |
315 | { | 312 | { |
316 | QWidget *tab = new QWidget ( parent, "FontTab" ); | 313 | QWidget *tab = new QWidget ( parent, "FontTab" ); |
317 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); | 314 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); |
318 | 315 | ||
319 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); | 316 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); |
320 | vertLayout-> addWidget ( m_fontuse ); | 317 | vertLayout-> addWidget ( m_fontuse ); |
321 | 318 | ||
322 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); | 319 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); |
323 | vertLayout-> addWidget ( m_fontselect ); | 320 | vertLayout-> addWidget ( m_fontselect ); |
324 | 321 | ||
325 | connect ( m_fontuse, SIGNAL( toggled ( bool )), m_fontselect, SLOT( setEnabled ( bool ))); | 322 | connect ( m_fontuse, SIGNAL( toggled ( bool )), m_fontselect, SLOT( setEnabled ( bool ))); |
326 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), | 323 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), |
327 | this, SLOT( fontClicked ( const QFont & ))); | 324 | this, SLOT( fontClicked ( const QFont & ))); |
328 | 325 | ||
329 | return tab; | 326 | return tab; |
330 | } | 327 | } |
331 | 328 | ||
332 | QWidget *TabDialog::createBgTab ( QWidget *parent ) | 329 | QWidget *TabDialog::createBgTab ( QWidget *parent ) |
333 | { | 330 | { |
334 | QWidget *tab = new QWidget( parent, "BgTab" ); | 331 | QWidget *tab = new QWidget( parent, "BgTab" ); |
335 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 332 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
336 | 333 | ||
337 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 334 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
338 | gridLayout-> setColStretch ( 1, 10 ); | 335 | gridLayout-> setColStretch ( 1, 10 ); |
339 | 336 | ||
340 | QLabel* label = new QLabel( tr( "Type:" ), tab ); | 337 | QLabel* label = new QLabel( tr( "Type:" ), tab ); |
341 | gridLayout-> addWidget ( label, 0, 0 ); | 338 | gridLayout-> addWidget ( label, 0, 0 ); |
342 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); | 339 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); |
343 | m_bgtype-> hide ( ); | 340 | m_bgtype-> hide ( ); |
344 | m_bgtype-> setExclusive ( true ); | 341 | m_bgtype-> setExclusive ( true ); |
345 | 342 | ||
346 | QRadioButton *rb; | 343 | QRadioButton *rb; |
347 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); | 344 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); |
348 | m_bgtype-> insert ( rb, TabConfig::Ruled ); | 345 | m_bgtype-> insert ( rb, TabConfig::Ruled ); |
349 | gridLayout-> addWidget( rb, 0, 1 ); | 346 | gridLayout-> addWidget( rb, 0, 1 ); |
350 | 347 | ||
351 | QHBoxLayout *hb = new QHBoxLayout ( ); | 348 | QHBoxLayout *hb = new QHBoxLayout ( ); |
352 | hb-> setSpacing ( 3 ); | 349 | hb-> setSpacing ( 3 ); |
353 | 350 | ||
354 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); | 351 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); |
355 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); | 352 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); |
356 | hb-> addWidget ( rb ); | 353 | hb-> addWidget ( rb ); |
357 | hb-> addSpacing ( 10 ); | 354 | hb-> addSpacing ( 10 ); |
358 | 355 | ||
359 | m_solidcolor = new OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); | 356 | m_solidcolor = new OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); |
360 | connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); | 357 | connect ( m_solidcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( bgColorClicked ( const QColor & ))); |
361 | hb-> addWidget ( m_solidcolor ); | 358 | hb-> addWidget ( m_solidcolor ); |
362 | hb-> addStretch ( 10 ); | 359 | hb-> addStretch ( 10 ); |
363 | 360 | ||
364 | gridLayout-> addLayout ( hb, 1, 1 ); | 361 | gridLayout-> addLayout ( hb, 1, 1 ); |
365 | 362 | ||
366 | hb = new QHBoxLayout ( ); | 363 | hb = new QHBoxLayout ( ); |
367 | hb-> setSpacing ( 3 ); | 364 | hb-> setSpacing ( 3 ); |
368 | 365 | ||
369 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); | 366 | rb = new QRadioButton( tr( "Image" ), tab, "image" ); |
370 | m_bgtype-> insert ( rb, TabConfig::Image ); | 367 | m_bgtype-> insert ( rb, TabConfig::Image ); |
371 | hb-> addWidget( rb ); | 368 | hb-> addWidget( rb ); |
372 | hb-> addSpacing ( 10 ); | 369 | hb-> addSpacing ( 10 ); |
373 | 370 | ||
374 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); | 371 | m_imagebrowse = new QPushButton ( tr( "Select..." ), tab ); |
375 | connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); | 372 | connect ( m_imagebrowse, SIGNAL( clicked ( )), this, SLOT( bgImageClicked ( ))); |
376 | hb-> addWidget ( m_imagebrowse ); | 373 | hb-> addWidget ( m_imagebrowse ); |
377 | hb-> addStretch ( 10 ); | 374 | hb-> addStretch ( 10 ); |
378 | 375 | ||
379 | gridLayout-> addLayout ( hb, 2, 1 ); | 376 | gridLayout-> addLayout ( hb, 2, 1 ); |
380 | 377 | ||
381 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); | 378 | QPushButton *p = new QPushButton ( tr( "Default" ), tab ); |
382 | connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); | 379 | connect ( p, SIGNAL( clicked ( )), this, SLOT( bgDefaultClicked ( ))); |
383 | gridLayout-> addWidget ( p, 3, 1 ); | 380 | gridLayout-> addWidget ( p, 3, 1 ); |
384 | 381 | ||
385 | connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); | 382 | connect ( m_bgtype, SIGNAL( clicked ( int )), this, SLOT( bgTypeClicked ( int ))); |
386 | 383 | ||
387 | vertLayout-> addStretch ( 10 ); | 384 | vertLayout-> addStretch ( 10 ); |
388 | 385 | ||
389 | return tab; | 386 | return tab; |
390 | } | 387 | } |
391 | 388 | ||
392 | QWidget *TabDialog::createIconTab ( QWidget *parent ) | 389 | QWidget *TabDialog::createIconTab ( QWidget *parent ) |
393 | { | 390 | { |
394 | QWidget *tab = new QWidget( parent, "IconTab" ); | 391 | QWidget *tab = new QWidget( parent, "IconTab" ); |
395 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 392 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
396 | 393 | ||
397 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 394 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
398 | gridLayout-> setColStretch ( 1, 10 ); | 395 | gridLayout-> setColStretch ( 1, 10 ); |
399 | 396 | ||
400 | QLabel* label = new QLabel( tr( "Size:" ), tab ); | 397 | QLabel* label = new QLabel( tr( "Size:" ), tab ); |
401 | gridLayout-> addWidget ( label, 0, 0 ); | 398 | gridLayout-> addWidget ( label, 0, 0 ); |
402 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); | 399 | m_iconsize = new QButtonGroup( tab, "buttongroup" ); |
403 | m_iconsize-> hide ( ); | 400 | m_iconsize-> hide ( ); |
404 | m_iconsize-> setExclusive ( true ); | 401 | m_iconsize-> setExclusive ( true ); |
405 | 402 | ||
406 | QRadioButton *rb; | 403 | QRadioButton *rb; |
407 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); | 404 | rb = new QRadioButton( tr( "Small" ), tab, "iconsmall" ); |
408 | m_iconsize-> insert ( rb, TabConfig::List ); | 405 | m_iconsize-> insert ( rb, TabConfig::List ); |
409 | gridLayout-> addWidget( rb, 0, 1 ); | 406 | gridLayout-> addWidget( rb, 0, 1 ); |
410 | 407 | ||
411 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); | 408 | rb = new QRadioButton( tr( "Large" ), tab, "iconlarge" ); |
412 | m_iconsize-> insert ( rb, TabConfig::Icon ); | 409 | m_iconsize-> insert ( rb, TabConfig::Icon ); |
413 | gridLayout-> addWidget( rb, 1, 1 ); | 410 | gridLayout-> addWidget( rb, 1, 1 ); |
414 | 411 | ||
415 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); | 412 | connect ( m_iconsize, SIGNAL( clicked ( int )), this, SLOT( iconSizeClicked ( int ))); |
416 | 413 | ||
417 | //vertLayout-> addSpacing ( 8 ); | 414 | //vertLayout-> addSpacing ( 8 ); |
418 | 415 | ||
419 | //gridLayout = new QGridLayout ( vertLayout ); | 416 | //gridLayout = new QGridLayout ( vertLayout ); |
420 | gridLayout-> addRowSpacing ( 2, 8 ); | 417 | gridLayout-> addRowSpacing ( 2, 8 ); |
421 | 418 | ||
422 | label = new QLabel ( tr( "Color:" ), tab ); | 419 | label = new QLabel ( tr( "Color:" ), tab ); |
423 | gridLayout-> addWidget ( label, 3, 0 ); | 420 | gridLayout-> addWidget ( label, 3, 0 ); |
424 | 421 | ||
425 | m_iconcolor = new OColorButton ( tab, QColor ( m_tc. m_text_color ) ); | 422 | m_iconcolor = new OColorButton ( tab, QColor ( m_tc. m_text_color ) ); |
426 | connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); | 423 | connect ( m_iconcolor, SIGNAL( colorSelected ( const QColor & )), this, SLOT( iconColorClicked ( const QColor & ))); |
427 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); | 424 | gridLayout-> addWidget ( m_iconcolor, 3, 1, AlignLeft ); |
428 | 425 | ||
429 | vertLayout-> addStretch ( 10 ); | 426 | vertLayout-> addStretch ( 10 ); |
430 | 427 | ||
431 | return tab; | 428 | return tab; |
432 | } | 429 | } |
433 | 430 | ||
434 | 431 | ||
435 | void TabDialog::iconSizeClicked ( int s ) | 432 | void TabDialog::iconSizeClicked ( int s ) |
436 | { | 433 | { |
437 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); | 434 | m_sample-> setViewMode ((TabConfig::ViewMode) s ); |
438 | } | 435 | } |
439 | 436 | ||
440 | void TabDialog::fontClicked ( const QFont &f ) | 437 | void TabDialog::fontClicked ( const QFont &f ) |
441 | { | 438 | { |
442 | m_sample-> setViewFont ( f ); | 439 | m_sample-> setViewFont ( f ); |
443 | } | 440 | } |
444 | 441 | ||
445 | void TabDialog::bgTypeClicked ( int t ) | 442 | void TabDialog::bgTypeClicked ( int t ) |
446 | { | 443 | { |
447 | QString s; | 444 | QString s; |
448 | 445 | ||
449 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) | 446 | if ( m_bgtype-> id ( m_bgtype-> selected ( )) != t ) |
450 | m_bgtype-> setButton ( t ); | 447 | m_bgtype-> setButton ( t ); |
451 | 448 | ||
452 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); | 449 | m_solidcolor-> setEnabled ( t == TabConfig::SolidColor ); |
453 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); | 450 | m_imagebrowse-> setEnabled ( t == TabConfig::Image ); |
454 | 451 | ||
455 | if ( t == TabConfig::SolidColor ) | 452 | if ( t == TabConfig::SolidColor ) |
456 | s = m_solidcolor-> color ( ). name ( ); | 453 | s = m_solidcolor-> color ( ). name ( ); |
457 | else if ( t == TabConfig::Image ) | 454 | else if ( t == TabConfig::Image ) |
458 | s = Resource::findPixmap ( m_bgimage ); | 455 | s = Resource::findPixmap ( m_bgimage ); |
459 | 456 | ||
460 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); | 457 | m_sample-> setBackgroundType ((TabConfig::BackgroundType) t, s ); |
461 | } | 458 | } |
462 | 459 | ||
463 | void TabDialog::bgColorClicked ( const QColor & ) | 460 | void TabDialog::bgColorClicked ( const QColor & ) |
464 | { | 461 | { |
465 | bgTypeClicked ( TabConfig::SolidColor ); | 462 | bgTypeClicked ( TabConfig::SolidColor ); |
466 | } | 463 | } |
467 | 464 | ||
468 | void TabDialog::iconColorClicked ( const QColor &col ) | 465 | void TabDialog::iconColorClicked ( const QColor &col ) |
469 | { | 466 | { |
470 | m_sample-> setTextColor ( col ); | 467 | m_sample-> setTextColor ( col ); |
471 | } | 468 | } |
472 | 469 | ||
473 | void TabDialog::bgImageClicked ( ) | 470 | void TabDialog::bgImageClicked ( ) |
474 | { | 471 | { |
475 | // ### use OFileSelector here ### | 472 | // ### use OFileSelector here ### |
476 | // this is just a quick c&p from the old appearance app | 473 | // this is just a quick c&p from the old appearance app |
477 | 474 | ||
478 | MimeTypes types; | 475 | MimeTypes types; |
479 | QStringList list; | 476 | QStringList list; |
480 | list << "image/*"; | 477 | list << "image/*"; |
481 | types. insert ( "Images", list ); | 478 | types. insert ( "Images", list ); |
482 | 479 | ||
483 | QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); | 480 | QString file = OFileDialog::getOpenFileName ( 1, "/", QString::null, types ); |
484 | if ( !file. isEmpty ( )) { | 481 | if ( !file. isEmpty ( )) { |
485 | m_bgimage = DocLnk ( file ). file ( ); | 482 | m_bgimage = DocLnk ( file ). file ( ); |
486 | bgTypeClicked ( TabConfig::Image ); | 483 | bgTypeClicked ( TabConfig::Image ); |
487 | } | 484 | } |
488 | } | 485 | } |
489 | 486 | ||
490 | void TabDialog::bgDefaultClicked ( ) | 487 | void TabDialog::bgDefaultClicked ( ) |
491 | { | 488 | { |
492 | m_bgimage = "launcher/opie-background"; | 489 | m_bgimage = "launcher/opie-background"; |
493 | bgTypeClicked ( TabConfig::Image ); | 490 | bgTypeClicked ( TabConfig::Image ); |
494 | } | 491 | } |
495 | 492 | ||
496 | void TabDialog::accept ( ) | 493 | void TabDialog::accept ( ) |
497 | { | 494 | { |
498 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); | 495 | m_tc. m_view = (TabConfig::ViewMode) m_iconsize-> id ( m_iconsize-> selected ( )); |
499 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); | 496 | m_tc. m_bg_type = (TabConfig::BackgroundType) m_bgtype-> id ( m_bgtype-> selected ( )); |
500 | m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); | 497 | m_tc. m_bg_color = m_solidcolor-> color ( ). name ( ); |
501 | m_tc. m_bg_image = m_bgimage; | 498 | m_tc. m_bg_image = m_bgimage; |
502 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); | 499 | m_tc. m_text_color = m_iconcolor-> color ( ). name ( ); |
503 | 500 | ||
504 | m_tc. m_font_use = m_fontuse-> isChecked ( ); | 501 | m_tc. m_font_use = m_fontuse-> isChecked ( ); |
505 | 502 | ||
506 | if ( m_tc. m_font_use ) { | 503 | if ( m_tc. m_font_use ) { |
507 | QFont f = m_fontselect-> selectedFont ( ); | 504 | QFont f = m_fontselect-> selectedFont ( ); |
508 | 505 | ||
509 | m_tc. m_font_family = f. family ( ); | 506 | m_tc. m_font_family = f. family ( ); |
510 | m_tc. m_font_size = f. pointSize ( ); | 507 | m_tc. m_font_size = f. pointSize ( ); |
511 | m_tc. m_font_weight = f. weight ( ); | 508 | m_tc. m_font_weight = f. weight ( ); |
512 | m_tc. m_font_italic = f. italic ( ); | 509 | m_tc. m_font_italic = f. italic ( ); |
513 | } | 510 | } |
514 | 511 | ||
515 | QDialog::accept ( ); | 512 | QDialog::accept ( ); |
516 | } | 513 | } |
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp index 3d8b456..a3d31a5 100644 --- a/core/settings/launcher/tabssettings.cpp +++ b/core/settings/launcher/tabssettings.cpp | |||
@@ -1,318 +1,317 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "tabssettings.h" | 28 | #include "tabssettings.h" |
29 | 29 | ||
30 | #include <qpe/qpeapplication.h> | ||
31 | #include <qpe/resource.h> | 30 | #include <qpe/resource.h> |
32 | #include <qpe/applnk.h> | 31 | #include <qpe/applnk.h> |
33 | #include <qpe/mimetype.h> | 32 | #include <qpe/mimetype.h> |
34 | #include <qpe/qcopenvelope_qws.h> | 33 | #include <qpe/qcopenvelope_qws.h> |
35 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
36 | 35 | ||
37 | #include <qlistbox.h> | 36 | #include <qlistbox.h> |
38 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
39 | #include <qlayout.h> | 38 | #include <qlayout.h> |
40 | #include <qlabel.h> | 39 | #include <qlabel.h> |
41 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
42 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
43 | 42 | ||
44 | #include "tabdialog.h" | 43 | #include "tabdialog.h" |
45 | 44 | ||
46 | #include <stdlib.h> | 45 | #include <stdlib.h> |
47 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
48 | 47 | ||
49 | 48 | ||
50 | #define GLOBALID ".global." | 49 | #define GLOBALID ".global." |
51 | 50 | ||
52 | 51 | ||
53 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) | 52 | TabsSettings::TabsSettings ( QWidget *parent, const char *name ) |
54 | : QWidget ( parent, name ) | 53 | : QWidget ( parent, name ) |
55 | { | 54 | { |
56 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); | 55 | QGridLayout *lay = new QGridLayout ( this, 0, 0, 4, 4 ); |
57 | 56 | ||
58 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); | 57 | QLabel *l = new QLabel ( tr( "Launcher Tabs:" ), this ); |
59 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); | 58 | lay-> addMultiCellWidget ( l, 0, 0, 0, 1 ); |
60 | 59 | ||
61 | m_list = new QListBox ( this ); | 60 | m_list = new QListBox ( this ); |
62 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); | 61 | lay-> addMultiCellWidget ( m_list, 1, 4, 0, 0 ); |
63 | 62 | ||
64 | QWhatsThis::add ( m_list, tr( "foobar" )); | 63 | QWhatsThis::add ( m_list, tr( "foobar" )); |
65 | 64 | ||
66 | QPushButton *p1, *p2, *p3; | 65 | QPushButton *p1, *p2, *p3; |
67 | p1 = new QPushButton ( tr( "New" ), this ); | 66 | p1 = new QPushButton ( tr( "New" ), this ); |
68 | lay-> addWidget ( p1, 1, 1 ); | 67 | lay-> addWidget ( p1, 1, 1 ); |
69 | connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); | 68 | connect ( p1, SIGNAL( clicked ( )), this, SLOT( newClicked ( ))); |
70 | 69 | ||
71 | p2 = new QPushButton ( tr( "Edit" ), this ); | 70 | p2 = new QPushButton ( tr( "Edit" ), this ); |
72 | lay-> addWidget ( p2, 2, 1 ); | 71 | lay-> addWidget ( p2, 2, 1 ); |
73 | connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); | 72 | connect ( p2, SIGNAL( clicked ( )), this, SLOT( editClicked ( ))); |
74 | 73 | ||
75 | p3 = new QPushButton ( tr( "Delete" ), this ); | 74 | p3 = new QPushButton ( tr( "Delete" ), this ); |
76 | lay-> addWidget ( p3, 3, 1 ); | 75 | lay-> addWidget ( p3, 3, 1 ); |
77 | connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); | 76 | connect ( p3, SIGNAL( clicked ( )), this, SLOT( deleteClicked ( ))); |
78 | 77 | ||
79 | lay-> setRowStretch ( 4, 10 ); | 78 | lay-> setRowStretch ( 4, 10 ); |
80 | 79 | ||
81 | m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this ); | 80 | m_bigbusy = new QCheckBox( tr( "Enable big busy indicator" ), this ); |
82 | lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 ); | 81 | lay-> addMultiCellWidget ( m_bigbusy, 5, 5, 0, 1 ); |
83 | 82 | ||
84 | m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this ); | 83 | m_busyani = new QCheckBox ( tr( "Enable animated busy indicator" ), this ); |
85 | lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 ); | 84 | lay-> addMultiCellWidget ( m_busyani, 6, 6, 0, 1 ); |
86 | 85 | ||
87 | p1-> setEnabled ( false ); | 86 | p1-> setEnabled ( false ); |
88 | p3-> setEnabled ( false ); | 87 | p3-> setEnabled ( false ); |
89 | 88 | ||
90 | init ( ); | 89 | init ( ); |
91 | 90 | ||
92 | QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); | 91 | QWhatsThis::add ( m_list, tr( "Select the Launcher Tab you want to edit or delete." )); |
93 | QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); | 92 | QWhatsThis::add ( p1, tr( "Adds a new Tab to the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); |
94 | QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); | 93 | QWhatsThis::add ( p2, tr( "Opens a new dialog to customize the select Tab." )); |
95 | QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); | 94 | QWhatsThis::add ( p3, tr( "Deletes a Tab from the Launcher." ) + QString ( "<center><br><i>not yet implemented</i><br>Please use the tabmanager</center>." )); |
96 | QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." )); | 95 | QWhatsThis::add ( m_bigbusy, tr( "Activate this, if you want a big busy indicator in the middle of the screen instead of the one in taskbar." )); |
97 | QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." )); | 96 | QWhatsThis::add ( m_busyani, tr( "Activate this, if you want an animatedbusy indicator for starting applications in the Launcher." )); |
98 | } | 97 | } |
99 | 98 | ||
100 | void TabsSettings::init ( ) | 99 | void TabsSettings::init ( ) |
101 | { | 100 | { |
102 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); | 101 | AppLnkSet rootFolder( MimeType::appsFolderName ( )); |
103 | QStringList types = rootFolder. types ( ); | 102 | QStringList types = rootFolder. types ( ); |
104 | 103 | ||
105 | m_list-> insertItem ( tr( "All Tabs" )); | 104 | m_list-> insertItem ( tr( "All Tabs" )); |
106 | m_ids << GLOBALID; | 105 | m_ids << GLOBALID; |
107 | 106 | ||
108 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { | 107 | for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { |
109 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); | 108 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); |
110 | m_ids << *it; | 109 | m_ids << *it; |
111 | } | 110 | } |
112 | QImage img ( Resource::loadImage ( "DocsIcon" )); | 111 | QImage img ( Resource::loadImage ( "DocsIcon" )); |
113 | QPixmap pix; | 112 | QPixmap pix; |
114 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); | 113 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); |
115 | m_list-> insertItem ( pix, tr( "Documents" )); | 114 | m_list-> insertItem ( pix, tr( "Documents" )); |
116 | m_ids += "Documents"; // No tr | 115 | m_ids += "Documents"; // No tr |
117 | 116 | ||
118 | Config cfg ( "Launcher" ); | 117 | Config cfg ( "Launcher" ); |
119 | 118 | ||
120 | readTabSettings ( cfg ); | 119 | readTabSettings ( cfg ); |
121 | 120 | ||
122 | cfg. setGroup ( "GUI" ); | 121 | cfg. setGroup ( "GUI" ); |
123 | m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); | 122 | m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); |
124 | m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); | 123 | m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); |
125 | } | 124 | } |
126 | 125 | ||
127 | 126 | ||
128 | void TabsSettings::readTabSettings ( Config &cfg ) | 127 | void TabsSettings::readTabSettings ( Config &cfg ) |
129 | { | 128 | { |
130 | QString grp ( "Tab %1" ); // No tr | 129 | QString grp ( "Tab %1" ); // No tr |
131 | m_tabs. clear ( ); | 130 | m_tabs. clear ( ); |
132 | 131 | ||
133 | TabConfig global_def; | 132 | TabConfig global_def; |
134 | global_def. m_view = TabConfig::Icon; | 133 | global_def. m_view = TabConfig::Icon; |
135 | global_def. m_bg_type = TabConfig::Ruled; | 134 | global_def. m_bg_type = TabConfig::Ruled; |
136 | global_def. m_bg_image = "launcher/opie-background"; | 135 | global_def. m_bg_image = "launcher/opie-background"; |
137 | global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); | 136 | global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); |
138 | global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); | 137 | global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); |
139 | global_def. m_font_use = false; | 138 | global_def. m_font_use = false; |
140 | global_def. m_font_family = font ( ). family ( ); | 139 | global_def. m_font_family = font ( ). family ( ); |
141 | global_def. m_font_size = font ( ). pointSize ( ); | 140 | global_def. m_font_size = font ( ). pointSize ( ); |
142 | global_def. m_font_weight = 50; | 141 | global_def. m_font_weight = 50; |
143 | global_def. m_font_italic = false; | 142 | global_def. m_font_italic = false; |
144 | global_def. m_changed = false; | 143 | global_def. m_changed = false; |
145 | 144 | ||
146 | 145 | ||
147 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 146 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
148 | TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; | 147 | TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; |
149 | 148 | ||
150 | cfg. setGroup ( grp. arg ( *it )); | 149 | cfg. setGroup ( grp. arg ( *it )); |
151 | 150 | ||
152 | QString view = cfg. readEntry ( "View" ); | 151 | QString view = cfg. readEntry ( "View" ); |
153 | if ( view == "Icon" ) // No tr | 152 | if ( view == "Icon" ) // No tr |
154 | tc. m_view = TabConfig::Icon; | 153 | tc. m_view = TabConfig::Icon; |
155 | if ( view == "List" ) // No tr | 154 | if ( view == "List" ) // No tr |
156 | tc. m_view = TabConfig::List; | 155 | tc. m_view = TabConfig::List; |
157 | 156 | ||
158 | QString bgType = cfg. readEntry ( "BackgroundType" ); | 157 | QString bgType = cfg. readEntry ( "BackgroundType" ); |
159 | if ( bgType == "Image" ) | 158 | if ( bgType == "Image" ) |
160 | tc. m_bg_type = TabConfig::Image; | 159 | tc. m_bg_type = TabConfig::Image; |
161 | else if ( bgType == "SolidColor" ) | 160 | else if ( bgType == "SolidColor" ) |
162 | tc. m_bg_type = TabConfig::SolidColor; | 161 | tc. m_bg_type = TabConfig::SolidColor; |
163 | else if ( bgType == "Image" ) // No tr | 162 | else if ( bgType == "Image" ) // No tr |
164 | tc. m_bg_type = TabConfig::Image; | 163 | tc. m_bg_type = TabConfig::Image; |
165 | 164 | ||
166 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); | 165 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); |
167 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); | 166 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); |
168 | tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); | 167 | tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); |
169 | QStringList f = cfg. readListEntry ( "Font", ',' ); | 168 | QStringList f = cfg. readListEntry ( "Font", ',' ); |
170 | if ( f. count ( ) == 4 ) { | 169 | if ( f. count ( ) == 4 ) { |
171 | tc. m_font_use = true; | 170 | tc. m_font_use = true; |
172 | tc. m_font_family = f [0]; | 171 | tc. m_font_family = f [0]; |
173 | tc. m_font_size = f [1]. toInt ( ); | 172 | tc. m_font_size = f [1]. toInt ( ); |
174 | tc. m_font_weight = f [2]. toInt ( ); | 173 | tc. m_font_weight = f [2]. toInt ( ); |
175 | tc. m_font_italic = ( f [3]. toInt ( )); | 174 | tc. m_font_italic = ( f [3]. toInt ( )); |
176 | } | 175 | } |
177 | m_tabs [*it] = tc; | 176 | m_tabs [*it] = tc; |
178 | } | 177 | } |
179 | 178 | ||
180 | // if all tabs have the same config, then initialize the GLOBALID tab to these values | 179 | // if all tabs have the same config, then initialize the GLOBALID tab to these values |
181 | 180 | ||
182 | TabConfig *first = 0; | 181 | TabConfig *first = 0; |
183 | bool same = true; | 182 | bool same = true; |
184 | 183 | ||
185 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 184 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
186 | if ( *it == GLOBALID ) | 185 | if ( *it == GLOBALID ) |
187 | continue; | 186 | continue; |
188 | else if ( !first ) | 187 | else if ( !first ) |
189 | first = &m_tabs [*it]; | 188 | first = &m_tabs [*it]; |
190 | else | 189 | else |
191 | same &= ( *first == m_tabs [*it] ); | 190 | same &= ( *first == m_tabs [*it] ); |
192 | } | 191 | } |
193 | if ( same ) { | 192 | if ( same ) { |
194 | m_tabs [GLOBALID] = *first; | 193 | m_tabs [GLOBALID] = *first; |
195 | m_tabs [GLOBALID]. m_changed = true; | 194 | m_tabs [GLOBALID]. m_changed = true; |
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | 198 | ||
200 | void TabsSettings::accept ( ) | 199 | void TabsSettings::accept ( ) |
201 | { | 200 | { |
202 | Config cfg ( "Launcher" ); | 201 | Config cfg ( "Launcher" ); |
203 | 202 | ||
204 | // Launcher Tab | 203 | // Launcher Tab |
205 | QString grp ( "Tab %1" ); // No tr | 204 | QString grp ( "Tab %1" ); // No tr |
206 | 205 | ||
207 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 206 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
208 | TabConfig &tc = m_tabs [*it]; | 207 | TabConfig &tc = m_tabs [*it]; |
209 | 208 | ||
210 | if ( !tc. m_changed ) | 209 | if ( !tc. m_changed ) |
211 | continue; | 210 | continue; |
212 | 211 | ||
213 | cfg. setGroup ( grp. arg ( *it )); | 212 | cfg. setGroup ( grp. arg ( *it )); |
214 | switch ( tc. m_view ) { | 213 | switch ( tc. m_view ) { |
215 | case TabConfig::Icon: | 214 | case TabConfig::Icon: |
216 | cfg.writeEntry ( "View", "Icon" ); | 215 | cfg.writeEntry ( "View", "Icon" ); |
217 | break; | 216 | break; |
218 | case TabConfig::List: | 217 | case TabConfig::List: |
219 | cfg.writeEntry ( "View", "List" ); | 218 | cfg.writeEntry ( "View", "List" ); |
220 | break; | 219 | break; |
221 | } | 220 | } |
222 | 221 | ||
223 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); | 222 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); |
224 | e << *it << tc. m_view; | 223 | e << *it << tc. m_view; |
225 | 224 | ||
226 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); | 225 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); |
227 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); | 226 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); |
228 | cfg. writeEntry ( "TextColor", tc. m_text_color ); | 227 | cfg. writeEntry ( "TextColor", tc. m_text_color ); |
229 | 228 | ||
230 | if ( tc. m_font_use ) { | 229 | if ( tc. m_font_use ) { |
231 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); | 230 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); |
232 | cfg. writeEntry ( "Font", f ); | 231 | cfg. writeEntry ( "Font", f ); |
233 | } | 232 | } |
234 | else | 233 | else |
235 | cfg. removeEntry ( "Font" ); | 234 | cfg. removeEntry ( "Font" ); |
236 | 235 | ||
237 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); | 236 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); |
238 | 237 | ||
239 | switch ( tc. m_bg_type ) { | 238 | switch ( tc. m_bg_type ) { |
240 | case TabConfig::Ruled: | 239 | case TabConfig::Ruled: |
241 | cfg.writeEntry( "BackgroundType", "Ruled" ); | 240 | cfg.writeEntry( "BackgroundType", "Ruled" ); |
242 | be << *it << tc. m_bg_type << QString(""); | 241 | be << *it << tc. m_bg_type << QString(""); |
243 | break; | 242 | break; |
244 | case TabConfig::SolidColor: | 243 | case TabConfig::SolidColor: |
245 | cfg.writeEntry( "BackgroundType", "SolidColor" ); | 244 | cfg.writeEntry( "BackgroundType", "SolidColor" ); |
246 | be << *it << tc. m_bg_type << tc. m_bg_color; | 245 | be << *it << tc. m_bg_type << tc. m_bg_color; |
247 | break; | 246 | break; |
248 | case TabConfig::Image: | 247 | case TabConfig::Image: |
249 | cfg.writeEntry( "BackgroundType", "Image" ); | 248 | cfg.writeEntry( "BackgroundType", "Image" ); |
250 | be << *it << tc. m_bg_type << tc. m_bg_image; | 249 | be << *it << tc. m_bg_type << tc. m_bg_image; |
251 | break; | 250 | break; |
252 | } | 251 | } |
253 | 252 | ||
254 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); | 253 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); |
255 | te << *it << tc. m_text_color; | 254 | te << *it << tc. m_text_color; |
256 | 255 | ||
257 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); | 256 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); |
258 | fe << *it; | 257 | fe << *it; |
259 | fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); | 258 | fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); |
260 | fe << tc. m_font_size; | 259 | fe << tc. m_font_size; |
261 | fe << tc. m_font_weight; | 260 | fe << tc. m_font_weight; |
262 | fe << ( tc. m_font_italic ? 1 : 0 ); | 261 | fe << ( tc. m_font_italic ? 1 : 0 ); |
263 | 262 | ||
264 | tc. m_changed = false; | 263 | tc. m_changed = false; |
265 | } | 264 | } |
266 | cfg. setGroup ( "GUI" ); | 265 | cfg. setGroup ( "GUI" ); |
267 | QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); | 266 | QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); |
268 | cfg. writeEntry ( "BusyType", busytype ); | 267 | cfg. writeEntry ( "BusyType", busytype ); |
269 | 268 | ||
270 | cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); | 269 | cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); |
271 | 270 | ||
272 | { | 271 | { |
273 | QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); | 272 | QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); |
274 | e << busytype; | 273 | e << busytype; |
275 | } | 274 | } |
276 | } | 275 | } |
277 | 276 | ||
278 | void TabsSettings::newClicked ( ) | 277 | void TabsSettings::newClicked ( ) |
279 | { | 278 | { |
280 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 279 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
281 | } | 280 | } |
282 | 281 | ||
283 | void TabsSettings::deleteClicked ( ) | 282 | void TabsSettings::deleteClicked ( ) |
284 | { | 283 | { |
285 | int ind = m_list-> currentItem ( ); | 284 | int ind = m_list-> currentItem ( ); |
286 | 285 | ||
287 | if ( ind < 0 ) | 286 | if ( ind < 0 ) |
288 | return; | 287 | return; |
289 | 288 | ||
290 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 289 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
291 | } | 290 | } |
292 | 291 | ||
293 | void TabsSettings::editClicked ( ) | 292 | void TabsSettings::editClicked ( ) |
294 | { | 293 | { |
295 | int ind = m_list-> currentItem ( ); | 294 | int ind = m_list-> currentItem ( ); |
296 | 295 | ||
297 | if ( ind < 0 ) | 296 | if ( ind < 0 ) |
298 | return; | 297 | return; |
299 | 298 | ||
300 | TabConfig tc = m_tabs [m_ids [ind]]; | 299 | TabConfig tc = m_tabs [m_ids [ind]]; |
301 | 300 | ||
302 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); | 301 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); |
303 | 302 | ||
304 | d-> showMaximized ( ); | 303 | d-> showMaximized ( ); |
305 | if ( d-> exec ( ) == QDialog::Accepted ) { | 304 | if ( d-> exec ( ) == QDialog::Accepted ) { |
306 | tc. m_changed = true; | 305 | tc. m_changed = true; |
307 | m_tabs [m_ids [ind]] = tc; | 306 | m_tabs [m_ids [ind]] = tc; |
308 | 307 | ||
309 | if ( m_ids [ind] == GLOBALID ) { | 308 | if ( m_ids [ind] == GLOBALID ) { |
310 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 309 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
311 | if ( *it != GLOBALID ) | 310 | if ( *it != GLOBALID ) |
312 | m_tabs [*it] = tc; | 311 | m_tabs [*it] = tc; |
313 | } | 312 | } |
314 | } | 313 | } |
315 | } | 314 | } |
316 | 315 | ||
317 | delete d; | 316 | delete d; |
318 | } | 317 | } |
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp index d03ea49..badb98f 100644 --- a/core/settings/launcher/taskbarsettings.cpp +++ b/core/settings/launcher/taskbarsettings.cpp | |||
@@ -1,173 +1,172 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> | 3 | =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "taskbarsettings.h" | 29 | #include "taskbarsettings.h" |
30 | 30 | ||
31 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
32 | #include <qpe/qlibrary.h> | 32 | #include <qpe/qlibrary.h> |
33 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
34 | #include <qpe/taskbarappletinterface.h> | 34 | #include <qpe/taskbarappletinterface.h> |
35 | #include <qpe/qcopenvelope_qws.h> | 35 | #include <qpe/qcopenvelope_qws.h> |
36 | 36 | ||
37 | #include <qdir.h> | 37 | #include <qdir.h> |
38 | #include <qlistview.h> | 38 | #include <qlistview.h> |
39 | #include <qcheckbox.h> | ||
40 | #include <qheader.h> | 39 | #include <qheader.h> |
41 | #include <qlayout.h> | 40 | #include <qlayout.h> |
42 | #include <qlabel.h> | 41 | #include <qlabel.h> |
43 | #include <qwhatsthis.h> | 42 | #include <qwhatsthis.h> |
44 | 43 | ||
45 | #include <stdlib.h> | 44 | #include <stdlib.h> |
46 | 45 | ||
47 | 46 | ||
48 | TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) | 47 | TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) |
49 | : QWidget ( parent, name ) | 48 | : QWidget ( parent, name ) |
50 | { | 49 | { |
51 | m_applets_changed = false; | 50 | m_applets_changed = false; |
52 | 51 | ||
53 | QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); | 52 | QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); |
54 | 53 | ||
55 | QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); | 54 | QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); |
56 | lay-> addWidget ( l ); | 55 | lay-> addWidget ( l ); |
57 | 56 | ||
58 | m_list = new QListView ( this ); | 57 | m_list = new QListView ( this ); |
59 | m_list-> addColumn ( "foobar" ); | 58 | m_list-> addColumn ( "foobar" ); |
60 | m_list-> header ( )-> hide ( ); | 59 | m_list-> header ( )-> hide ( ); |
61 | 60 | ||
62 | lay-> addWidget ( m_list ); | 61 | lay-> addWidget ( m_list ); |
63 | 62 | ||
64 | QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); | 63 | QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); |
65 | 64 | ||
66 | connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); | 65 | connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); |
67 | 66 | ||
68 | init ( ); | 67 | init ( ); |
69 | } | 68 | } |
70 | 69 | ||
71 | void TaskbarSettings::init ( ) | 70 | void TaskbarSettings::init ( ) |
72 | { | 71 | { |
73 | Config cfg ( "Taskbar" ); | 72 | Config cfg ( "Taskbar" ); |
74 | cfg. setGroup ( "Applets" ); | 73 | cfg. setGroup ( "Applets" ); |
75 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); | 74 | QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); |
76 | 75 | ||
77 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; | 76 | QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; |
78 | #ifdef Q_OS_MACX | 77 | #ifdef Q_OS_MACX |
79 | QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); | 78 | QStringList list = QDir ( path, "lib*.dylib" ). entryList ( ); |
80 | #else | 79 | #else |
81 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); | 80 | QStringList list = QDir ( path, "lib*.so" ). entryList ( ); |
82 | #endif /* Q_OS_MACX */ | 81 | #endif /* Q_OS_MACX */ |
83 | 82 | ||
84 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { | 83 | for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { |
85 | QString name; | 84 | QString name; |
86 | QPixmap icon; | 85 | QPixmap icon; |
87 | TaskbarNamedAppletInterface *iface = 0; | 86 | TaskbarNamedAppletInterface *iface = 0; |
88 | 87 | ||
89 | qWarning("Load applet: %s", (*it).latin1() ); | 88 | qWarning("Load applet: %s", (*it).latin1() ); |
90 | QLibrary *lib = new QLibrary ( path + "/" + *it ); | 89 | QLibrary *lib = new QLibrary ( path + "/" + *it ); |
91 | lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); | 90 | lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); |
92 | qWarning("<1>"); | 91 | qWarning("<1>"); |
93 | if ( iface ) { | 92 | if ( iface ) { |
94 | qWarning("<2>"); | 93 | qWarning("<2>"); |
95 | QString lang = getenv( "LANG" ); | 94 | QString lang = getenv( "LANG" ); |
96 | QTranslator *trans = new QTranslator ( qApp ); | 95 | QTranslator *trans = new QTranslator ( qApp ); |
97 | QString type = (*it). left ((*it). find (".")); | 96 | QString type = (*it). left ((*it). find (".")); |
98 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; | 97 | QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; |
99 | if ( trans-> load ( tfn )) | 98 | if ( trans-> load ( tfn )) |
100 | qApp-> installTranslator ( trans ); | 99 | qApp-> installTranslator ( trans ); |
101 | else | 100 | else |
102 | delete trans; | 101 | delete trans; |
103 | name = iface-> name ( ); | 102 | name = iface-> name ( ); |
104 | icon = iface-> icon ( ); | 103 | icon = iface-> icon ( ); |
105 | iface-> release ( ); | 104 | iface-> release ( ); |
106 | } | 105 | } |
107 | qWarning("<3>"); | 106 | qWarning("<3>"); |
108 | if ( !iface ) { | 107 | if ( !iface ) { |
109 | qWarning("<4>"); | 108 | qWarning("<4>"); |
110 | lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); | 109 | lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); |
111 | 110 | ||
112 | if ( iface ) { | 111 | if ( iface ) { |
113 | qWarning("<5>"); | 112 | qWarning("<5>"); |
114 | name = (*it). mid ( 3 ); | 113 | name = (*it). mid ( 3 ); |
115 | qWarning("Found applet: %s", name.latin1() ); | 114 | qWarning("Found applet: %s", name.latin1() ); |
116 | #ifdef Q_OS_MACX | 115 | #ifdef Q_OS_MACX |
117 | int sep = name. find( ".dylib" ); | 116 | int sep = name. find( ".dylib" ); |
118 | #else | 117 | #else |
119 | int sep = name. find( ".so" ); | 118 | int sep = name. find( ".so" ); |
120 | #endif /* Q_OS_MACX */ | 119 | #endif /* Q_OS_MACX */ |
121 | if ( sep > 0 ) | 120 | if ( sep > 0 ) |
122 | name. truncate ( sep ); | 121 | name. truncate ( sep ); |
123 | sep = name. find ( "applet" ); | 122 | sep = name. find ( "applet" ); |
124 | if ( sep == (int) name.length ( ) - 6 ) | 123 | if ( sep == (int) name.length ( ) - 6 ) |
125 | name. truncate ( sep ); | 124 | name. truncate ( sep ); |
126 | name[0] = name[0]. upper ( ); | 125 | name[0] = name[0]. upper ( ); |
127 | iface-> release ( ); | 126 | iface-> release ( ); |
128 | } | 127 | } |
129 | } | 128 | } |
130 | qWarning("<6>"); | 129 | qWarning("<6>"); |
131 | 130 | ||
132 | if ( iface ) { | 131 | if ( iface ) { |
133 | qWarning("<7>"); | 132 | qWarning("<7>"); |
134 | QCheckListItem *item; | 133 | QCheckListItem *item; |
135 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); | 134 | item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); |
136 | if ( !icon. isNull ( )) | 135 | if ( !icon. isNull ( )) |
137 | item-> setPixmap ( 0, icon ); | 136 | item-> setPixmap ( 0, icon ); |
138 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); | 137 | item-> setOn ( exclude. find ( *it ) == exclude. end ( )); |
139 | m_applets [*it] = item; | 138 | m_applets [*it] = item; |
140 | } | 139 | } |
141 | lib-> unload ( ); | 140 | lib-> unload ( ); |
142 | delete lib; | 141 | delete lib; |
143 | } | 142 | } |
144 | } | 143 | } |
145 | 144 | ||
146 | void TaskbarSettings::appletChanged() | 145 | void TaskbarSettings::appletChanged() |
147 | { | 146 | { |
148 | m_applets_changed = true; | 147 | m_applets_changed = true; |
149 | } | 148 | } |
150 | 149 | ||
151 | void TaskbarSettings::accept ( ) | 150 | void TaskbarSettings::accept ( ) |
152 | { | 151 | { |
153 | Config cfg ( "Taskbar" ); | 152 | Config cfg ( "Taskbar" ); |
154 | cfg. setGroup ( "Applets" ); | 153 | cfg. setGroup ( "Applets" ); |
155 | 154 | ||
156 | if ( m_applets_changed ) { | 155 | if ( m_applets_changed ) { |
157 | QStringList exclude; | 156 | QStringList exclude; |
158 | QMap <QString, QCheckListItem *>::Iterator it; | 157 | QMap <QString, QCheckListItem *>::Iterator it; |
159 | for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { | 158 | for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { |
160 | if ( !(*it)-> isOn ( )) | 159 | if ( !(*it)-> isOn ( )) |
161 | exclude << it. key ( ); | 160 | exclude << it. key ( ); |
162 | } | 161 | } |
163 | cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); | 162 | cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); |
164 | } | 163 | } |
165 | cfg. writeEntry ( "SafeMode", false ); | 164 | cfg. writeEntry ( "SafeMode", false ); |
166 | cfg. write ( ); | 165 | cfg. write ( ); |
167 | 166 | ||
168 | if ( m_applets_changed ) { | 167 | if ( m_applets_changed ) { |
169 | QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); | 168 | QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); |
170 | m_applets_changed = false; | 169 | m_applets_changed = false; |
171 | } | 170 | } |
172 | } | 171 | } |
173 | 172 | ||
diff --git a/core/settings/security/main.cpp b/core/settings/security/main.cpp index 3141fb8..aed8ab2 100644 --- a/core/settings/security/main.cpp +++ b/core/settings/security/main.cpp | |||
@@ -1,32 +1,29 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 <qpe/qpeapplication.h> | ||
22 | #include <qpe/qcopenvelope_qws.h> | ||
23 | #include <qpe/global.h> | ||
24 | 21 | ||
25 | #include "security.h" | 22 | #include "security.h" |
26 | 23 | ||
27 | #include <opie/oapplicationfactory.h> | 24 | #include <opie/oapplicationfactory.h> |
28 | 25 | ||
29 | OPIE_EXPORT_APP( OApplicationFactory<Security> ) | 26 | OPIE_EXPORT_APP( OApplicationFactory<Security> ) |
30 | 27 | ||
31 | 28 | ||
32 | 29 | ||
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp index d7871b3..7bb14cd 100644 --- a/core/settings/security/security.cpp +++ b/core/settings/security/security.cpp | |||
@@ -1,439 +1,438 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 | #include "security.h" | 20 | #include "security.h" |
21 | 21 | ||
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | #include <qpe/password.h> | 24 | #include <qpe/password.h> |
25 | #include <qpe/qpedialog.h> | 25 | #include <qpe/qpedialog.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | 27 | ||
28 | #include <qcheckbox.h> | 28 | #include <qcheckbox.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qlistview.h> | ||
34 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
35 | 34 | ||
36 | Security::Security( QWidget* parent, const char* name, WFlags fl ) | 35 | Security::Security( QWidget* parent, const char* name, WFlags fl ) |
37 | : SecurityBase( parent, name, TRUE, WStyle_ContextHelp ) | 36 | : SecurityBase( parent, name, TRUE, WStyle_ContextHelp ) |
38 | { | 37 | { |
39 | valid=FALSE; | 38 | valid=FALSE; |
40 | Config cfg("Security"); | 39 | Config cfg("Security"); |
41 | cfg.setGroup("Passcode"); | 40 | cfg.setGroup("Passcode"); |
42 | passcode = cfg.readEntry("passcode"); | 41 | passcode = cfg.readEntry("passcode"); |
43 | passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); | 42 | passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); |
44 | cfg.setGroup("Sync"); | 43 | cfg.setGroup("Sync"); |
45 | int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 | 44 | int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 |
46 | int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); | 45 | int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); |
47 | selectNet(auth_peer,auth_peer_bits,TRUE); | 46 | selectNet(auth_peer,auth_peer_bits,TRUE); |
48 | 47 | ||
49 | connect(syncnet, SIGNAL(textChanged(const QString&)), | 48 | connect(syncnet, SIGNAL(textChanged(const QString&)), |
50 | this, SLOT(setSyncNet(const QString&))); | 49 | this, SLOT(setSyncNet(const QString&))); |
51 | 50 | ||
52 | cfg.setGroup("Sync"); | 51 | cfg.setGroup("Sync"); |
53 | QString sa = cfg.readEntry("syncapp","Qtopia"); | 52 | QString sa = cfg.readEntry("syncapp","Qtopia"); |
54 | 53 | ||
55 | for (int i=0; i<syncapp->count(); i++) { | 54 | for (int i=0; i<syncapp->count(); i++) { |
56 | if ( syncapp->text(i) == sa ) { | 55 | if ( syncapp->text(i) == sa ) { |
57 | syncapp->setCurrentItem(i); | 56 | syncapp->setCurrentItem(i); |
58 | } | 57 | } |
59 | } | 58 | } |
60 | 59 | ||
61 | /* | 60 | /* |
62 | cfg.setGroup("Remote"); | 61 | cfg.setGroup("Remote"); |
63 | if ( telnetAvailable() ) | 62 | if ( telnetAvailable() ) |
64 | telnet->setChecked(cfg.readEntry("allow_telnet")); | 63 | telnet->setChecked(cfg.readEntry("allow_telnet")); |
65 | else | 64 | else |
66 | telnet->hide(); | 65 | telnet->hide(); |
67 | 66 | ||
68 | if ( sshAvailable() ) | 67 | if ( sshAvailable() ) |
69 | ssh->setChecked(cfg.readEntry("allow_ssh")); | 68 | ssh->setChecked(cfg.readEntry("allow_ssh")); |
70 | else | 69 | else |
71 | ssh->hide(); | 70 | ssh->hide(); |
72 | */ | 71 | */ |
73 | 72 | ||
74 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; | 73 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; |
75 | Config loginCfg(configFile,Config::File); | 74 | Config loginCfg(configFile,Config::File); |
76 | 75 | ||
77 | loginCfg.setGroup("General"); | 76 | loginCfg.setGroup("General"); |
78 | autoLoginName=loginCfg.readEntry("AutoLogin",""); | 77 | autoLoginName=loginCfg.readEntry("AutoLogin",""); |
79 | 78 | ||
80 | if (autoLoginName.stripWhiteSpace().isEmpty()) { | 79 | if (autoLoginName.stripWhiteSpace().isEmpty()) { |
81 | autoLogin=false; | 80 | autoLogin=false; |
82 | } else { | 81 | } else { |
83 | autoLogin=true; | 82 | autoLogin=true; |
84 | } | 83 | } |
85 | 84 | ||
86 | cfg.setGroup("SyncMode"); | 85 | cfg.setGroup("SyncMode"); |
87 | int mode = cfg.readNumEntry("Mode",2); // Default to Sharp | 86 | int mode = cfg.readNumEntry("Mode",2); // Default to Sharp |
88 | syncModeCombo->setCurrentItem( mode - 1 ); | 87 | syncModeCombo->setCurrentItem( mode - 1 ); |
89 | 88 | ||
90 | //since nobody knows what this is and it doesn't do anything, i'll hide it # CoreDump | 89 | //since nobody knows what this is and it doesn't do anything, i'll hide it # CoreDump |
91 | // is this work-in-progress or can it be removed? | 90 | // is this work-in-progress or can it be removed? |
92 | syncModeCombo->hide(); | 91 | syncModeCombo->hide(); |
93 | 92 | ||
94 | connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); | 93 | connect(autologinToggle, SIGNAL(toggled(bool)), this, SLOT(toggleAutoLogin(bool))); |
95 | connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); | 94 | connect(userlist, SIGNAL(activated(int)), this, SLOT(changeLoginName(int))); |
96 | connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); | 95 | connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); |
97 | connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); | 96 | connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); |
98 | connect(syncapp,SIGNAL(activated(int)), this, SLOT(changeSyncApp())); | 97 | connect(syncapp,SIGNAL(activated(int)), this, SLOT(changeSyncApp())); |
99 | connect(restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); | 98 | connect(restoredefaults,SIGNAL(clicked()), this, SLOT(restoreDefaults())); |
100 | connect(deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); | 99 | connect(deleteentry,SIGNAL(clicked()), this, SLOT(deleteListEntry())); |
101 | 100 | ||
102 | loadUsers(); | 101 | loadUsers(); |
103 | updateGUI(); | 102 | updateGUI(); |
104 | 103 | ||
105 | dl = new QPEDialogListener(this); | 104 | dl = new QPEDialogListener(this); |
106 | showMaximized(); | 105 | showMaximized(); |
107 | } | 106 | } |
108 | 107 | ||
109 | Security::~Security() | 108 | Security::~Security() |
110 | { | 109 | { |
111 | } | 110 | } |
112 | 111 | ||
113 | void Security::deleteListEntry() | 112 | void Security::deleteListEntry() |
114 | { | 113 | { |
115 | syncnet->removeItem(syncnet->currentItem()); | 114 | syncnet->removeItem(syncnet->currentItem()); |
116 | } | 115 | } |
117 | 116 | ||
118 | void Security::restoreDefaults() | 117 | void Security::restoreDefaults() |
119 | { | 118 | { |
120 | QMessageBox unrecbox( | 119 | QMessageBox unrecbox( |
121 | tr("Attention"), | 120 | tr("Attention"), |
122 | tr("<p>All user-defined net ranges will be lost."), | 121 | tr("<p>All user-defined net ranges will be lost."), |
123 | QMessageBox::Warning, | 122 | QMessageBox::Warning, |
124 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, | 123 | QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, |
125 | 0, QString::null, TRUE, WStyle_StaysOnTop); | 124 | 0, QString::null, TRUE, WStyle_StaysOnTop); |
126 | unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); | 125 | unrecbox.setButtonText(QMessageBox::Cancel, tr("Cancel")); |
127 | unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); | 126 | unrecbox.setButtonText(QMessageBox::Yes, tr("Ok")); |
128 | 127 | ||
129 | if ( unrecbox.exec() == QMessageBox::Yes) | 128 | if ( unrecbox.exec() == QMessageBox::Yes) |
130 | { | 129 | { |
131 | syncnet->clear(); | 130 | syncnet->clear(); |
132 | insertDefaultRanges(); | 131 | insertDefaultRanges(); |
133 | } | 132 | } |
134 | } | 133 | } |
135 | 134 | ||
136 | void Security::insertDefaultRanges() | 135 | void Security::insertDefaultRanges() |
137 | { | 136 | { |
138 | syncnet->insertItem( tr( "192.168.129.0/24" ) ); | 137 | syncnet->insertItem( tr( "192.168.129.0/24" ) ); |
139 | syncnet->insertItem( tr( "192.168.1.0/24" ) ); | 138 | syncnet->insertItem( tr( "192.168.1.0/24" ) ); |
140 | syncnet->insertItem( tr( "192.168.0.0/16" ) ); | 139 | syncnet->insertItem( tr( "192.168.0.0/16" ) ); |
141 | syncnet->insertItem( tr( "172.16.0.0/12" ) ); | 140 | syncnet->insertItem( tr( "172.16.0.0/12" ) ); |
142 | syncnet->insertItem( tr( "10.0.0.0/8" ) ); | 141 | syncnet->insertItem( tr( "10.0.0.0/8" ) ); |
143 | syncnet->insertItem( tr( "1.0.0.0/8" ) ); | 142 | syncnet->insertItem( tr( "1.0.0.0/8" ) ); |
144 | syncnet->insertItem( tr( "Any" ) ); | 143 | syncnet->insertItem( tr( "Any" ) ); |
145 | syncnet->insertItem( tr( "None" ) ); | 144 | syncnet->insertItem( tr( "None" ) ); |
146 | } | 145 | } |
147 | 146 | ||
148 | void Security::updateGUI() | 147 | void Security::updateGUI() |
149 | { | 148 | { |
150 | bool empty = passcode.isEmpty(); | 149 | bool empty = passcode.isEmpty(); |
151 | 150 | ||
152 | changepasscode->setText( empty ? tr("Set passcode" ) | 151 | changepasscode->setText( empty ? tr("Set passcode" ) |
153 | : tr("Change passcode" ) ); | 152 | : tr("Change passcode" ) ); |
154 | passcode_poweron->setEnabled( !empty ); | 153 | passcode_poweron->setEnabled( !empty ); |
155 | clearpasscode->setEnabled( !empty ); | 154 | clearpasscode->setEnabled( !empty ); |
156 | 155 | ||
157 | autologinToggle->setChecked(autoLogin); | 156 | autologinToggle->setChecked(autoLogin); |
158 | userlist->setEnabled(autoLogin); | 157 | userlist->setEnabled(autoLogin); |
159 | } | 158 | } |
160 | 159 | ||
161 | 160 | ||
162 | void Security::show() | 161 | void Security::show() |
163 | { | 162 | { |
164 | //valid=FALSE; | 163 | //valid=FALSE; |
165 | setEnabled(FALSE); | 164 | setEnabled(FALSE); |
166 | SecurityBase::show(); | 165 | SecurityBase::show(); |
167 | if ( passcode.isEmpty() ) { | 166 | if ( passcode.isEmpty() ) { |
168 | // could insist... | 167 | // could insist... |
169 | //changePassCode(); | 168 | //changePassCode(); |
170 | //if ( passcode.isEmpty() ) | 169 | //if ( passcode.isEmpty() ) |
171 | //reject(); | 170 | //reject(); |
172 | } else { | 171 | } else { |
173 | if (!valid) // security passcode was not asked yet, so ask now | 172 | if (!valid) // security passcode was not asked yet, so ask now |
174 | { | 173 | { |
175 | QString pc = enterPassCode(tr("Enter passcode")); | 174 | QString pc = enterPassCode(tr("Enter passcode")); |
176 | if ( pc != passcode ) { | 175 | if ( pc != passcode ) { |
177 | QMessageBox::critical(this, tr("Passcode incorrect"), | 176 | QMessageBox::critical(this, tr("Passcode incorrect"), |
178 | tr("The passcode entered is incorrect.\nAccess denied")); | 177 | tr("The passcode entered is incorrect.\nAccess denied")); |
179 | reject(); | 178 | reject(); |
180 | return; | 179 | return; |
181 | } | 180 | } |
182 | } | 181 | } |
183 | } | 182 | } |
184 | setEnabled(TRUE); | 183 | setEnabled(TRUE); |
185 | valid=TRUE; | 184 | valid=TRUE; |
186 | } | 185 | } |
187 | 186 | ||
188 | void Security::accept() | 187 | void Security::accept() |
189 | { | 188 | { |
190 | applySecurity(); | 189 | applySecurity(); |
191 | QDialog::accept(); | 190 | QDialog::accept(); |
192 | QCopEnvelope env("QPE/System", "securityChanged()" ); | 191 | QCopEnvelope env("QPE/System", "securityChanged()" ); |
193 | } | 192 | } |
194 | 193 | ||
195 | void Security::done(int r) | 194 | void Security::done(int r) |
196 | { | 195 | { |
197 | QDialog::done(r); | 196 | QDialog::done(r); |
198 | close(); | 197 | close(); |
199 | } | 198 | } |
200 | 199 | ||
201 | void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) | 200 | void Security::selectNet(int auth_peer,int auth_peer_bits, bool update) |
202 | { | 201 | { |
203 | QString sn; | 202 | QString sn; |
204 | if ( auth_peer_bits == 0 && auth_peer == 0 ) { | 203 | if ( auth_peer_bits == 0 && auth_peer == 0 ) { |
205 | sn = tr("Any"); | 204 | sn = tr("Any"); |
206 | } else if ( auth_peer_bits == 32 && auth_peer == 0 ) { | 205 | } else if ( auth_peer_bits == 32 && auth_peer == 0 ) { |
207 | sn = tr("None"); | 206 | sn = tr("None"); |
208 | } else { | 207 | } else { |
209 | sn = | 208 | sn = |
210 | QString::number((auth_peer>>24)&0xff) + "." | 209 | QString::number((auth_peer>>24)&0xff) + "." |
211 | + QString::number((auth_peer>>16)&0xff) + "." | 210 | + QString::number((auth_peer>>16)&0xff) + "." |
212 | + QString::number((auth_peer>>8)&0xff) + "." | 211 | + QString::number((auth_peer>>8)&0xff) + "." |
213 | + QString::number((auth_peer>>0)&0xff) + "/" | 212 | + QString::number((auth_peer>>0)&0xff) + "/" |
214 | + QString::number(auth_peer_bits); | 213 | + QString::number(auth_peer_bits); |
215 | } | 214 | } |
216 | 215 | ||
217 | //insert user-defined list of netranges upon start | 216 | //insert user-defined list of netranges upon start |
218 | if (update) { | 217 | if (update) { |
219 | //User selected/active netrange first | 218 | //User selected/active netrange first |
220 | syncnet->insertItem( tr( sn ) ); | 219 | syncnet->insertItem( tr( sn ) ); |
221 | 220 | ||
222 | Config cfg("Security"); | 221 | Config cfg("Security"); |
223 | cfg.setGroup("Sync"); | 222 | cfg.setGroup("Sync"); |
224 | 223 | ||
225 | //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe | 224 | //set up defaults if needed, if someone manually deletes net0 he'll get a suprise hehe |
226 | QString test = cfg.readEntry("net0",""); | 225 | QString test = cfg.readEntry("net0",""); |
227 | if (test.isEmpty()) { | 226 | if (test.isEmpty()) { |
228 | insertDefaultRanges(); | 227 | insertDefaultRanges(); |
229 | } else { | 228 | } else { |
230 | // 10 ought to be enough for everybody... :) | 229 | // 10 ought to be enough for everybody... :) |
231 | // If you need more, don't forget to edit applySecurity() as well | 230 | // If you need more, don't forget to edit applySecurity() as well |
232 | bool already_there=FALSE; | 231 | bool already_there=FALSE; |
233 | for (int i=0; i<10; i++) { | 232 | for (int i=0; i<10; i++) { |
234 | QString target, netrange; | 233 | QString target, netrange; |
235 | target.sprintf("net%d", i); | 234 | target.sprintf("net%d", i); |
236 | netrange = cfg.readEntry(target,""); | 235 | netrange = cfg.readEntry(target,""); |
237 | if (! netrange.isEmpty()){ | 236 | if (! netrange.isEmpty()){ |
238 | //make sure we have no "twin" entries | 237 | //make sure we have no "twin" entries |
239 | for (int i=0; i<syncnet->count(); i++) { | 238 | for (int i=0; i<syncnet->count(); i++) { |
240 | if ( syncnet->text(i) == netrange ) { | 239 | if ( syncnet->text(i) == netrange ) { |
241 | already_there=TRUE; | 240 | already_there=TRUE; |
242 | } | 241 | } |
243 | } | 242 | } |
244 | if (! already_there) { | 243 | if (! already_there) { |
245 | syncnet->insertItem( tr( netrange ) ); | 244 | syncnet->insertItem( tr( netrange ) ); |
246 | } else { | 245 | } else { |
247 | already_there=FALSE; | 246 | already_there=FALSE; |
248 | } | 247 | } |
249 | } | 248 | } |
250 | } | 249 | } |
251 | } | 250 | } |
252 | } | 251 | } |
253 | 252 | ||
254 | for (int i=0; i<syncnet->count(); i++) { | 253 | for (int i=0; i<syncnet->count(); i++) { |
255 | if ( syncnet->text(i).left(sn.length()) == sn ) { | 254 | if ( syncnet->text(i).left(sn.length()) == sn ) { |
256 | syncnet->setCurrentItem(i); | 255 | syncnet->setCurrentItem(i); |
257 | return; | 256 | return; |
258 | } | 257 | } |
259 | } | 258 | } |
260 | qDebug("No match for \"%s\"",sn.latin1()); | 259 | qDebug("No match for \"%s\"",sn.latin1()); |
261 | } | 260 | } |
262 | 261 | ||
263 | void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) | 262 | void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) |
264 | { | 263 | { |
265 | auth_peer=0; | 264 | auth_peer=0; |
266 | if ( sn == tr("Any") ) { | 265 | if ( sn == tr("Any") ) { |
267 | auth_peer = 0; | 266 | auth_peer = 0; |
268 | auth_peer_bits = 0; | 267 | auth_peer_bits = 0; |
269 | } else if ( sn == tr("None") ) { | 268 | } else if ( sn == tr("None") ) { |
270 | auth_peer = 0; | 269 | auth_peer = 0; |
271 | auth_peer_bits = 32; | 270 | auth_peer_bits = 32; |
272 | } else { | 271 | } else { |
273 | int x=0; | 272 | int x=0; |
274 | for (int i=0; i<4; i++) { | 273 | for (int i=0; i<4; i++) { |
275 | int nx = sn.find(QChar(i==3 ? '/' : '.'),x); | 274 | int nx = sn.find(QChar(i==3 ? '/' : '.'),x); |
276 | auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt(); | 275 | auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt(); |
277 | x = nx+1; | 276 | x = nx+1; |
278 | } | 277 | } |
279 | uint n = (uint)sn.find(' ',x)-x; | 278 | uint n = (uint)sn.find(' ',x)-x; |
280 | auth_peer_bits = sn.mid(x,n).toInt(); | 279 | auth_peer_bits = sn.mid(x,n).toInt(); |
281 | } | 280 | } |
282 | } | 281 | } |
283 | 282 | ||
284 | void Security::loadUsers ( void ) | 283 | void Security::loadUsers ( void ) |
285 | { | 284 | { |
286 | QFile passwd("/etc/passwd"); | 285 | QFile passwd("/etc/passwd"); |
287 | if ( passwd.open(IO_ReadOnly) ) { | 286 | if ( passwd.open(IO_ReadOnly) ) { |
288 | QTextStream t( &passwd ); | 287 | QTextStream t( &passwd ); |
289 | QString s; | 288 | QString s; |
290 | QStringList account; | 289 | QStringList account; |
291 | while ( !t.eof() ) { | 290 | while ( !t.eof() ) { |
292 | account = QStringList::split(':',t.readLine()); | 291 | account = QStringList::split(':',t.readLine()); |
293 | 292 | ||
294 | // Hide disabled accounts | 293 | // Hide disabled accounts |
295 | if (*account.at(1)!="*") { | 294 | if (*account.at(1)!="*") { |
296 | 295 | ||
297 | userlist->insertItem(*account.at(0)); | 296 | userlist->insertItem(*account.at(0)); |
298 | // Highlight this item if it is set to autologinToggle | 297 | // Highlight this item if it is set to autologinToggle |
299 | if ( *account.at(0) == autoLoginName) | 298 | if ( *account.at(0) == autoLoginName) |
300 | userlist->setCurrentItem(userlist->count()-1); | 299 | userlist->setCurrentItem(userlist->count()-1); |
301 | } | 300 | } |
302 | } | 301 | } |
303 | passwd.close(); | 302 | passwd.close(); |
304 | } | 303 | } |
305 | 304 | ||
306 | } | 305 | } |
307 | 306 | ||
308 | void Security::toggleAutoLogin(bool val) | 307 | void Security::toggleAutoLogin(bool val) |
309 | { | 308 | { |
310 | autoLogin=val; | 309 | autoLogin=val; |
311 | userlist->setEnabled(val); | 310 | userlist->setEnabled(val); |
312 | if (!autoLogin) | 311 | if (!autoLogin) |
313 | autoLoginName=userlist->currentText(); | 312 | autoLoginName=userlist->currentText(); |
314 | } | 313 | } |
315 | 314 | ||
316 | 315 | ||
317 | 316 | ||
318 | 317 | ||
319 | void Security::setSyncNet(const QString& sn) | 318 | void Security::setSyncNet(const QString& sn) |
320 | { | 319 | { |
321 | int auth_peer,auth_peer_bits; | 320 | int auth_peer,auth_peer_bits; |
322 | parseNet(sn,auth_peer,auth_peer_bits); | 321 | parseNet(sn,auth_peer,auth_peer_bits); |
323 | selectNet(auth_peer,auth_peer_bits,FALSE); | 322 | selectNet(auth_peer,auth_peer_bits,FALSE); |
324 | } | 323 | } |
325 | 324 | ||
326 | void Security::applySecurity() | 325 | void Security::applySecurity() |
327 | { | 326 | { |
328 | if ( valid ) { | 327 | if ( valid ) { |
329 | Config cfg("Security"); | 328 | Config cfg("Security"); |
330 | cfg.setGroup("Passcode"); | 329 | cfg.setGroup("Passcode"); |
331 | cfg.writeEntry("passcode",passcode); | 330 | cfg.writeEntry("passcode",passcode); |
332 | cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked()); | 331 | cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked()); |
333 | cfg.setGroup("Sync"); | 332 | cfg.setGroup("Sync"); |
334 | int auth_peer=0; | 333 | int auth_peer=0; |
335 | int auth_peer_bits; | 334 | int auth_peer_bits; |
336 | QString sn = syncnet->currentText(); | 335 | QString sn = syncnet->currentText(); |
337 | parseNet(sn,auth_peer,auth_peer_bits); | 336 | parseNet(sn,auth_peer,auth_peer_bits); |
338 | 337 | ||
339 | //this is the *selected* (active) net range | 338 | //this is the *selected* (active) net range |
340 | cfg.writeEntry("auth_peer",auth_peer); | 339 | cfg.writeEntry("auth_peer",auth_peer); |
341 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); | 340 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); |
342 | 341 | ||
343 | //write back all other net ranges in *cleartext* | 342 | //write back all other net ranges in *cleartext* |
344 | for (int i=0; i<10; i++) { | 343 | for (int i=0; i<10; i++) { |
345 | QString target; | 344 | QString target; |
346 | target.sprintf("net%d", i); | 345 | target.sprintf("net%d", i); |
347 | cfg.writeEntry(target,syncnet->text(i)); | 346 | cfg.writeEntry(target,syncnet->text(i)); |
348 | } | 347 | } |
349 | 348 | ||
350 | cfg.writeEntry("syncapp",syncapp->currentText()); | 349 | cfg.writeEntry("syncapp",syncapp->currentText()); |
351 | 350 | ||
352 | /* | 351 | /* |
353 | cfg.setGroup("Remote"); | 352 | cfg.setGroup("Remote"); |
354 | if ( telnetAvailable() ) | 353 | if ( telnetAvailable() ) |
355 | cfg.writeEntry("allow_telnet",telnet->isChecked()); | 354 | cfg.writeEntry("allow_telnet",telnet->isChecked()); |
356 | if ( sshAvailable() ) | 355 | if ( sshAvailable() ) |
357 | cfg.writeEntry("allow_ssh",ssh->isChecked()); | 356 | cfg.writeEntry("allow_ssh",ssh->isChecked()); |
358 | // ### write ssh/telnet sys config files | 357 | // ### write ssh/telnet sys config files |
359 | */ | 358 | */ |
360 | 359 | ||
361 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; | 360 | QString configFile = QPEApplication::qpeDir() + "/etc/opie-login.conf"; |
362 | Config loginCfg(configFile,Config::File); | 361 | Config loginCfg(configFile,Config::File); |
363 | loginCfg.setGroup("General"); | 362 | loginCfg.setGroup("General"); |
364 | 363 | ||
365 | if (autoLogin) { | 364 | if (autoLogin) { |
366 | loginCfg.writeEntry("AutoLogin",autoLoginName); | 365 | loginCfg.writeEntry("AutoLogin",autoLoginName); |
367 | } else { | 366 | } else { |
368 | loginCfg.removeEntry("AutoLogin"); | 367 | loginCfg.removeEntry("AutoLogin"); |
369 | } | 368 | } |
370 | 369 | ||
371 | } | 370 | } |
372 | } | 371 | } |
373 | void Security::changeSyncApp() | 372 | void Security::changeSyncApp() |
374 | { | 373 | { |
375 | // Don't say i didn't tell ya | 374 | // Don't say i didn't tell ya |
376 | if (syncapp->currentText() == "IntelliSync") { | 375 | if (syncapp->currentText() == "IntelliSync") { |
377 | QMessageBox attn( | 376 | QMessageBox attn( |
378 | tr("WARNING"), | 377 | tr("WARNING"), |
379 | tr("<p>Selecting IntelliSync here will disable the FTP password." | 378 | tr("<p>Selecting IntelliSync here will disable the FTP password." |
380 | "<p>Every machine in your netrange will be able to sync with " | 379 | "<p>Every machine in your netrange will be able to sync with " |
381 | "your Zaurus!"), | 380 | "your Zaurus!"), |
382 | QMessageBox::Warning, | 381 | QMessageBox::Warning, |
383 | QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, | 382 | QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, |
384 | 0, QString::null, TRUE, WStyle_StaysOnTop); | 383 | 0, QString::null, TRUE, WStyle_StaysOnTop); |
385 | attn.setButtonText(QMessageBox::Cancel, tr("Ok")); | 384 | attn.setButtonText(QMessageBox::Cancel, tr("Ok")); |
386 | attn.exec(); | 385 | attn.exec(); |
387 | } | 386 | } |
388 | updateGUI(); | 387 | updateGUI(); |
389 | } | 388 | } |
390 | 389 | ||
391 | 390 | ||
392 | 391 | ||
393 | void Security::changeLoginName( int idx ) | 392 | void Security::changeLoginName( int idx ) |
394 | { | 393 | { |
395 | autoLoginName = userlist->text(idx);; | 394 | autoLoginName = userlist->text(idx);; |
396 | updateGUI(); | 395 | updateGUI(); |
397 | } | 396 | } |
398 | 397 | ||
399 | void Security::changePassCode() | 398 | void Security::changePassCode() |
400 | { | 399 | { |
401 | QString new1; | 400 | QString new1; |
402 | QString new2; | 401 | QString new2; |
403 | 402 | ||
404 | do { | 403 | do { |
405 | new1 = enterPassCode(tr("Enter new passcode")); | 404 | new1 = enterPassCode(tr("Enter new passcode")); |
406 | if ( new1.isNull() ) | 405 | if ( new1.isNull() ) |
407 | return; | 406 | return; |
408 | new2 = enterPassCode(tr("Re-enter new passcode")); | 407 | new2 = enterPassCode(tr("Re-enter new passcode")); |
409 | if ( new2.isNull() ) | 408 | if ( new2.isNull() ) |
410 | return; | 409 | return; |
411 | } while (new1 != new2); | 410 | } while (new1 != new2); |
412 | 411 | ||
413 | passcode = new1; | 412 | passcode = new1; |
414 | updateGUI(); | 413 | updateGUI(); |
415 | } | 414 | } |
416 | 415 | ||
417 | void Security::clearPassCode() | 416 | void Security::clearPassCode() |
418 | { | 417 | { |
419 | passcode = QString::null; | 418 | passcode = QString::null; |
420 | updateGUI(); | 419 | updateGUI(); |
421 | } | 420 | } |
422 | 421 | ||
423 | 422 | ||
424 | QString Security::enterPassCode(const QString& prompt) | 423 | QString Security::enterPassCode(const QString& prompt) |
425 | { | 424 | { |
426 | return Password::getPassword(prompt); | 425 | return Password::getPassword(prompt); |
427 | } | 426 | } |
428 | 427 | ||
429 | bool Security::telnetAvailable() const | 428 | bool Security::telnetAvailable() const |
430 | { | 429 | { |
431 | // ### not implemented | 430 | // ### not implemented |
432 | return FALSE; | 431 | return FALSE; |
433 | } | 432 | } |
434 | 433 | ||
435 | bool Security::sshAvailable() const | 434 | bool Security::sshAvailable() const |
436 | { | 435 | { |
437 | // ### not implemented | 436 | // ### not implemented |
438 | return FALSE; | 437 | return FALSE; |
439 | } | 438 | } |