-rw-r--r-- | noncore/settings/aqpkg/categoryfilterimpl.cpp | 28 | ||||
-rw-r--r-- | noncore/settings/aqpkg/instoptionsimpl.cpp | 44 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 176 | ||||
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 243 |
4 files changed, 252 insertions, 239 deletions
diff --git a/noncore/settings/aqpkg/categoryfilterimpl.cpp b/noncore/settings/aqpkg/categoryfilterimpl.cpp index 61e1f93..217d2c9 100644 --- a/noncore/settings/aqpkg/categoryfilterimpl.cpp +++ b/noncore/settings/aqpkg/categoryfilterimpl.cpp | |||
@@ -1,107 +1,113 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <iostream> | 30 | #include "categoryfilterimpl.h" |
31 | using namespace std; | 31 | |
32 | /* OPIE */ | ||
33 | #include <qpe/qpeapplication.h> | ||
32 | 34 | ||
35 | /* QT */ | ||
33 | #include <qgroupbox.h> | 36 | #include <qgroupbox.h> |
34 | #include <qlayout.h> | 37 | #include <qlayout.h> |
35 | #include <qlistbox.h> | 38 | #include <qlistbox.h> |
36 | #include <qstring.h> | 39 | #include <qstring.h> |
37 | 40 | ||
38 | #include "categoryfilterimpl.h" | 41 | /* STD */ |
42 | #include <iostream> | ||
43 | using namespace std; | ||
44 | |||
39 | 45 | ||
40 | CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name ) | 46 | CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name ) |
41 | : QDialog( parent, name, true ) | 47 | : QDialog( parent, name, true ) |
42 | { | 48 | { |
43 | setCaption( tr( "Category Filter" ) ); | 49 | setCaption( tr( "Category Filter" ) ); |
44 | 50 | ||
45 | QVBoxLayout *layout = new QVBoxLayout( this ); | 51 | QVBoxLayout *layout = new QVBoxLayout( this ); |
46 | layout->setMargin( 2 ); | 52 | layout->setMargin( 2 ); |
47 | layout->setSpacing( 4 ); | 53 | layout->setSpacing( 4 ); |
48 | 54 | ||
49 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Select one or more groups" ), this ); | 55 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Select one or more groups" ), this ); |
50 | grpbox->layout()->setSpacing( 2 ); | 56 | grpbox->layout()->setSpacing( 2 ); |
51 | grpbox->layout()->setMargin( 4 ); | 57 | grpbox->layout()->setMargin( 4 ); |
52 | layout->addWidget( grpbox ); | 58 | layout->addWidget( grpbox ); |
53 | 59 | ||
54 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 60 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
55 | 61 | ||
56 | lstCategories = new QListBox( grpbox ); | 62 | lstCategories = new QListBox( grpbox ); |
57 | lstCategories->setSelectionMode( QListBox::Multi ); | 63 | lstCategories->setSelectionMode( QListBox::Multi ); |
58 | grplayout->addWidget( lstCategories ); | 64 | grplayout->addWidget( lstCategories ); |
59 | 65 | ||
60 | // Split up categories and add them to the listbox | 66 | // Split up categories and add them to the listbox |
61 | int start = 1; | 67 | int start = 1; |
62 | 68 | ||
63 | QString item; | 69 | QString item; |
64 | int end; | 70 | int end; |
65 | QString finditem; | 71 | QString finditem; |
66 | do | 72 | do |
67 | { | 73 | { |
68 | end = categories.find( "#", start ); | 74 | end = categories.find( "#", start ); |
69 | item = categories.mid( start, end - start ); | 75 | item = categories.mid( start, end - start ); |
70 | if ( item != "" ) | 76 | if ( item != "" ) |
71 | { | 77 | { |
72 | lstCategories->insertItem( item ); | 78 | lstCategories->insertItem( item ); |
73 | finditem = QString( "#%1#" ).arg( item ); | 79 | finditem = QString( "#%1#" ).arg( item ); |
74 | if ( selectedCategories.find( finditem ) != -1 ) | 80 | if ( selectedCategories.find( finditem ) != -1 ) |
75 | lstCategories->setSelected( lstCategories->count()-1, true ); | 81 | lstCategories->setSelected( lstCategories->count()-1, true ); |
76 | } | 82 | } |
77 | 83 | ||
78 | start = end + 1; | 84 | start = end + 1; |
79 | } while ( start < (int)categories.length() ); | 85 | } |
86 | while ( start < (int)categories.length() ); | ||
80 | 87 | ||
81 | lstCategories->sort( true ); | 88 | lstCategories->sort( true ); |
82 | 89 | ||
83 | showMaximized(); | 90 | QPEApplication::showDialog( this ); |
84 | } | 91 | } |
85 | 92 | ||
86 | CategoryFilterImpl :: ~CategoryFilterImpl() | 93 | CategoryFilterImpl :: ~CategoryFilterImpl() |
87 | { | 94 | {} |
88 | } | ||
89 | 95 | ||
90 | QString CategoryFilterImpl :: getSelectedFilter() | 96 | QString CategoryFilterImpl :: getSelectedFilter() |
91 | { | 97 | { |
92 | // Grab cetegories from listbox | 98 | // Grab cetegories from listbox |
93 | QString ret = "#"; | 99 | QString ret = "#"; |
94 | 100 | ||
95 | for ( int i = 0 ; i < (int)lstCategories->count() ; ++i ) | 101 | for ( int i = 0 ; i < (int)lstCategories->count() ; ++i ) |
96 | { | 102 | { |
97 | if ( lstCategories->isSelected( i ) ) | 103 | if ( lstCategories->isSelected( i ) ) |
98 | { | 104 | { |
99 | ret.append( lstCategories->text( i ) ); | 105 | ret.append( lstCategories->text( i ) ); |
100 | ret.append( "#" ); | 106 | ret.append( "#" ); |
101 | } | 107 | } |
102 | } | 108 | } |
103 | 109 | ||
104 | if ( ret == "#" ) | 110 | if ( ret == "#" ) |
105 | ret = ""; | 111 | ret = ""; |
106 | return ret; | 112 | return ret; |
107 | } | 113 | } |
diff --git a/noncore/settings/aqpkg/instoptionsimpl.cpp b/noncore/settings/aqpkg/instoptionsimpl.cpp index 9d52013..126e3b9 100644 --- a/noncore/settings/aqpkg/instoptionsimpl.cpp +++ b/noncore/settings/aqpkg/instoptionsimpl.cpp | |||
@@ -1,128 +1,130 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "global.h" | ||
31 | #include "instoptionsimpl.h" | ||
32 | #include "ipkg.h" | ||
33 | |||
34 | /* OPIE */ | ||
30 | #ifdef QWS | 35 | #ifdef QWS |
31 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
32 | #endif | 37 | #endif |
38 | #include <qpe/qpeapplication.h> | ||
33 | 39 | ||
40 | /* QT */ | ||
34 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
35 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
36 | #include <qgroupbox.h> | 43 | #include <qgroupbox.h> |
37 | #include <qlabel.h> | 44 | #include <qlabel.h> |
38 | #include <qlayout.h> | 45 | #include <qlayout.h> |
39 | 46 | ||
40 | #include "global.h" | ||
41 | #include "instoptionsimpl.h" | ||
42 | #include "ipkg.h" | ||
43 | |||
44 | InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * parent, const char* name, bool modal, WFlags fl ) | 47 | InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * parent, const char* name, bool modal, WFlags fl ) |
45 | : QDialog( parent, name, modal, fl ) | 48 | : QDialog( parent, name, modal, fl ) |
46 | { | 49 | { |
47 | setCaption( tr( "Options" ) ); | 50 | setCaption( tr( "Options" ) ); |
48 | 51 | ||
49 | QVBoxLayout *layout = new QVBoxLayout( this ); | 52 | QVBoxLayout *layout = new QVBoxLayout( this ); |
50 | layout->setMargin( 2 ); | 53 | layout->setMargin( 2 ); |
51 | layout->setSpacing( 4 ); | 54 | layout->setSpacing( 4 ); |
52 | 55 | ||
53 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Options" ), this ); | 56 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Options" ), this ); |
54 | grpbox->layout()->setSpacing( 2 ); | 57 | grpbox->layout()->setSpacing( 2 ); |
55 | grpbox->layout()->setMargin( 4 ); | 58 | grpbox->layout()->setMargin( 4 ); |
56 | layout->addWidget( grpbox ); | 59 | layout->addWidget( grpbox ); |
57 | 60 | ||
58 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 61 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
59 | 62 | ||
60 | forceDepends = new QCheckBox( tr( "Force Depends" ), grpbox ); | 63 | forceDepends = new QCheckBox( tr( "Force Depends" ), grpbox ); |
61 | grplayout->addWidget( forceDepends ); | 64 | grplayout->addWidget( forceDepends ); |
62 | 65 | ||
63 | forceReinstall = new QCheckBox( tr( "Force Reinstall" ), grpbox ); | 66 | forceReinstall = new QCheckBox( tr( "Force Reinstall" ), grpbox ); |
64 | grplayout->addWidget( forceReinstall ); | 67 | grplayout->addWidget( forceReinstall ); |
65 | 68 | ||
66 | forceRemove = new QCheckBox( tr( "Force Remove" ), grpbox ); | 69 | forceRemove = new QCheckBox( tr( "Force Remove" ), grpbox ); |
67 | grplayout->addWidget( forceRemove ); | 70 | grplayout->addWidget( forceRemove ); |
68 | 71 | ||
69 | forceOverwrite = new QCheckBox( tr( "Force Overwrite" ), grpbox ); | 72 | forceOverwrite = new QCheckBox( tr( "Force Overwrite" ), grpbox ); |
70 | grplayout->addWidget( forceOverwrite ); | 73 | grplayout->addWidget( forceOverwrite ); |
71 | 74 | ||
72 | QLabel *l = new QLabel( tr( "Information Level" ), grpbox ); | 75 | QLabel *l = new QLabel( tr( "Information Level" ), grpbox ); |
73 | grplayout->addWidget( l ); | 76 | grplayout->addWidget( l ); |
74 | 77 | ||
75 | verboseIpkg = new QComboBox( grpbox ); | 78 | verboseIpkg = new QComboBox( grpbox ); |
76 | verboseIpkg->insertItem( tr( "Errors only" ) ); | 79 | verboseIpkg->insertItem( tr( "Errors only" ) ); |
77 | verboseIpkg->insertItem( tr( "Normal messages" ) ); | 80 | verboseIpkg->insertItem( tr( "Normal messages" ) ); |
78 | verboseIpkg->insertItem( tr( "Informative messages" ) ); | 81 | verboseIpkg->insertItem( tr( "Informative messages" ) ); |
79 | verboseIpkg->insertItem( tr( "Troubleshooting output" ) ); | 82 | verboseIpkg->insertItem( tr( "Troubleshooting output" ) ); |
80 | verboseIpkg->setCurrentItem( verb ); | 83 | verboseIpkg->setCurrentItem( verb ); |
81 | grplayout->addWidget( verboseIpkg ); | 84 | grplayout->addWidget( verboseIpkg ); |
82 | 85 | ||
83 | grplayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 86 | grplayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
84 | 87 | ||
85 | if ( flags & FORCE_DEPENDS ) | 88 | if ( flags & FORCE_DEPENDS ) |
86 | forceDepends->setChecked( true ); | 89 | forceDepends->setChecked( true ); |
87 | if ( flags & FORCE_REINSTALL ) | 90 | if ( flags & FORCE_REINSTALL ) |
88 | forceReinstall->setChecked( true ); | 91 | forceReinstall->setChecked( true ); |
89 | if ( flags & FORCE_REMOVE ) | 92 | if ( flags & FORCE_REMOVE ) |
90 | forceRemove->setChecked( true ); | 93 | forceRemove->setChecked( true ); |
91 | if ( flags & FORCE_OVERWRITE ) | 94 | if ( flags & FORCE_OVERWRITE ) |
92 | forceOverwrite->setChecked( true ); | 95 | forceOverwrite->setChecked( true ); |
93 | // if ( flags & VERBOSE_WGET ) | 96 | // if ( flags & VERBOSE_WGET ) |
94 | // verboseWget->setChecked( true ); | 97 | // verboseWget->setChecked( true ); |
95 | // if ( flags & MAKE_LINKS ) | 98 | // if ( flags & MAKE_LINKS ) |
96 | // makeLinks->setChecked( true ); | 99 | // makeLinks->setChecked( true ); |
97 | 100 | ||
98 | showMaximized(); | 101 | QPEApplication::showDialog( this ); |
99 | 102 | ||
100 | } | 103 | } |
101 | 104 | ||
102 | InstallOptionsDlgImpl::~InstallOptionsDlgImpl() | 105 | InstallOptionsDlgImpl::~InstallOptionsDlgImpl() |
103 | { | 106 | {} |
104 | } | ||
105 | 107 | ||
106 | 108 | ||
107 | int InstallOptionsDlgImpl :: getFlags() | 109 | int InstallOptionsDlgImpl :: getFlags() |
108 | { | 110 | { |
109 | int flags = 0; | 111 | int flags = 0; |
110 | 112 | ||
111 | if ( forceDepends->isChecked() ) | 113 | if ( forceDepends->isChecked() ) |
112 | flags |= FORCE_DEPENDS; | 114 | flags |= FORCE_DEPENDS; |
113 | if ( forceReinstall->isChecked() ) | 115 | if ( forceReinstall->isChecked() ) |
114 | flags |= FORCE_REINSTALL; | 116 | flags |= FORCE_REINSTALL; |
115 | if ( forceRemove->isChecked() ) | 117 | if ( forceRemove->isChecked() ) |
116 | flags |= FORCE_REMOVE; | 118 | flags |= FORCE_REMOVE; |
117 | if ( forceOverwrite->isChecked() ) | 119 | if ( forceOverwrite->isChecked() ) |
118 | flags |= FORCE_OVERWRITE; | 120 | flags |= FORCE_OVERWRITE; |
119 | if ( verboseWget->isChecked() ) | 121 | if ( verboseWget->isChecked() ) |
120 | flags |= VERBOSE_WGET; | 122 | flags |= VERBOSE_WGET; |
121 | 123 | ||
122 | return flags; | 124 | return flags; |
123 | } | 125 | } |
124 | 126 | ||
125 | int InstallOptionsDlgImpl :: getInfoLevel() | 127 | int InstallOptionsDlgImpl :: getInfoLevel() |
126 | { | 128 | { |
127 | return verboseIpkg->currentItem(); | 129 | return verboseIpkg->currentItem(); |
128 | } | 130 | } |
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index dbe694e..6f5c712 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -1,118 +1,121 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/limits.h> | 30 | #include "categoryfilterimpl.h" |
31 | #include <unistd.h> | 31 | #include "datamgr.h" |
32 | #include "global.h" | ||
33 | #include "inputdlg.h" | ||
34 | #include "ipkg.h" | ||
35 | #include "installdlgimpl.h" | ||
36 | #include "letterpushbutton.h" | ||
37 | #include "mainwin.h" | ||
38 | #include "packagewin.h" | ||
39 | #include "settingsimpl.h" | ||
40 | #include "utils.h" | ||
32 | 41 | ||
42 | /* OPIE */ | ||
33 | #include <qpe/qcopenvelope_qws.h> | 43 | #include <qpe/qcopenvelope_qws.h> |
34 | #include <qmenubar.h> | ||
35 | #include <qpe/qpeapplication.h> | 44 | #include <qpe/qpeapplication.h> |
36 | #include <qtoolbar.h> | ||
37 | #include <qpe/config.h> | 45 | #include <qpe/config.h> |
38 | #include <qpe/resource.h> | 46 | #include <qpe/resource.h> |
39 | 47 | ||
48 | /* QT */ | ||
49 | #include <qmenubar.h> | ||
50 | #include <qtoolbar.h> | ||
40 | #include <qaction.h> | 51 | #include <qaction.h> |
41 | #include <qcombobox.h> | 52 | #include <qcombobox.h> |
42 | #include <qfile.h> | 53 | #include <qfile.h> |
43 | #include <qlabel.h> | 54 | #include <qlabel.h> |
44 | #include <qlayout.h> | 55 | #include <qlayout.h> |
45 | #include <qlineedit.h> | 56 | #include <qlineedit.h> |
46 | #include <qlistview.h> | 57 | #include <qlistview.h> |
47 | #include <qmenubar.h> | 58 | #include <qmenubar.h> |
48 | #include <qmessagebox.h> | 59 | #include <qmessagebox.h> |
49 | #include <qpopupmenu.h> | 60 | #include <qpopupmenu.h> |
50 | #include <qprogressbar.h> | 61 | #include <qprogressbar.h> |
51 | #include <qtimer.h> | 62 | #include <qtimer.h> |
52 | #include <qwhatsthis.h> | 63 | #include <qwhatsthis.h> |
53 | #include <qwidgetstack.h> | 64 | #include <qwidgetstack.h> |
54 | 65 | ||
55 | #include "categoryfilterimpl.h" | 66 | /* STD */ |
56 | #include "datamgr.h" | 67 | #include <linux/limits.h> |
57 | #include "global.h" | 68 | #include <unistd.h> |
58 | #include "inputdlg.h" | ||
59 | #include "ipkg.h" | ||
60 | #include "installdlgimpl.h" | ||
61 | #include "letterpushbutton.h" | ||
62 | #include "mainwin.h" | ||
63 | #include "packagewin.h" | ||
64 | #include "settingsimpl.h" | ||
65 | #include "utils.h" | ||
66 | 69 | ||
67 | extern int compareVersions( const char *v1, const char *v2 ); | 70 | extern int compareVersions( const char *v1, const char *v2 ); |
68 | 71 | ||
69 | MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) | 72 | MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) |
70 | :QMainWindow( parent, name, fl || WStyle_ContextHelp ) | 73 | :QMainWindow( parent, name, fl || WStyle_ContextHelp ) |
71 | { | 74 | { |
72 | // Disable suspend mode | 75 | // Disable suspend mode |
73 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; | 76 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; |
74 | 77 | ||
75 | LOCAL_SERVER = QObject::tr( "Installed packages" ); | 78 | LOCAL_SERVER = QObject::tr( "Installed packages" ); |
76 | LOCAL_IPKGS = QObject::tr( "Local packages" ); | 79 | LOCAL_IPKGS = QObject::tr( "Local packages" ); |
77 | 80 | ||
78 | setCaption( tr( "AQPkg - Package Manager" ) ); | 81 | setCaption( tr( "AQPkg - Package Manager" ) ); |
79 | 82 | ||
80 | // Create UI widgets | 83 | // Create UI widgets |
81 | initMainWidget(); | 84 | initMainWidget(); |
82 | initProgressWidget(); | 85 | initProgressWidget(); |
83 | 86 | ||
84 | // Build menu and tool bars | 87 | // Build menu and tool bars |
85 | setToolBarsMovable( FALSE ); | 88 | setToolBarsMovable( FALSE ); |
86 | 89 | ||
87 | QToolBar *bar = new QToolBar( this ); | 90 | QToolBar *bar = new QToolBar( this ); |
88 | bar->setHorizontalStretchable( TRUE ); | 91 | bar->setHorizontalStretchable( TRUE ); |
89 | QMenuBar *mb = new QMenuBar( bar ); | 92 | QMenuBar *mb = new QMenuBar( bar ); |
90 | mb->setMargin( 0 ); | 93 | mb->setMargin( 0 ); |
91 | bar = new QToolBar( this ); | 94 | bar = new QToolBar( this ); |
92 | 95 | ||
93 | // Find toolbar | 96 | // Find toolbar |
94 | findBar = new QToolBar( this ); | 97 | findBar = new QToolBar( this ); |
95 | addToolBar( findBar, QMainWindow::Top, true ); | 98 | addToolBar( findBar, QMainWindow::Top, true ); |
96 | findBar->setHorizontalStretchable( true ); | 99 | findBar->setHorizontalStretchable( true ); |
97 | findEdit = new QLineEdit( findBar ); | 100 | findEdit = new QLineEdit( findBar ); |
98 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); | 101 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); |
99 | findBar->setStretchableWidget( findEdit ); | 102 | findBar->setStretchableWidget( findEdit ); |
100 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); | 103 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); |
101 | 104 | ||
102 | // Quick jump toolbar | 105 | // Quick jump toolbar |
103 | jumpBar = new QToolBar( this ); | 106 | jumpBar = new QToolBar( this ); |
104 | addToolBar( jumpBar, QMainWindow::Top, true ); | 107 | addToolBar( jumpBar, QMainWindow::Top, true ); |
105 | jumpBar->setHorizontalStretchable( true ); | 108 | jumpBar->setHorizontalStretchable( true ); |
106 | QWidget *w = new QWidget( jumpBar ); | 109 | QWidget *w = new QWidget( jumpBar ); |
107 | jumpBar->setStretchableWidget( w ); | 110 | jumpBar->setStretchableWidget( w ); |
108 | 111 | ||
109 | QGridLayout *layout = new QGridLayout( w ); | 112 | QGridLayout *layout = new QGridLayout( w ); |
110 | 113 | ||
111 | char text[2]; | 114 | char text[2]; |
112 | text[1] = '\0'; | 115 | text[1] = '\0'; |
113 | for ( int i = 0 ; i < 26 ; ++i ) | 116 | for ( int i = 0 ; i < 26 ; ++i ) |
114 | { | 117 | { |
115 | text[0] = 'A' + i; | 118 | text[0] = 'A' + i; |
116 | LetterPushButton *b = new LetterPushButton( text, w ); | 119 | LetterPushButton *b = new LetterPushButton( text, w ); |
117 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | 120 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); |
118 | layout->addWidget( b, i / 13, i % 13); | 121 | layout->addWidget( b, i / 13, i % 13); |
@@ -194,212 +197,212 @@ MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) | |||
194 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); | 197 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); |
195 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); | 198 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); |
196 | a->addTo( popup ); | 199 | a->addTo( popup ); |
197 | 200 | ||
198 | popup->insertSeparator(); | 201 | popup->insertSeparator(); |
199 | 202 | ||
200 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 203 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
201 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | 204 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); |
202 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); | 205 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); |
203 | a->addTo( popup ); | 206 | a->addTo( popup ); |
204 | 207 | ||
205 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 208 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); |
206 | actionFindNext->setEnabled( FALSE ); | 209 | actionFindNext->setEnabled( FALSE ); |
207 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | 210 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); |
208 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); | 211 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); |
209 | actionFindNext->addTo( popup ); | 212 | actionFindNext->addTo( popup ); |
210 | actionFindNext->addTo( findBar ); | 213 | actionFindNext->addTo( findBar ); |
211 | 214 | ||
212 | 215 | ||
213 | popup->insertSeparator(); | 216 | popup->insertSeparator(); |
214 | 217 | ||
215 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); | 218 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); |
216 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); | 219 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); |
217 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); | 220 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); |
218 | a->addTo( popup ); | 221 | a->addTo( popup ); |
219 | 222 | ||
220 | mb->insertItem( tr( "View" ), popup ); | 223 | mb->insertItem( tr( "View" ), popup ); |
221 | 224 | ||
222 | // Finish find toolbar creation | 225 | // Finish find toolbar creation |
223 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 226 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
224 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | 227 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); |
225 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); | 228 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); |
226 | a->addTo( findBar ); | 229 | a->addTo( findBar ); |
227 | findBar->hide(); | 230 | findBar->hide(); |
228 | 231 | ||
229 | // Create widget stack and add UI widgets | 232 | // Create widget stack and add UI widgets |
230 | stack = new QWidgetStack( this ); | 233 | stack = new QWidgetStack( this ); |
231 | stack->addWidget( progressWindow, 2 ); | 234 | stack->addWidget( progressWindow, 2 ); |
232 | stack->addWidget( networkPkgWindow, 1 ); | 235 | stack->addWidget( networkPkgWindow, 1 ); |
233 | setCentralWidget( stack ); | 236 | setCentralWidget( stack ); |
234 | stack->raiseWidget( progressWindow ); | 237 | stack->raiseWidget( progressWindow ); |
235 | 238 | ||
236 | // Delayed call to finish initialization | 239 | // Delayed call to finish initialization |
237 | QTimer::singleShot( 100, this, SLOT( init() ) ); | 240 | QTimer::singleShot( 100, this, SLOT( init() ) ); |
238 | } | 241 | } |
239 | 242 | ||
240 | MainWindow :: ~MainWindow() | 243 | MainWindow :: ~MainWindow() |
241 | { | 244 | { |
242 | delete mgr; | 245 | delete mgr; |
243 | 246 | ||
244 | // Reenable suspend mode | 247 | // Reenable suspend mode |
245 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 248 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
246 | } | 249 | } |
247 | 250 | ||
248 | void MainWindow :: initMainWidget() | 251 | void MainWindow :: initMainWidget() |
249 | { | 252 | { |
250 | networkPkgWindow = new QWidget( this ); | 253 | networkPkgWindow = new QWidget( this ); |
251 | 254 | ||
252 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); | 255 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); |
253 | 256 | ||
254 | serversList = new QComboBox( networkPkgWindow ); | 257 | serversList = new QComboBox( networkPkgWindow ); |
255 | connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); | 258 | connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); |
256 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); | 259 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); |
257 | 260 | ||
258 | installedIcon = Resource::loadPixmap( "installed" ); | 261 | installedIcon = Resource::loadPixmap( "installed" ); |
259 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); | 262 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); |
260 | 263 | ||
261 | packagesList = new QListView( networkPkgWindow ); | 264 | packagesList = new QListView( networkPkgWindow ); |
262 | packagesList->addColumn( tr( "Packages" ), 225 ); | 265 | packagesList->addColumn( tr( "Packages" ), 225 ); |
263 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); | 266 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); |
264 | QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); | 267 | QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); |
265 | connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), | 268 | connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), |
266 | this, SLOT(slotDisplayPackage(QListViewItem *)) ); | 269 | this, SLOT(slotDisplayPackage(QListViewItem *)) ); |
267 | 270 | ||
268 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); | 271 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); |
269 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); | 272 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); |
270 | hbox1->addWidget( l ); | 273 | hbox1->addWidget( l ); |
271 | hbox1->addWidget( serversList ); | 274 | hbox1->addWidget( serversList ); |
272 | 275 | ||
273 | vbox->addWidget( packagesList ); | 276 | vbox->addWidget( packagesList ); |
274 | 277 | ||
275 | downloadEnabled = TRUE; | 278 | downloadEnabled = TRUE; |
276 | } | 279 | } |
277 | 280 | ||
278 | void MainWindow :: initProgressWidget() | 281 | void MainWindow :: initProgressWidget() |
279 | { | 282 | { |
280 | progressWindow = new QWidget( this ); | 283 | progressWindow = new QWidget( this ); |
281 | 284 | ||
282 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); | 285 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); |
283 | 286 | ||
284 | m_status = new QLabel( progressWindow ); | 287 | m_status = new QLabel( progressWindow ); |
285 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 288 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
286 | layout->addWidget( m_status ); | 289 | layout->addWidget( m_status ); |
287 | 290 | ||
288 | m_progress = new QProgressBar( progressWindow ); | 291 | m_progress = new QProgressBar( progressWindow ); |
289 | layout->addWidget( m_progress ); | 292 | layout->addWidget( m_progress ); |
290 | } | 293 | } |
291 | 294 | ||
292 | void MainWindow :: init() | 295 | void MainWindow :: init() |
293 | { | 296 | { |
294 | #ifdef QWS | 297 | #ifdef QWS |
295 | // read download directory from config file | 298 | // read download directory from config file |
296 | Config cfg( "aqpkg" ); | 299 | Config cfg( "aqpkg" ); |
297 | cfg.setGroup( "settings" ); | 300 | cfg.setGroup( "settings" ); |
298 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | 301 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); |
299 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | 302 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); |
300 | 303 | ||
301 | #endif | 304 | #endif |
302 | 305 | ||
303 | stack->raiseWidget( progressWindow ); | 306 | stack->raiseWidget( progressWindow ); |
304 | 307 | ||
305 | mgr = new DataManager(); | 308 | mgr = new DataManager(); |
306 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); | 309 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); |
307 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), | 310 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), |
308 | this, SLOT( setProgressMessage( const QString & ) ) ); | 311 | this, SLOT( setProgressMessage( const QString & ) ) ); |
309 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); | 312 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); |
310 | mgr->loadServers(); | 313 | mgr->loadServers(); |
311 | 314 | ||
312 | showUninstalledPkgs = false; | 315 | showUninstalledPkgs = false; |
313 | showInstalledPkgs = false; | 316 | showInstalledPkgs = false; |
314 | showUpgradedPkgs = false; | 317 | showUpgradedPkgs = false; |
315 | categoryFilterEnabled = false; | 318 | categoryFilterEnabled = false; |
316 | 319 | ||
317 | updateData(); | 320 | updateData(); |
318 | 321 | ||
319 | stack->raiseWidget( networkPkgWindow ); | 322 | stack->raiseWidget( networkPkgWindow ); |
320 | } | 323 | } |
321 | 324 | ||
322 | void MainWindow :: setDocument( const QString &doc ) | 325 | void MainWindow :: setDocument( const QString &doc ) |
323 | { | 326 | { |
324 | // Remove path from package | 327 | // Remove path from package |
325 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 328 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
326 | 329 | ||
327 | // First select local server | 330 | // First select local server |
328 | for ( int i = 0 ; i < serversList->count() ; ++i ) | 331 | for ( int i = 0 ; i < serversList->count() ; ++i ) |
329 | { | 332 | { |
330 | if ( serversList->text( i ) == LOCAL_IPKGS ) | 333 | if ( serversList->text( i ) == LOCAL_IPKGS ) |
331 | { | 334 | { |
332 | serversList->setCurrentItem( i ); | 335 | serversList->setCurrentItem( i ); |
333 | break; | 336 | break; |
334 | } | 337 | } |
335 | } | 338 | } |
336 | serverSelected( 0 ); | 339 | serverSelected( 0 ); |
337 | 340 | ||
338 | // Now set the check box of the selected package | 341 | // Now set the check box of the selected package |
339 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 342 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
340 | item != 0 ; | 343 | item != 0 ; |
341 | item = (QCheckListItem *)item->nextSibling() ) | 344 | item = (QCheckListItem *)item->nextSibling() ) |
342 | { | 345 | { |
343 | if ( item->text().startsWith( package ) ) | 346 | if ( item->text().startsWith( package ) ) |
344 | { | 347 | { |
345 | item->setOn( true ); | 348 | item->setOn( true ); |
346 | break; | 349 | break; |
347 | } | 350 | } |
348 | } | 351 | } |
349 | } | 352 | } |
350 | 353 | ||
351 | void MainWindow :: displaySettings() | 354 | void MainWindow :: displaySettings() |
352 | { | 355 | { |
353 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 356 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
354 | if ( dlg->showDlg() ) | 357 | if ( dlg->showDlg() ) |
355 | { | 358 | { |
356 | stack->raiseWidget( progressWindow ); | 359 | stack->raiseWidget( progressWindow ); |
357 | updateData(); | 360 | updateData(); |
358 | stack->raiseWidget( networkPkgWindow ); | 361 | stack->raiseWidget( networkPkgWindow ); |
359 | } | 362 | } |
360 | delete dlg; | 363 | delete dlg; |
361 | } | 364 | } |
362 | 365 | ||
363 | void MainWindow :: closeEvent( QCloseEvent *e ) | 366 | void MainWindow :: closeEvent( QCloseEvent *e ) |
364 | { | 367 | { |
365 | // If install dialog is visible, return to main view, otherwise close app | 368 | // If install dialog is visible, return to main view, otherwise close app |
366 | QWidget *widget = stack->visibleWidget(); | 369 | QWidget *widget = stack->visibleWidget(); |
367 | 370 | ||
368 | if ( widget != networkPkgWindow && widget != progressWindow ) | 371 | if ( widget != networkPkgWindow && widget != progressWindow ) |
369 | { | 372 | { |
370 | if ( widget ) delete widget; | 373 | if ( widget ) delete widget; |
371 | stack->raiseWidget( networkPkgWindow ); | 374 | stack->raiseWidget( networkPkgWindow ); |
372 | e->ignore(); | 375 | e->ignore(); |
373 | } | 376 | } |
374 | else | 377 | else |
375 | { | 378 | { |
376 | e->accept(); | 379 | e->accept(); |
377 | } | 380 | } |
378 | } | 381 | } |
379 | 382 | ||
380 | void MainWindow :: displayFindBar() | 383 | void MainWindow :: displayFindBar() |
381 | { | 384 | { |
382 | findBar->show(); | 385 | findBar->show(); |
383 | findEdit->setFocus(); | 386 | findEdit->setFocus(); |
384 | } | 387 | } |
385 | 388 | ||
386 | void MainWindow :: displayJumpBar() | 389 | void MainWindow :: displayJumpBar() |
387 | { | 390 | { |
388 | jumpBar->show(); | 391 | jumpBar->show(); |
389 | } | 392 | } |
390 | 393 | ||
391 | void MainWindow :: repeatFind() | 394 | void MainWindow :: repeatFind() |
392 | { | 395 | { |
393 | searchForPackage( findEdit->text() ); | 396 | searchForPackage( findEdit->text() ); |
394 | } | 397 | } |
395 | 398 | ||
396 | void MainWindow :: findPackage( const QString &text ) | 399 | void MainWindow :: findPackage( const QString &text ) |
397 | { | 400 | { |
398 | actionFindNext->setEnabled( !text.isEmpty() ); | 401 | actionFindNext->setEnabled( !text.isEmpty() ); |
399 | searchForPackage( text ); | 402 | searchForPackage( text ); |
400 | } | 403 | } |
401 | 404 | ||
402 | void MainWindow :: hideFindBar() | 405 | void MainWindow :: hideFindBar() |
403 | { | 406 | { |
404 | findBar->hide(); | 407 | findBar->hide(); |
405 | } | 408 | } |
@@ -537,704 +540,705 @@ void MainWindow :: enableDownload( bool enabled ) | |||
537 | } | 540 | } |
538 | } | 541 | } |
539 | 542 | ||
540 | void MainWindow :: setProgressSteps( int numsteps ) | 543 | void MainWindow :: setProgressSteps( int numsteps ) |
541 | { | 544 | { |
542 | m_progress->setTotalSteps( numsteps ); | 545 | m_progress->setTotalSteps( numsteps ); |
543 | } | 546 | } |
544 | 547 | ||
545 | void MainWindow :: setProgressMessage( const QString &msg ) | 548 | void MainWindow :: setProgressMessage( const QString &msg ) |
546 | { | 549 | { |
547 | m_status->setText( msg ); | 550 | m_status->setText( msg ); |
548 | } | 551 | } |
549 | 552 | ||
550 | void MainWindow :: updateProgress( int progress ) | 553 | void MainWindow :: updateProgress( int progress ) |
551 | { | 554 | { |
552 | m_progress->setProgress( progress ); | 555 | m_progress->setProgress( progress ); |
553 | } | 556 | } |
554 | 557 | ||
555 | void MainWindow :: updateData() | 558 | void MainWindow :: updateData() |
556 | { | 559 | { |
557 | m_progress->setTotalSteps( mgr->getServerList().count() ); | 560 | m_progress->setTotalSteps( mgr->getServerList().count() ); |
558 | 561 | ||
559 | serversList->clear(); | 562 | serversList->clear(); |
560 | packagesList->clear(); | 563 | packagesList->clear(); |
561 | 564 | ||
562 | int activeItem = -1; | 565 | int activeItem = -1; |
563 | int i = 0; | 566 | int i = 0; |
564 | QString serverName; | 567 | QString serverName; |
565 | 568 | ||
566 | QListIterator<Server> it( mgr->getServerList() ); | 569 | QListIterator<Server> it( mgr->getServerList() ); |
567 | Server *server; | 570 | Server *server; |
568 | 571 | ||
569 | for ( ; it.current(); ++it, ++i ) | 572 | for ( ; it.current(); ++it, ++i ) |
570 | { | 573 | { |
571 | server = it.current(); | 574 | server = it.current(); |
572 | serverName = server->getServerName(); | 575 | serverName = server->getServerName(); |
573 | m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); | 576 | m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); |
574 | m_progress->setProgress( i ); | 577 | m_progress->setProgress( i ); |
575 | qApp->processEvents(); | 578 | qApp->processEvents(); |
576 | 579 | ||
577 | if ( !server->isServerActive() ) | 580 | if ( !server->isServerActive() ) |
578 | { | 581 | { |
579 | i--; | 582 | i--; |
580 | continue; | 583 | continue; |
581 | } | 584 | } |
582 | 585 | ||
583 | serversList->insertItem( serverName ); | 586 | serversList->insertItem( serverName ); |
584 | if ( serverName == currentlySelectedServer ) | 587 | if ( serverName == currentlySelectedServer ) |
585 | activeItem = i; | 588 | activeItem = i; |
586 | } | 589 | } |
587 | 590 | ||
588 | // set selected server to be active server | 591 | // set selected server to be active server |
589 | if ( activeItem != -1 ) | 592 | if ( activeItem != -1 ) |
590 | serversList->setCurrentItem( activeItem ); | 593 | serversList->setCurrentItem( activeItem ); |
591 | serverSelected( 0, FALSE ); | 594 | serverSelected( 0, FALSE ); |
592 | } | 595 | } |
593 | 596 | ||
594 | void MainWindow :: serverSelected( int index ) | 597 | void MainWindow :: serverSelected( int index ) |
595 | { | 598 | { |
596 | serverSelected( index, TRUE ); | 599 | serverSelected( index, TRUE ); |
597 | } | 600 | } |
598 | 601 | ||
599 | void MainWindow :: serverSelected( int, bool raiseProgress ) | 602 | void MainWindow :: serverSelected( int, bool raiseProgress ) |
600 | { | 603 | { |
601 | QPixmap nullIcon( installedIcon.size() ); | 604 | QPixmap nullIcon( installedIcon.size() ); |
602 | nullIcon.fill( colorGroup().base() ); | 605 | nullIcon.fill( colorGroup().base() ); |
603 | 606 | ||
604 | // display packages | 607 | // display packages |
605 | QString serverName = serversList->currentText(); | 608 | QString serverName = serversList->currentText(); |
606 | currentlySelectedServer = serverName; | 609 | currentlySelectedServer = serverName; |
607 | 610 | ||
608 | Server *s = mgr->getServer( serverName ); | 611 | Server *s = mgr->getServer( serverName ); |
609 | 612 | ||
610 | QList<Package> &list = s->getPackageList(); | 613 | QList<Package> &list = s->getPackageList(); |
611 | QListIterator<Package> it( list ); | 614 | QListIterator<Package> it( list ); |
612 | 615 | ||
613 | // Display progress widget while loading list | 616 | // Display progress widget while loading list |
614 | bool doProgress = ( list.count() > 200 ); | 617 | bool doProgress = ( list.count() > 200 ); |
615 | if ( doProgress ) | 618 | if ( doProgress ) |
616 | { | 619 | { |
617 | if ( raiseProgress ) | 620 | if ( raiseProgress ) |
618 | { | 621 | { |
619 | stack->raiseWidget( progressWindow ); | 622 | stack->raiseWidget( progressWindow ); |
620 | } | 623 | } |
621 | m_progress->setTotalSteps( list.count() ); | 624 | m_progress->setTotalSteps( list.count() ); |
622 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); | 625 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); |
623 | } | 626 | } |
624 | 627 | ||
625 | packagesList->clear(); | 628 | packagesList->clear(); |
626 | 629 | ||
627 | #ifdef QWS | 630 | #ifdef QWS |
628 | // read download directory from config file | 631 | // read download directory from config file |
629 | Config cfg( "aqpkg" ); | 632 | Config cfg( "aqpkg" ); |
630 | cfg.setGroup( "settings" ); | 633 | cfg.setGroup( "settings" ); |
631 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | 634 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); |
632 | #endif | 635 | #endif |
633 | 636 | ||
634 | int i = 0; | 637 | int i = 0; |
635 | Package *package; | 638 | Package *package; |
636 | for ( ; it.current(); ++it ) | 639 | for ( ; it.current(); ++it ) |
637 | { | 640 | { |
638 | // Update progress after every 100th package (arbitrary value, seems to give good balance) | 641 | // Update progress after every 100th package (arbitrary value, seems to give good balance) |
639 | i++; | 642 | i++; |
640 | if ( ( i % 100 ) == 0 ) | 643 | if ( ( i % 100 ) == 0 ) |
641 | { | 644 | { |
642 | if ( doProgress ) | 645 | if ( doProgress ) |
643 | { | 646 | { |
644 | m_progress->setProgress( i ); | 647 | m_progress->setProgress( i ); |
645 | } | 648 | } |
646 | qApp->processEvents(); | 649 | qApp->processEvents(); |
647 | } | 650 | } |
648 | 651 | ||
649 | QString text = ""; | 652 | QString text = ""; |
650 | 653 | ||
651 | package = it.current(); | 654 | package = it.current(); |
652 | 655 | ||
653 | // Apply show only uninstalled packages filter | 656 | // Apply show only uninstalled packages filter |
654 | if ( showUninstalledPkgs && package->isInstalled() ) | 657 | if ( showUninstalledPkgs && package->isInstalled() ) |
655 | continue; | 658 | continue; |
656 | 659 | ||
657 | // Apply show only installed packages filter | 660 | // Apply show only installed packages filter |
658 | if ( showInstalledPkgs && !package->isInstalled() ) | 661 | if ( showInstalledPkgs && !package->isInstalled() ) |
659 | continue; | 662 | continue; |
660 | 663 | ||
661 | // Apply show only new installed packages filter | 664 | // Apply show only new installed packages filter |
662 | if ( showUpgradedPkgs ) | 665 | if ( showUpgradedPkgs ) |
663 | { | 666 | { |
664 | if ( !package->isInstalled() || !package->getNewVersionAvailable() ) | 667 | if ( !package->isInstalled() || !package->getNewVersionAvailable() ) |
665 | continue; | 668 | continue; |
666 | } | 669 | } |
667 | 670 | ||
668 | // Apply the section filter | 671 | // Apply the section filter |
669 | if ( categoryFilterEnabled && categoryFilter != "" ) | 672 | if ( categoryFilterEnabled && categoryFilter != "" ) |
670 | { | 673 | { |
671 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) | 674 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) |
672 | continue; | 675 | continue; |
673 | } | 676 | } |
674 | 677 | ||
675 | // If the local server, only display installed packages | 678 | // If the local server, only display installed packages |
676 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) | 679 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) |
677 | continue; | 680 | continue; |
678 | 681 | ||
679 | 682 | ||
680 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), | 683 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), |
681 | QCheckListItem::CheckBox ); | 684 | QCheckListItem::CheckBox ); |
682 | 685 | ||
683 | if ( package->isInstalled() ) | 686 | if ( package->isInstalled() ) |
684 | { | 687 | { |
685 | // If a different version of package is available, show update available icon | 688 | // If a different version of package is available, show update available icon |
686 | // Otherwise, show installed icon | 689 | // Otherwise, show installed icon |
687 | if ( package->getNewVersionAvailable()) | 690 | if ( package->getNewVersionAvailable()) |
688 | { | 691 | { |
689 | 692 | ||
690 | item->setPixmap( 0, updatedIcon ); | 693 | item->setPixmap( 0, updatedIcon ); |
691 | } | 694 | } |
692 | else | 695 | else |
693 | { | 696 | { |
694 | item->setPixmap( 0, installedIcon ); | 697 | item->setPixmap( 0, installedIcon ); |
695 | } | 698 | } |
696 | } | 699 | } |
697 | else | 700 | else |
698 | { | 701 | { |
699 | item->setPixmap( 0, nullIcon ); | 702 | item->setPixmap( 0, nullIcon ); |
700 | } | 703 | } |
701 | 704 | ||
702 | packagesList->insertItem( item ); | 705 | packagesList->insertItem( item ); |
703 | } | 706 | } |
704 | 707 | ||
705 | // If the local server or the local ipkgs server disable the download button | 708 | // If the local server or the local ipkgs server disable the download button |
706 | if ( serverName == LOCAL_SERVER ) | 709 | if ( serverName == LOCAL_SERVER ) |
707 | { | 710 | { |
708 | downloadEnabled = TRUE; | 711 | downloadEnabled = TRUE; |
709 | actionUpgrade->setEnabled( FALSE ); | 712 | actionUpgrade->setEnabled( FALSE ); |
710 | } | 713 | } |
711 | else if ( serverName == LOCAL_IPKGS ) | 714 | else if ( serverName == LOCAL_IPKGS ) |
712 | { | 715 | { |
713 | downloadEnabled = FALSE; | 716 | downloadEnabled = FALSE; |
714 | actionUpgrade->setEnabled( FALSE ); | 717 | actionUpgrade->setEnabled( FALSE ); |
715 | } | 718 | } |
716 | else | 719 | else |
717 | { | 720 | { |
718 | downloadEnabled = TRUE; | 721 | downloadEnabled = TRUE; |
719 | actionUpgrade->setEnabled( TRUE ); | 722 | actionUpgrade->setEnabled( TRUE ); |
720 | } | 723 | } |
721 | enableDownload( downloadEnabled ); | 724 | enableDownload( downloadEnabled ); |
722 | 725 | ||
723 | // Display this widget once everything is done | 726 | // Display this widget once everything is done |
724 | if ( doProgress && raiseProgress ) | 727 | if ( doProgress && raiseProgress ) |
725 | { | 728 | { |
726 | stack->raiseWidget( networkPkgWindow ); | 729 | stack->raiseWidget( networkPkgWindow ); |
727 | } | 730 | } |
728 | } | 731 | } |
729 | 732 | ||
730 | void MainWindow :: searchForPackage( const QString &text ) | 733 | void MainWindow :: searchForPackage( const QString &text ) |
731 | { | 734 | { |
732 | if ( !text.isEmpty() ) | 735 | if ( !text.isEmpty() ) |
733 | { | 736 | { |
734 | // look through package list for text startng at current position | 737 | // look through package list for text startng at current position |
735 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 738 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
736 | 739 | ||
737 | if ( start == 0 ) | 740 | if ( start == 0 ) |
738 | start = (QCheckListItem *)packagesList->firstChild(); | 741 | start = (QCheckListItem *)packagesList->firstChild(); |
739 | 742 | ||
740 | for ( QCheckListItem *item = start; item != 0 ; | 743 | for ( QCheckListItem *item = start; item != 0 ; |
741 | item = (QCheckListItem *)item->nextSibling() ) | 744 | item = (QCheckListItem *)item->nextSibling() ) |
742 | { | 745 | { |
743 | if ( item->text().lower().find( text ) != -1 ) | 746 | if ( item->text().lower().find( text ) != -1 ) |
744 | { | 747 | { |
745 | packagesList->ensureItemVisible( item ); | 748 | packagesList->ensureItemVisible( item ); |
746 | packagesList->setCurrentItem( item ); | 749 | packagesList->setCurrentItem( item ); |
747 | break; | 750 | break; |
748 | } | 751 | } |
749 | } | 752 | } |
750 | } | 753 | } |
751 | } | 754 | } |
752 | 755 | ||
753 | void MainWindow :: updateServer() | 756 | void MainWindow :: updateServer() |
754 | { | 757 | { |
755 | QString serverName = serversList->currentText(); | 758 | QString serverName = serversList->currentText(); |
756 | 759 | ||
757 | // Update the current server | 760 | // Update the current server |
758 | // Display dialog | 761 | // Display dialog |
759 | 762 | ||
760 | // Disable buttons to stop silly people clicking lots on them :) | 763 | // Disable buttons to stop silly people clicking lots on them :) |
761 | 764 | ||
762 | // First, write out ipkg_conf file so that ipkg can use it | 765 | // First, write out ipkg_conf file so that ipkg can use it |
763 | mgr->writeOutIpkgConf(); | 766 | mgr->writeOutIpkgConf(); |
764 | 767 | ||
765 | Ipkg *ipkg = new Ipkg; | 768 | Ipkg *ipkg = new Ipkg; |
766 | ipkg->setOption( "update" ); | 769 | ipkg->setOption( "update" ); |
767 | 770 | ||
768 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), | 771 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), |
769 | tr( "Update lists" ) ); | 772 | tr( "Update lists" ) ); |
770 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 773 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
771 | reloadDocuments = FALSE; | 774 | reloadDocuments = FALSE; |
772 | stack->addWidget( dlg, 3 ); | 775 | stack->addWidget( dlg, 3 ); |
773 | stack->raiseWidget( dlg ); | 776 | stack->raiseWidget( dlg ); |
774 | 777 | ||
775 | // delete progDlg; | 778 | // delete progDlg; |
776 | } | 779 | } |
777 | 780 | ||
778 | void MainWindow :: upgradePackages() | 781 | void MainWindow :: upgradePackages() |
779 | { | 782 | { |
780 | // We're gonna do an upgrade of all packages | 783 | // We're gonna do an upgrade of all packages |
781 | // First warn user that this isn't recommended | 784 | // First warn user that this isn't recommended |
782 | // TODO - ODevice???? | 785 | // TODO - ODevice???? |
783 | QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); | 786 | QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); |
784 | QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, | 787 | QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, |
785 | QMessageBox::Yes, | 788 | QMessageBox::Yes, |
786 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , | 789 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , |
787 | 0, this ); | 790 | 0, this ); |
788 | warn.adjustSize(); | 791 | warn.adjustSize(); |
789 | 792 | ||
790 | if ( warn.exec() == QMessageBox::Yes ) | 793 | if ( warn.exec() == QMessageBox::Yes ) |
791 | { | 794 | { |
792 | // First, write out ipkg_conf file so that ipkg can use it | 795 | // First, write out ipkg_conf file so that ipkg can use it |
793 | mgr->writeOutIpkgConf(); | 796 | mgr->writeOutIpkgConf(); |
794 | 797 | ||
795 | // Now run upgrade | 798 | // Now run upgrade |
796 | Ipkg *ipkg = new Ipkg; | 799 | Ipkg *ipkg = new Ipkg; |
797 | ipkg->setOption( "upgrade" ); | 800 | ipkg->setOption( "upgrade" ); |
798 | 801 | ||
799 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), | 802 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), |
800 | tr ( "Upgrade" ) ); | 803 | tr ( "Upgrade" ) ); |
801 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 804 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
802 | reloadDocuments = TRUE; | 805 | reloadDocuments = TRUE; |
803 | stack->addWidget( dlg, 3 ); | 806 | stack->addWidget( dlg, 3 ); |
804 | stack->raiseWidget( dlg ); | 807 | stack->raiseWidget( dlg ); |
805 | } | 808 | } |
806 | } | 809 | } |
807 | 810 | ||
808 | void MainWindow :: downloadPackage() | 811 | void MainWindow :: downloadPackage() |
809 | { | 812 | { |
810 | bool doUpdate = true; | 813 | bool doUpdate = true; |
811 | if ( downloadEnabled ) | 814 | if ( downloadEnabled ) |
812 | { | 815 | { |
813 | // See if any packages are selected | 816 | // See if any packages are selected |
814 | bool found = false; | 817 | bool found = false; |
815 | if ( serversList->currentText() != LOCAL_SERVER ) | 818 | if ( serversList->currentText() != LOCAL_SERVER ) |
816 | { | 819 | { |
817 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 820 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
818 | item != 0 && !found; | 821 | item != 0 && !found; |
819 | item = (QCheckListItem *)item->nextSibling() ) | 822 | item = (QCheckListItem *)item->nextSibling() ) |
820 | { | 823 | { |
821 | if ( item->isOn() ) | 824 | if ( item->isOn() ) |
822 | found = true; | 825 | found = true; |
823 | } | 826 | } |
824 | } | 827 | } |
825 | 828 | ||
826 | // If user selected some packages then download the and store the locally | 829 | // If user selected some packages then download the and store the locally |
827 | // otherwise, display dialog asking user what package to download from an http server | 830 | // otherwise, display dialog asking user what package to download from an http server |
828 | // and whether to install it | 831 | // and whether to install it |
829 | if ( found ) | 832 | if ( found ) |
830 | downloadSelectedPackages(); | 833 | downloadSelectedPackages(); |
831 | else | 834 | else |
832 | downloadRemotePackage(); | 835 | downloadRemotePackage(); |
833 | 836 | ||
834 | } | 837 | } |
835 | else | 838 | else |
836 | { | 839 | { |
837 | doUpdate = false; | 840 | doUpdate = false; |
838 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 841 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
839 | item != 0 ; | 842 | item != 0 ; |
840 | item = (QCheckListItem *)item->nextSibling() ) | 843 | item = (QCheckListItem *)item->nextSibling() ) |
841 | { | 844 | { |
842 | if ( item->isOn() ) | 845 | if ( item->isOn() ) |
843 | { | 846 | { |
844 | QString name = item->text(); | 847 | QString name = item->text(); |
845 | int pos = name.find( "*" ); | 848 | int pos = name.find( "*" ); |
846 | name.truncate( pos ); | 849 | name.truncate( pos ); |
847 | 850 | ||
848 | // if (there is a (installed), remove it | 851 | // if (there is a (installed), remove it |
849 | pos = name.find( "(installed)" ); | 852 | pos = name.find( "(installed)" ); |
850 | if ( pos > 0 ) | 853 | if ( pos > 0 ) |
851 | name.truncate( pos - 1 ); | 854 | name.truncate( pos - 1 ); |
852 | 855 | ||
853 | Package *p = mgr->getServer( serversList->currentText() )->getPackage( name ); | 856 | Package *p = mgr->getServer( serversList->currentText() )->getPackage( name ); |
854 | 857 | ||
855 | QString msgtext; | 858 | QString msgtext; |
856 | msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() ); | 859 | msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() ); |
857 | if ( QMessageBox::information( this, tr( "Are you sure?" ), | 860 | if ( QMessageBox::information( this, tr( "Are you sure?" ), |
858 | msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) | 861 | msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) |
859 | { | 862 | { |
860 | doUpdate = true; | 863 | doUpdate = true; |
861 | QFile f( p->getFilename() ); | 864 | QFile f( p->getFilename() ); |
862 | f.remove(); | 865 | f.remove(); |
863 | } | 866 | } |
864 | } | 867 | } |
865 | } | 868 | } |
866 | } | 869 | } |
867 | 870 | ||
868 | if ( doUpdate ) | 871 | if ( doUpdate ) |
869 | { | 872 | { |
870 | reloadData( 0x0 ); | 873 | reloadData( 0x0 ); |
871 | } | 874 | } |
872 | } | 875 | } |
873 | 876 | ||
874 | void MainWindow :: downloadSelectedPackages() | 877 | void MainWindow :: downloadSelectedPackages() |
875 | { | 878 | { |
876 | // First, write out ipkg_conf file so that ipkg can use it | 879 | // First, write out ipkg_conf file so that ipkg can use it |
877 | mgr->writeOutIpkgConf(); | 880 | mgr->writeOutIpkgConf(); |
878 | 881 | ||
879 | // Display dialog to user asking where to download the files to | 882 | // Display dialog to user asking where to download the files to |
880 | bool ok = FALSE; | 883 | bool ok = FALSE; |
881 | QString dir = ""; | 884 | QString dir = ""; |
882 | #ifdef QWS | 885 | #ifdef QWS |
883 | // read download directory from config file | 886 | // read download directory from config file |
884 | Config cfg( "aqpkg" ); | 887 | Config cfg( "aqpkg" ); |
885 | cfg.setGroup( "settings" ); | 888 | cfg.setGroup( "settings" ); |
886 | dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); | 889 | dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); |
887 | #endif | 890 | #endif |
888 | 891 | ||
889 | QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); | 892 | QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); |
890 | if ( ok && !text.isEmpty() ) | 893 | if ( ok && !text.isEmpty() ) |
891 | dir = text; // user entered something and pressed ok | 894 | dir = text; // user entered something and pressed ok |
892 | else | 895 | else |
893 | return; // user entered nothing or pressed cancel | 896 | return; // user entered nothing or pressed cancel |
894 | 897 | ||
895 | #ifdef QWS | 898 | #ifdef QWS |
896 | // Store download directory in config file | 899 | // Store download directory in config file |
897 | cfg.writeEntry( "downloadDir", dir ); | 900 | cfg.writeEntry( "downloadDir", dir ); |
898 | #endif | 901 | #endif |
899 | 902 | ||
900 | // Get starting directory | 903 | // Get starting directory |
901 | char initDir[PATH_MAX]; | 904 | char initDir[PATH_MAX]; |
902 | getcwd( initDir, PATH_MAX ); | 905 | getcwd( initDir, PATH_MAX ); |
903 | 906 | ||
904 | // Download each package | 907 | // Download each package |
905 | Ipkg ipkg; | 908 | Ipkg ipkg; |
906 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 909 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
907 | 910 | ||
908 | ipkg.setOption( "download" ); | 911 | ipkg.setOption( "download" ); |
909 | ipkg.setRuntimeDirectory( dir ); | 912 | ipkg.setRuntimeDirectory( dir ); |
910 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 913 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
911 | item != 0 ; | 914 | item != 0 ; |
912 | item = (QCheckListItem *)item->nextSibling() ) | 915 | item = (QCheckListItem *)item->nextSibling() ) |
913 | { | 916 | { |
914 | if ( item->isOn() ) | 917 | if ( item->isOn() ) |
915 | { | 918 | { |
916 | ipkg.setPackage( item->text() ); | 919 | ipkg.setPackage( item->text() ); |
917 | ipkg.runIpkg( ); | 920 | ipkg.runIpkg( ); |
918 | } | 921 | } |
919 | } | 922 | } |
920 | } | 923 | } |
921 | 924 | ||
922 | void MainWindow :: downloadRemotePackage() | 925 | void MainWindow :: downloadRemotePackage() |
923 | { | 926 | { |
924 | // Display dialog | 927 | // Display dialog |
925 | bool ok; | 928 | bool ok; |
926 | QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); | 929 | QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); |
927 | if ( !ok || package.isEmpty() ) | 930 | if ( !ok || package.isEmpty() ) |
928 | return; | 931 | return; |
929 | // DownloadRemoteDlgImpl dlg( this, "Install", true ); | 932 | // DownloadRemoteDlgImpl dlg( this, "Install", true ); |
930 | // if ( dlg.exec() == QDialog::Rejected ) | 933 | // if ( dlg.exec() == QDialog::Rejected ) |
931 | // return; | 934 | // return; |
932 | 935 | ||
933 | // grab details from dialog | 936 | // grab details from dialog |
934 | // QString package = dlg.getPackageLocation(); | 937 | // QString package = dlg.getPackageLocation(); |
935 | 938 | ||
936 | InstallData *item = new InstallData(); | 939 | InstallData *item = new InstallData(); |
937 | item->option = "I"; | 940 | item->option = "I"; |
938 | item->packageName = package; | 941 | item->packageName = package; |
939 | QList<InstallData> workingPackages; | 942 | QList<InstallData> workingPackages; |
940 | workingPackages.setAutoDelete( TRUE ); | 943 | workingPackages.setAutoDelete( TRUE ); |
941 | workingPackages.append( item ); | 944 | workingPackages.append( item ); |
942 | 945 | ||
943 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); | 946 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); |
944 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 947 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
945 | reloadDocuments = TRUE; | 948 | reloadDocuments = TRUE; |
946 | stack->addWidget( dlg, 3 ); | 949 | stack->addWidget( dlg, 3 ); |
947 | stack->raiseWidget( dlg ); | 950 | stack->raiseWidget( dlg ); |
948 | } | 951 | } |
949 | 952 | ||
950 | 953 | ||
951 | void MainWindow :: applyChanges() | 954 | void MainWindow :: applyChanges() |
952 | { | 955 | { |
953 | stickyOption = ""; | 956 | stickyOption = ""; |
954 | 957 | ||
955 | // First, write out ipkg_conf file so that ipkg can use it | 958 | // First, write out ipkg_conf file so that ipkg can use it |
956 | mgr->writeOutIpkgConf(); | 959 | mgr->writeOutIpkgConf(); |
957 | 960 | ||
958 | // Now for each selected item | 961 | // Now for each selected item |
959 | // deal with it | 962 | // deal with it |
960 | 963 | ||
961 | QList<InstallData> workingPackages; | 964 | QList<InstallData> workingPackages; |
962 | workingPackages.setAutoDelete( TRUE ); | 965 | workingPackages.setAutoDelete( TRUE ); |
963 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 966 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
964 | item != 0 ; | 967 | item != 0 ; |
965 | item = (QCheckListItem *)item->nextSibling() ) | 968 | item = (QCheckListItem *)item->nextSibling() ) |
966 | { | 969 | { |
967 | if ( item->isOn() ) | 970 | if ( item->isOn() ) |
968 | { | 971 | { |
969 | InstallData *instdata = dealWithItem( item ); | 972 | InstallData *instdata = dealWithItem( item ); |
970 | if ( instdata ) | 973 | if ( instdata ) |
971 | workingPackages.append( instdata ); | 974 | workingPackages.append( instdata ); |
972 | else | 975 | else |
973 | return; | 976 | return; |
974 | } | 977 | } |
975 | } | 978 | } |
976 | 979 | ||
977 | if ( workingPackages.count() == 0 ) | 980 | if ( workingPackages.count() == 0 ) |
978 | { | 981 | { |
979 | // Nothing to do | 982 | // Nothing to do |
980 | QMessageBox::information( this, tr( "Nothing to do" ), | 983 | QMessageBox::information( this, tr( "Nothing to do" ), |
981 | tr( "No packages selected" ), tr( "OK" ) ); | 984 | tr( "No packages selected" ), tr( "OK" ) ); |
982 | 985 | ||
983 | return; | 986 | return; |
984 | } | 987 | } |
985 | 988 | ||
986 | // do the stuff | 989 | // do the stuff |
987 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); | 990 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); |
988 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | 991 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
989 | reloadDocuments = TRUE; | 992 | reloadDocuments = TRUE; |
990 | stack->addWidget( dlg, 3 ); | 993 | stack->addWidget( dlg, 3 ); |
991 | stack->raiseWidget( dlg ); | 994 | stack->raiseWidget( dlg ); |
992 | } | 995 | } |
993 | 996 | ||
994 | // decide what to do - either remove, upgrade or install | 997 | // decide what to do - either remove, upgrade or install |
995 | // Current rules: | 998 | // Current rules: |
996 | // If not installed - install | 999 | // If not installed - install |
997 | // If installed and different version available - upgrade | 1000 | // If installed and different version available - upgrade |
998 | // If installed and version up to date - remove | 1001 | // If installed and version up to date - remove |
999 | InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) | 1002 | InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) |
1000 | { | 1003 | { |
1001 | QString name = item->text(); | 1004 | QString name = item->text(); |
1002 | 1005 | ||
1003 | // Get package | 1006 | // Get package |
1004 | Server *s = mgr->getServer( serversList->currentText() ); | 1007 | Server *s = mgr->getServer( serversList->currentText() ); |
1005 | Package *p = s->getPackage( name ); | 1008 | Package *p = s->getPackage( name ); |
1006 | 1009 | ||
1007 | // If the package has a filename then it is a local file | 1010 | // If the package has a filename then it is a local file |
1008 | if ( p->isPackageStoredLocally() ) | 1011 | if ( p->isPackageStoredLocally() ) |
1009 | name = p->getFilename(); | 1012 | name = p->getFilename(); |
1010 | 1013 | ||
1011 | QString option; | 1014 | QString option; |
1012 | QString dest = "root"; | 1015 | QString dest = "root"; |
1013 | if ( !p->isInstalled() ) | 1016 | if ( !p->isInstalled() ) |
1014 | { | 1017 | { |
1015 | InstallData *newitem = new InstallData(); | 1018 | InstallData *newitem = new InstallData(); |
1016 | newitem->option = "I"; | 1019 | newitem->option = "I"; |
1017 | newitem->packageName = name; | 1020 | newitem->packageName = name; |
1018 | return newitem; | 1021 | return newitem; |
1019 | } | 1022 | } |
1020 | else | 1023 | else |
1021 | { | 1024 | { |
1022 | InstallData *newitem = new InstallData(); | 1025 | InstallData *newitem = new InstallData(); |
1023 | newitem->option = "D"; | 1026 | newitem->option = "D"; |
1024 | // If local file, remove using package name, not filename | 1027 | // If local file, remove using package name, not filename |
1025 | if ( p->isPackageStoredLocally() ) | 1028 | if ( p->isPackageStoredLocally() ) |
1026 | name = item->text(); | 1029 | name = item->text(); |
1027 | 1030 | ||
1028 | if ( !p->isPackageStoredLocally() ) | 1031 | if ( !p->isPackageStoredLocally() ) |
1029 | newitem->packageName = p->getInstalledPackageName(); | 1032 | newitem->packageName = p->getInstalledPackageName(); |
1030 | else | 1033 | else |
1031 | newitem->packageName = name; | 1034 | newitem->packageName = name; |
1032 | 1035 | ||
1033 | if ( p->getInstalledTo() ) | 1036 | if ( p->getInstalledTo() ) |
1034 | { | 1037 | { |
1035 | newitem->destination = p->getInstalledTo(); | 1038 | newitem->destination = p->getInstalledTo(); |
1036 | } | 1039 | } |
1037 | else | 1040 | else |
1038 | { | 1041 | { |
1039 | newitem->destination = p->getLocalPackage()->getInstalledTo(); | 1042 | newitem->destination = p->getLocalPackage()->getInstalledTo(); |
1040 | } | 1043 | } |
1041 | 1044 | ||
1042 | // Now see if version is newer or not | 1045 | // Now see if version is newer or not |
1043 | int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); | 1046 | int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); |
1044 | 1047 | ||
1045 | // If the version requested is older and user selected a local ipk file, then reinstall the file | 1048 | // If the version requested is older and user selected a local ipk file, then reinstall the file |
1046 | if ( p->isPackageStoredLocally() && val == -1 ) | 1049 | if ( p->isPackageStoredLocally() && val == -1 ) |
1047 | val = 0; | 1050 | val = 0; |
1048 | 1051 | ||
1049 | if ( val == -2 ) | 1052 | if ( val == -2 ) |
1050 | { | 1053 | { |
1051 | // Error - should handle | 1054 | // Error - should handle |
1052 | } | 1055 | } |
1053 | else if ( val == -1 ) | 1056 | else if ( val == -1 ) |
1054 | { | 1057 | { |
1055 | // Version available is older - remove only | 1058 | // Version available is older - remove only |
1056 | newitem->option = "D"; | 1059 | newitem->option = "D"; |
1057 | // If local file, remove using package name, not filename | 1060 | // If local file, remove using package name, not filename |
1058 | if ( p->isPackageStoredLocally() ) | 1061 | if ( p->isPackageStoredLocally() ) |
1059 | name = item->text(); | 1062 | name = item->text(); |
1060 | } | 1063 | } |
1061 | else | 1064 | else |
1062 | { | 1065 | { |
1063 | QString caption; | 1066 | QString caption; |
1064 | QString text; | 1067 | QString text; |
1065 | QString secondButton; | 1068 | QString secondButton; |
1066 | QString secondOption; | 1069 | QString secondOption; |
1067 | if ( val == 0 ) | 1070 | if ( val == 0 ) |
1068 | { | 1071 | { |
1069 | // Version available is the same - option to remove or reinstall | 1072 | // Version available is the same - option to remove or reinstall |
1070 | caption = tr( "Do you wish to remove or reinstall\n%1?" ); | 1073 | caption = tr( "Do you wish to remove or reinstall\n%1?" ); |
1071 | text = tr( "Remove or ReInstall" ); | 1074 | text = tr( "Remove or ReInstall" ); |
1072 | secondButton = tr( "ReInstall" ); | 1075 | secondButton = tr( "ReInstall" ); |
1073 | secondOption = "R"; // Internal action code, do not translate | 1076 | secondOption = "R"; // Internal action code, do not translate |
1074 | } | 1077 | } |
1075 | else if ( val == 1 ) | 1078 | else if ( val == 1 ) |
1076 | { | 1079 | { |
1077 | // Version available is newer - option to remove or upgrade | 1080 | // Version available is newer - option to remove or upgrade |
1078 | caption = tr( "Do you wish to remove or upgrade\n%1?" ); | 1081 | caption = tr( "Do you wish to remove or upgrade\n%1?" ); |
1079 | text = tr( "Remove or Upgrade" ); | 1082 | text = tr( "Remove or Upgrade" ); |
1080 | secondButton = tr( "Upgrade" ); | 1083 | secondButton = tr( "Upgrade" ); |
1081 | secondOption = "U"; // Internal action code, do not translate | 1084 | secondOption = "U"; // Internal action code, do not translate |
1082 | } | 1085 | } |
1083 | 1086 | ||
1084 | // Sticky option not implemented yet, but will eventually allow | 1087 | // Sticky option not implemented yet, but will eventually allow |
1085 | // the user to say something like 'remove all' | 1088 | // the user to say something like 'remove all' |
1086 | if ( stickyOption == "" ) | 1089 | if ( stickyOption == "" ) |
1087 | { | 1090 | { |
1088 | QString msgtext; | 1091 | QString msgtext; |
1089 | msgtext = caption.arg( ( const char * )name ); | 1092 | msgtext = caption.arg( ( const char * )name ); |
1090 | QuestionDlg dlg( text, msgtext, secondButton ); | 1093 | QuestionDlg dlg( text, msgtext, secondButton ); |
1091 | switch( dlg.exec() ) | 1094 | switch( dlg.exec() ) |
1092 | { | 1095 | { |
1093 | case 0: // Cancel | 1096 | case 0: // Cancel |
1094 | delete newitem; | 1097 | delete newitem; |
1095 | return 0x0; | 1098 | return 0x0; |
1096 | break; | 1099 | break; |
1097 | case 1: // Remove | 1100 | case 1: // Remove |
1098 | newitem->option = "D"; | 1101 | newitem->option = "D"; |
1099 | // If local file, remove using package name, not filename | 1102 | // If local file, remove using package name, not filename |
1100 | if ( p->isPackageStoredLocally() ) | 1103 | if ( p->isPackageStoredLocally() ) |
1101 | name = item->text(); | 1104 | name = item->text(); |
1102 | break; | 1105 | break; |
1103 | case 2: // Reinstall or Upgrade | 1106 | case 2: // Reinstall or Upgrade |
1104 | newitem->option = secondOption; | 1107 | newitem->option = secondOption; |
1105 | break; | 1108 | break; |
1106 | } | 1109 | } |
1107 | } | 1110 | } |
1108 | else | 1111 | else |
1109 | { | 1112 | { |
1110 | // newitem->option = stickyOption; | 1113 | // newitem->option = stickyOption; |
1111 | } | 1114 | } |
1112 | } | 1115 | } |
1113 | 1116 | ||
1114 | 1117 | ||
1115 | // Check if we are reinstalling the same version | 1118 | // Check if we are reinstalling the same version |
1116 | if ( newitem->option != "R" ) | 1119 | if ( newitem->option != "R" ) |
1117 | newitem->recreateLinks = true; | 1120 | newitem->recreateLinks = true; |
1118 | else | 1121 | else |
1119 | newitem->recreateLinks = false; | 1122 | newitem->recreateLinks = false; |
1120 | 1123 | ||
1121 | // User hit cancel (on dlg - assume remove) | 1124 | // User hit cancel (on dlg - assume remove) |
1122 | return newitem; | 1125 | return newitem; |
1123 | } | 1126 | } |
1124 | } | 1127 | } |
1125 | 1128 | ||
1126 | void MainWindow :: reloadData( InstallDlgImpl *dlg ) | 1129 | void MainWindow :: reloadData( InstallDlgImpl *dlg ) |
1127 | { | 1130 | { |
1128 | stack->raiseWidget( progressWindow ); | 1131 | stack->raiseWidget( progressWindow ); |
1129 | 1132 | ||
1130 | if ( dlg ) | 1133 | if ( dlg ) |
1131 | { | 1134 | { |
1132 | dlg->close(); | 1135 | dlg->close(); |
1133 | delete dlg; | 1136 | delete dlg; |
1134 | } | 1137 | } |
1135 | 1138 | ||
1136 | mgr->reloadServerData(); | 1139 | mgr->reloadServerData(); |
1137 | serverSelected( -1, FALSE ); | 1140 | serverSelected( -1, FALSE ); |
1138 | 1141 | ||
1139 | #ifdef QWS | 1142 | #ifdef QWS |
1140 | if ( reloadDocuments ) | 1143 | if ( reloadDocuments ) |
1141 | { | 1144 | { |
1142 | m_status->setText( tr( "Updating Launcher..." ) ); | 1145 | m_status->setText( tr( "Updating Launcher..." ) ); |
1143 | 1146 | ||
1144 | // Finally let the main system update itself | 1147 | // Finally let the main system update itself |
1145 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 1148 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
1146 | QString lf = QString::null; | 1149 | QString lf = QString::null; |
1147 | e << lf; | 1150 | e << lf; |
1148 | } | 1151 | } |
1149 | #endif | 1152 | #endif |
1150 | 1153 | ||
1151 | stack->raiseWidget( networkPkgWindow ); | 1154 | stack->raiseWidget( networkPkgWindow ); |
1152 | } | 1155 | } |
1153 | 1156 | ||
1154 | void MainWindow :: letterPushed( QString t ) | 1157 | void MainWindow :: letterPushed( QString t ) |
1155 | { | 1158 | { |
1156 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); | 1159 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); |
1157 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 1160 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
1158 | if ( packagesList->firstChild() == 0 ) | 1161 | if ( packagesList->firstChild() == 0 ) |
1159 | return; | 1162 | return; |
1160 | 1163 | ||
1161 | QCheckListItem *item; | 1164 | QCheckListItem *item; |
1162 | if ( start == 0 ) | 1165 | if ( start == 0 ) |
1163 | { | 1166 | { |
1164 | item = (QCheckListItem *)packagesList->firstChild(); | 1167 | item = (QCheckListItem *)packagesList->firstChild(); |
1165 | start = top; | 1168 | start = top; |
1166 | } | 1169 | } |
1167 | else | 1170 | else |
1168 | item = (QCheckListItem *)start->nextSibling(); | 1171 | item = (QCheckListItem *)start->nextSibling(); |
1169 | 1172 | ||
1170 | if ( item == 0 ) | 1173 | if ( item == 0 ) |
1171 | item = (QCheckListItem *)packagesList->firstChild(); | 1174 | item = (QCheckListItem *)packagesList->firstChild(); |
1172 | do | 1175 | do |
1173 | { | 1176 | { |
1174 | if ( item->text().lower().startsWith( t.lower() ) ) | 1177 | if ( item->text().lower().startsWith( t.lower() ) ) |
1175 | { | 1178 | { |
1176 | packagesList->setSelected( item, true ); | 1179 | packagesList->setSelected( item, true ); |
1177 | packagesList->ensureItemVisible( item ); | 1180 | packagesList->ensureItemVisible( item ); |
1178 | break; | 1181 | break; |
1179 | } | 1182 | } |
1180 | 1183 | ||
1181 | item = (QCheckListItem *)item->nextSibling(); | 1184 | item = (QCheckListItem *)item->nextSibling(); |
1182 | if ( !item ) | 1185 | if ( !item ) |
1183 | item = (QCheckListItem *)packagesList->firstChild(); | 1186 | item = (QCheckListItem *)packagesList->firstChild(); |
1184 | } while ( item != start); | 1187 | } |
1188 | while ( item != start); | ||
1185 | } | 1189 | } |
1186 | 1190 | ||
1187 | void MainWindow :: slotDisplayPackage( QListViewItem *item ) | 1191 | void MainWindow :: slotDisplayPackage( QListViewItem *item ) |
1188 | { | 1192 | { |
1189 | QString itemstr( ((QCheckListItem*)item)->text() ); | 1193 | QString itemstr( ((QCheckListItem*)item)->text() ); |
1190 | PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); | 1194 | PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); |
1191 | p->showMaximized(); | 1195 | QPEApplication::showWidget( p ); |
1192 | } | 1196 | } |
1193 | 1197 | ||
1194 | QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn ) | 1198 | QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn ) |
1195 | : QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog ) | 1199 | : QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog ) |
1196 | { | 1200 | { |
1197 | setCaption( caption ); | 1201 | setCaption( caption ); |
1198 | resize( 175, 100 ); | 1202 | resize( 175, 100 ); |
1199 | 1203 | ||
1200 | QGridLayout *layout = new QGridLayout( this ); | 1204 | QGridLayout *layout = new QGridLayout( this ); |
1201 | 1205 | ||
1202 | QLabel *l = new QLabel( text, this ); | 1206 | QLabel *l = new QLabel( text, this ); |
1203 | l->setAlignment( AlignCenter | WordBreak ); | 1207 | l->setAlignment( AlignCenter | WordBreak ); |
1204 | layout->addMultiCellWidget( l, 0, 0, 0, 1 ); | 1208 | layout->addMultiCellWidget( l, 0, 0, 0, 1 ); |
1205 | 1209 | ||
1206 | btn1 = new QPushButton( tr( "Remove" ), this ); | 1210 | btn1 = new QPushButton( tr( "Remove" ), this ); |
1207 | connect( btn1, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) ); | 1211 | connect( btn1, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) ); |
1208 | layout->addWidget( btn1, 1, 0 ); | 1212 | layout->addWidget( btn1, 1, 0 ); |
1209 | 1213 | ||
1210 | btn2 = new QPushButton( secondbtn, this ); | 1214 | btn2 = new QPushButton( secondbtn, this ); |
1211 | connect( btn2, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) ); | 1215 | connect( btn2, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) ); |
1212 | layout->addWidget( btn2, 1, 1 ); | 1216 | layout->addWidget( btn2, 1, 1 ); |
1213 | 1217 | ||
1214 | executing = FALSE; | 1218 | executing = FALSE; |
1215 | } | 1219 | } |
1216 | 1220 | ||
1217 | int QuestionDlg::exec() | 1221 | int QuestionDlg::exec() |
1218 | { | 1222 | { |
1219 | show(); | 1223 | show(); |
1220 | 1224 | ||
1221 | if ( !executing ) | 1225 | if ( !executing ) |
1222 | { | 1226 | { |
1223 | executing = TRUE; | 1227 | executing = TRUE; |
1224 | qApp->enter_loop(); | 1228 | qApp->enter_loop(); |
1225 | } | 1229 | } |
1226 | 1230 | ||
1227 | return buttonpressed; | 1231 | return buttonpressed; |
1228 | } | 1232 | } |
1229 | 1233 | ||
1230 | void QuestionDlg::slotButtonPressed() | 1234 | void QuestionDlg::slotButtonPressed() |
1231 | { | 1235 | { |
1232 | if ( sender() == btn1 ) | 1236 | if ( sender() == btn1 ) |
1233 | buttonpressed = 1; | 1237 | buttonpressed = 1; |
1234 | else if ( sender() == btn2 ) | 1238 | else if ( sender() == btn2 ) |
1235 | buttonpressed = 2; | 1239 | buttonpressed = 2; |
1236 | else | 1240 | else |
1237 | buttonpressed = 0; | 1241 | buttonpressed = 0; |
1238 | 1242 | ||
1239 | qApp->exit_loop(); | 1243 | qApp->exit_loop(); |
1240 | } | 1244 | } |
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 4887ceb..9fdf31e 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp | |||
@@ -1,493 +1,494 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <fstream> | 30 | #include "settingsimpl.h" |
31 | #include <algorithm> | 31 | #include "global.h" |
32 | using namespace std; | ||
33 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <opie/otabwidget.h> | ||
35 | #ifdef QWS | ||
36 | #include <qpe/config.h> | ||
37 | #include <qpe/resource.h> | ||
38 | #endif | ||
39 | #include <qpe/qpeapplication.h> | ||
40 | |||
41 | /* QT */ | ||
34 | #include <qcheckbox.h> | 42 | #include <qcheckbox.h> |
35 | #include <qgroupbox.h> | 43 | #include <qgroupbox.h> |
36 | #include <qlabel.h> | 44 | #include <qlabel.h> |
37 | #include <qlayout.h> | 45 | #include <qlayout.h> |
38 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
39 | #include <qlistbox.h> | 47 | #include <qlistbox.h> |
40 | #include <qpushbutton.h> | 48 | #include <qpushbutton.h> |
41 | 49 | ||
42 | #include <opie/otabwidget.h> | 50 | /* STD */ |
43 | 51 | #include <fstream> | |
44 | #ifdef QWS | 52 | #include <algorithm> |
45 | #include <qpe/config.h> | 53 | using namespace std; |
46 | #include <qpe/resource.h> | ||
47 | #endif | ||
48 | |||
49 | #include "settingsimpl.h" | ||
50 | |||
51 | #include "global.h" | ||
52 | 54 | ||
53 | SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) | 55 | SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) |
54 | : QDialog( parent, name, modal, fl ) | 56 | : QDialog( parent, name, modal, fl ) |
55 | { | 57 | { |
56 | setCaption( tr( "Configuration" ) ); | 58 | setCaption( tr( "Configuration" ) ); |
57 | 59 | ||
58 | // Setup layout to make everything pretty | 60 | // Setup layout to make everything pretty |
59 | QVBoxLayout *layout = new QVBoxLayout( this ); | 61 | QVBoxLayout *layout = new QVBoxLayout( this ); |
60 | layout->setMargin( 2 ); | 62 | layout->setMargin( 2 ); |
61 | layout->setSpacing( 4 ); | 63 | layout->setSpacing( 4 ); |
62 | 64 | ||
63 | // Setup tabs for all info | 65 | // Setup tabs for all info |
64 | OTabWidget *tabwidget = new OTabWidget( this ); | 66 | OTabWidget *tabwidget = new OTabWidget( this ); |
65 | layout->addWidget( tabwidget ); | 67 | layout->addWidget( tabwidget ); |
66 | 68 | ||
67 | tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); | 69 | tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); |
68 | tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); | 70 | tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); |
69 | tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); | 71 | tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); |
70 | tabwidget->setCurrentTab( tr( "Servers" ) ); | 72 | tabwidget->setCurrentTab( tr( "Servers" ) ); |
71 | 73 | ||
72 | dataMgr = dataManager; | 74 | dataMgr = dataManager; |
73 | setupData(); | 75 | setupData(); |
74 | changed = false; | 76 | changed = false; |
75 | newserver = false; | 77 | newserver = false; |
76 | newdestination = false; | 78 | newdestination = false; |
77 | } | 79 | } |
78 | 80 | ||
79 | SettingsImpl :: ~SettingsImpl() | 81 | SettingsImpl :: ~SettingsImpl() |
80 | { | 82 | { |
81 | |||
82 | } | 83 | } |
83 | 84 | ||
84 | bool SettingsImpl :: showDlg() | 85 | bool SettingsImpl :: showDlg() |
85 | { | 86 | { |
86 | showMaximized(); | 87 | QPEApplication::execDialog( this ); |
87 | exec(); | 88 | if ( changed ) |
88 | 89 | dataMgr->writeOutIpkgConf(); | |
89 | if ( changed ) | ||
90 | dataMgr->writeOutIpkgConf(); | ||
91 | 90 | ||
92 | return changed; | 91 | return changed; |
93 | } | 92 | } |
94 | 93 | ||
95 | QWidget *SettingsImpl :: initServerTab() | 94 | QWidget *SettingsImpl :: initServerTab() |
96 | { | 95 | { |
97 | QWidget *control = new QWidget( this ); | 96 | QWidget *control = new QWidget( this ); |
98 | 97 | ||
99 | QVBoxLayout *vb = new QVBoxLayout( control ); | 98 | QVBoxLayout *vb = new QVBoxLayout( control ); |
100 | 99 | ||
101 | QScrollView *sv = new QScrollView( control ); | 100 | QScrollView *sv = new QScrollView( control ); |
102 | vb->addWidget( sv, 0, 0 ); | 101 | vb->addWidget( sv, 0, 0 ); |
103 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 102 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
104 | sv->setFrameStyle( QFrame::NoFrame ); | 103 | sv->setFrameStyle( QFrame::NoFrame ); |
105 | 104 | ||
106 | QWidget *container = new QWidget( sv->viewport() ); | 105 | QWidget *container = new QWidget( sv->viewport() ); |
107 | sv->addChild( container ); | 106 | sv->addChild( container ); |
108 | 107 | ||
109 | QGridLayout *layout = new QGridLayout( container ); | 108 | QGridLayout *layout = new QGridLayout( container ); |
110 | layout->setSpacing( 2 ); | 109 | layout->setSpacing( 2 ); |
111 | layout->setMargin( 4 ); | 110 | layout->setMargin( 4 ); |
112 | 111 | ||
113 | servers = new QListBox( container ); | 112 | servers = new QListBox( container ); |
114 | servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 113 | servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
115 | connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); | 114 | connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); |
116 | layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); | 115 | layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); |
117 | 116 | ||
118 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 117 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
119 | connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); | 118 | connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); |
120 | layout->addWidget( btn, 1, 0 ); | 119 | layout->addWidget( btn, 1, 0 ); |
121 | 120 | ||
122 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 121 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
123 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); | 122 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); |
124 | layout->addWidget( btn, 1, 1 ); | 123 | layout->addWidget( btn, 1, 1 ); |
125 | 124 | ||
126 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); | 125 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); |
127 | grpbox->layout()->setSpacing( 2 ); | 126 | grpbox->layout()->setSpacing( 2 ); |
128 | grpbox->layout()->setMargin( 4 ); | 127 | grpbox->layout()->setMargin( 4 ); |
129 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 128 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); |
130 | 129 | ||
131 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 130 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); |
132 | 131 | ||
133 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | 132 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); |
134 | grplayout->addWidget( label, 0, 0 ); | 133 | grplayout->addWidget( label, 0, 0 ); |
135 | servername = new QLineEdit( grpbox ); | 134 | servername = new QLineEdit( grpbox ); |
136 | grplayout->addWidget( servername, 0, 1 ); | 135 | grplayout->addWidget( servername, 0, 1 ); |
137 | 136 | ||
138 | label = new QLabel( tr( "Address:" ), grpbox ); | 137 | label = new QLabel( tr( "Address:" ), grpbox ); |
139 | grplayout->addWidget( label, 1, 0 ); | 138 | grplayout->addWidget( label, 1, 0 ); |
140 | serverurl = new QLineEdit( grpbox ); | 139 | serverurl = new QLineEdit( grpbox ); |
141 | grplayout->addWidget( serverurl, 1, 1 ); | 140 | grplayout->addWidget( serverurl, 1, 1 ); |
142 | 141 | ||
143 | active = new QCheckBox( tr( "Active Server" ), grpbox ); | 142 | active = new QCheckBox( tr( "Active Server" ), grpbox ); |
144 | grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); | 143 | grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); |
145 | 144 | ||
146 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | 145 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); |
147 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); | 146 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); |
148 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | 147 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); |
149 | 148 | ||
150 | return control; | 149 | return control; |
151 | } | 150 | } |
152 | 151 | ||
153 | QWidget *SettingsImpl :: initDestinationTab() | 152 | QWidget *SettingsImpl :: initDestinationTab() |
154 | { | 153 | { |
155 | QWidget *control = new QWidget( this ); | 154 | QWidget *control = new QWidget( this ); |
156 | 155 | ||
157 | QVBoxLayout *vb = new QVBoxLayout( control ); | 156 | QVBoxLayout *vb = new QVBoxLayout( control ); |
158 | 157 | ||
159 | QScrollView *sv = new QScrollView( control ); | 158 | QScrollView *sv = new QScrollView( control ); |
160 | vb->addWidget( sv, 0, 0 ); | 159 | vb->addWidget( sv, 0, 0 ); |
161 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 160 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
162 | sv->setFrameStyle( QFrame::NoFrame ); | 161 | sv->setFrameStyle( QFrame::NoFrame ); |
163 | 162 | ||
164 | QWidget *container = new QWidget( sv->viewport() ); | 163 | QWidget *container = new QWidget( sv->viewport() ); |
165 | sv->addChild( container ); | 164 | sv->addChild( container ); |
166 | 165 | ||
167 | QGridLayout *layout = new QGridLayout( container ); | 166 | QGridLayout *layout = new QGridLayout( container ); |
168 | layout->setSpacing( 2 ); | 167 | layout->setSpacing( 2 ); |
169 | layout->setMargin( 4 ); | 168 | layout->setMargin( 4 ); |
170 | 169 | ||
171 | destinations = new QListBox( container ); | 170 | destinations = new QListBox( container ); |
172 | destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 171 | destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
173 | connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) ); | 172 | connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) ); |
174 | layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); | 173 | layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); |
175 | 174 | ||
176 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 175 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
177 | connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); | 176 | connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); |
178 | layout->addWidget( btn, 1, 0 ); | 177 | layout->addWidget( btn, 1, 0 ); |
179 | 178 | ||
180 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 179 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
181 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); | 180 | connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); |
182 | layout->addWidget( btn, 1, 1 ); | 181 | layout->addWidget( btn, 1, 1 ); |
183 | 182 | ||
184 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); | 183 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); |
185 | grpbox->layout()->setSpacing( 2 ); | 184 | grpbox->layout()->setSpacing( 2 ); |
186 | grpbox->layout()->setMargin( 4 ); | 185 | grpbox->layout()->setMargin( 4 ); |
187 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 186 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); |
188 | 187 | ||
189 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 188 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); |
190 | 189 | ||
191 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | 190 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); |
192 | grplayout->addWidget( label, 0, 0 ); | 191 | grplayout->addWidget( label, 0, 0 ); |
193 | destinationname = new QLineEdit( grpbox ); | 192 | destinationname = new QLineEdit( grpbox ); |
194 | grplayout->addWidget( destinationname, 0, 1 ); | 193 | grplayout->addWidget( destinationname, 0, 1 ); |
195 | 194 | ||
196 | label = new QLabel( tr( "Location:" ), grpbox ); | 195 | label = new QLabel( tr( "Location:" ), grpbox ); |
197 | grplayout->addWidget( label, 1, 0 ); | 196 | grplayout->addWidget( label, 1, 0 ); |
198 | destinationurl = new QLineEdit( grpbox ); | 197 | destinationurl = new QLineEdit( grpbox ); |
199 | grplayout->addWidget( destinationurl, 1, 1 ); | 198 | grplayout->addWidget( destinationurl, 1, 1 ); |
200 | 199 | ||
201 | linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); | 200 | linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); |
202 | grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); | 201 | grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); |
203 | 202 | ||
204 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | 203 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); |
205 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); | 204 | connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); |
206 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | 205 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); |
207 | 206 | ||
208 | return control; | 207 | return control; |
209 | } | 208 | } |
210 | 209 | ||
211 | QWidget *SettingsImpl :: initProxyTab() | 210 | QWidget *SettingsImpl :: initProxyTab() |
212 | { | 211 | { |
213 | QWidget *control = new QWidget( this ); | 212 | QWidget *control = new QWidget( this ); |
214 | 213 | ||
215 | QVBoxLayout *vb = new QVBoxLayout( control ); | 214 | QVBoxLayout *vb = new QVBoxLayout( control ); |
216 | 215 | ||
217 | QScrollView *sv = new QScrollView( control ); | 216 | QScrollView *sv = new QScrollView( control ); |
218 | vb->addWidget( sv, 0, 0 ); | 217 | vb->addWidget( sv, 0, 0 ); |
219 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 218 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
220 | sv->setFrameStyle( QFrame::NoFrame ); | 219 | sv->setFrameStyle( QFrame::NoFrame ); |
221 | 220 | ||
222 | QWidget *container = new QWidget( sv->viewport() ); | 221 | QWidget *container = new QWidget( sv->viewport() ); |
223 | sv->addChild( container ); | 222 | sv->addChild( container ); |
224 | 223 | ||
225 | QGridLayout *layout = new QGridLayout( container ); | 224 | QGridLayout *layout = new QGridLayout( container ); |
226 | layout->setSpacing( 2 ); | 225 | layout->setSpacing( 2 ); |
227 | layout->setMargin( 4 ); | 226 | layout->setMargin( 4 ); |
228 | 227 | ||
229 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); | 228 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); |
230 | grpbox->layout()->setSpacing( 2 ); | 229 | grpbox->layout()->setSpacing( 2 ); |
231 | grpbox->layout()->setMargin( 4 ); | 230 | grpbox->layout()->setMargin( 4 ); |
232 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); | 231 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); |
233 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 232 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
234 | txtHttpProxy = new QLineEdit( grpbox ); | 233 | txtHttpProxy = new QLineEdit( grpbox ); |
235 | grplayout->addWidget( txtHttpProxy ); | 234 | grplayout->addWidget( txtHttpProxy ); |
236 | chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); | 235 | chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); |
237 | grplayout->addWidget( chkHttpProxyEnabled ); | 236 | grplayout->addWidget( chkHttpProxyEnabled ); |
238 | 237 | ||
239 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); | 238 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); |
240 | grpbox->layout()->setSpacing( 2 ); | 239 | grpbox->layout()->setSpacing( 2 ); |
241 | grpbox->layout()->setMargin( 4 ); | 240 | grpbox->layout()->setMargin( 4 ); |
242 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); | 241 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); |
243 | grplayout = new QVBoxLayout( grpbox->layout() ); | 242 | grplayout = new QVBoxLayout( grpbox->layout() ); |
244 | txtFtpProxy = new QLineEdit( grpbox ); | 243 | txtFtpProxy = new QLineEdit( grpbox ); |
245 | grplayout->addWidget( txtFtpProxy ); | 244 | grplayout->addWidget( txtFtpProxy ); |
246 | chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); | 245 | chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); |
247 | grplayout->addWidget( chkFtpProxyEnabled ); | 246 | grplayout->addWidget( chkFtpProxyEnabled ); |
248 | 247 | ||
249 | QLabel *label = new QLabel( tr( "Username:" ), container ); | 248 | QLabel *label = new QLabel( tr( "Username:" ), container ); |
250 | layout->addWidget( label, 2, 0 ); | 249 | layout->addWidget( label, 2, 0 ); |
251 | txtUsername = new QLineEdit( container ); | 250 | txtUsername = new QLineEdit( container ); |
252 | layout->addWidget( txtUsername, 2, 1 ); | 251 | layout->addWidget( txtUsername, 2, 1 ); |
253 | 252 | ||
254 | label = new QLabel( tr( "Password:" ), container ); | 253 | label = new QLabel( tr( "Password:" ), container ); |
255 | layout->addWidget( label, 3, 0 ); | 254 | layout->addWidget( label, 3, 0 ); |
256 | txtPassword = new QLineEdit( container ); | 255 | txtPassword = new QLineEdit( container ); |
257 | layout->addWidget( txtPassword, 3, 1 ); | 256 | layout->addWidget( txtPassword, 3, 1 ); |
258 | 257 | ||
259 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); | 258 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); |
260 | connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); | 259 | connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); |
261 | layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); | 260 | layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); |
262 | 261 | ||
263 | return control; | 262 | return control; |
264 | } | 263 | } |
265 | 264 | ||
266 | void SettingsImpl :: setupData() | 265 | void SettingsImpl :: setupData() |
267 | { | 266 | { |
268 | // add servers | 267 | // add servers |
269 | QString serverName; | 268 | QString serverName; |
270 | QListIterator<Server> it( dataMgr->getServerList() ); | 269 | QListIterator<Server> it( dataMgr->getServerList() ); |
271 | for ( ; it.current(); ++it ) | 270 | for ( ; it.current(); ++it ) |
272 | { | 271 | { |
273 | serverName = it.current()->getServerName(); | 272 | serverName = it.current()->getServerName(); |
274 | if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) | 273 | if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) |
275 | continue; | 274 | continue; |
276 | 275 | ||
277 | servers->insertItem( serverName ); | 276 | servers->insertItem( serverName ); |
278 | } | 277 | } |
279 | 278 | ||
280 | 279 | ||
281 | // add destinations | 280 | // add destinations |
282 | QListIterator<Destination> it2( dataMgr->getDestinationList() ); | 281 | QListIterator<Destination> it2( dataMgr->getDestinationList() ); |
283 | for ( ; it2.current(); ++it2 ) | 282 | for ( ; it2.current(); ++it2 ) |
284 | destinations->insertItem( it2.current()->getDestinationName() ); | 283 | destinations->insertItem( it2.current()->getDestinationName() ); |
285 | 284 | ||
286 | // setup proxy tab | 285 | // setup proxy tab |
287 | txtHttpProxy->setText( dataMgr->getHttpProxy() ); | 286 | txtHttpProxy->setText( dataMgr->getHttpProxy() ); |
288 | txtFtpProxy->setText( dataMgr->getFtpProxy() ); | 287 | txtFtpProxy->setText( dataMgr->getFtpProxy() ); |
289 | txtUsername->setText( dataMgr->getProxyUsername() ); | 288 | txtUsername->setText( dataMgr->getProxyUsername() ); |
290 | txtPassword->setText( dataMgr->getProxyPassword() ); | 289 | txtPassword->setText( dataMgr->getProxyPassword() ); |
291 | chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); | 290 | chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); |
292 | chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); | 291 | chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); |
293 | } | 292 | } |
294 | 293 | ||
295 | //------------------ Servers tab ---------------------- | 294 | //------------------ Servers tab ---------------------- |
296 | 295 | ||
297 | void SettingsImpl :: editServer( int sel ) | 296 | void SettingsImpl :: editServer( int sel ) |
298 | { | 297 | { |
299 | currentSelectedServer = sel; | 298 | currentSelectedServer = sel; |
300 | Server *s = dataMgr->getServer( servers->currentText() ); | 299 | Server *s = dataMgr->getServer( servers->currentText() ); |
301 | if ( s ) | 300 | if ( s ) |
302 | { | 301 | { |
303 | serverName = s->getServerName(); | 302 | serverName = s->getServerName(); |
304 | servername->setText( s->getServerName() ); | 303 | servername->setText( s->getServerName() ); |
305 | serverurl->setText( s->getServerUrl() ); | 304 | serverurl->setText( s->getServerUrl() ); |
306 | active->setChecked( s->isServerActive() ); | 305 | active->setChecked( s->isServerActive() ); |
307 | } | 306 | } |
308 | else | 307 | else |
309 | { | 308 | { |
310 | serverName = ""; | 309 | serverName = ""; |
311 | servername->setText( "" ); | 310 | servername->setText( "" ); |
312 | serverurl->setText( "" ); | 311 | serverurl->setText( "" ); |
313 | active->setChecked( false ); | 312 | active->setChecked( false ); |
314 | } | 313 | } |
315 | } | 314 | } |
316 | 315 | ||
317 | void SettingsImpl :: newServer() | 316 | void SettingsImpl :: newServer() |
318 | { | 317 | { |
319 | newserver = true; | 318 | newserver = true; |
320 | servername->setText( "" ); | 319 | servername->setText( "" ); |
321 | serverurl->setText( "" ); | 320 | serverurl->setText( "" ); |
322 | servername->setFocus(); | 321 | servername->setFocus(); |
323 | active->setChecked( true ); | 322 | active->setChecked( true ); |
324 | } | 323 | } |
325 | 324 | ||
326 | void SettingsImpl :: removeServer() | 325 | void SettingsImpl :: removeServer() |
327 | { | 326 | { |
328 | changed = true; | 327 | changed = true; |
329 | Server *s = dataMgr->getServer( servers->currentText() ); | 328 | Server *s = dataMgr->getServer( servers->currentText() ); |
330 | if ( s ) | 329 | if ( s ) |
331 | { | 330 | { |
332 | dataMgr->getServerList().removeRef( s ); | 331 | dataMgr->getServerList().removeRef( s ); |
333 | servers->removeItem( currentSelectedServer ); | 332 | servers->removeItem( currentSelectedServer ); |
334 | } | 333 | } |
335 | } | 334 | } |
336 | 335 | ||
337 | void SettingsImpl :: changeServerDetails() | 336 | void SettingsImpl :: changeServerDetails() |
338 | { | 337 | { |
339 | changed = true; | 338 | changed = true; |
340 | 339 | ||
341 | QString newName = servername->text(); | 340 | QString newName = servername->text(); |
342 | 341 | ||
343 | // Convert any spaces to underscores | 342 | // Convert any spaces to underscores |
344 | char *tmpStr = new char[newName.length() + 1]; | 343 | char *tmpStr = new char[newName.length() + 1]; |
345 | for ( unsigned int i = 0 ; i < newName.length() ; ++i ) | 344 | for ( unsigned int i = 0 ; i < newName.length() ; ++i ) |
346 | { | 345 | { |
347 | if ( newName[i] == ' ' ) | 346 | if ( newName[i] == ' ' ) |
348 | tmpStr[i] = '_'; | 347 | tmpStr[i] = '_'; |
349 | else | 348 | else |
350 | tmpStr[i] = newName[i].latin1(); | 349 | tmpStr[i] = newName[i].latin1(); |
351 | } | 350 | } |
352 | tmpStr[newName.length()] = '\0'; | 351 | tmpStr[newName.length()] = '\0'; |
353 | 352 | ||
354 | newName = tmpStr; | 353 | newName = tmpStr; |
355 | delete tmpStr; | 354 | delete tmpStr; |
356 | 355 | ||
357 | if ( !newserver ) | 356 | if ( !newserver ) |
358 | { | 357 | { |
359 | Server *s = dataMgr->getServer( servers->currentText() ); | 358 | Server *s = dataMgr->getServer( servers->currentText() ); |
360 | if ( s ) | 359 | if ( s ) |
361 | { | 360 | { |
362 | // Update url | 361 | // Update url |
363 | s->setServerUrl( serverurl->text() ); | 362 | s->setServerUrl( serverurl->text() ); |
364 | s->setActive( active->isChecked() ); | 363 | s->setActive( active->isChecked() ); |
365 | 364 | ||
366 | // Check if server name has changed, if it has then we need to replace the key in the map | 365 | // Check if server name has changed, if it has then we need to replace the key in the map |
367 | if ( serverName != newName ) | 366 | if ( serverName != newName ) |
368 | { | 367 | { |
369 | // Update server name | 368 | // Update server name |
370 | s->setServerName( newName ); | 369 | s->setServerName( newName ); |
371 | } | 370 | } |
372 | 371 | ||
373 | // Update list box | 372 | // Update list box |
374 | servers->changeItem( newName, currentSelectedServer ); | 373 | servers->changeItem( newName, currentSelectedServer ); |
375 | } | 374 | } |
376 | } | 375 | } |
377 | else | 376 | else |
378 | { | 377 | { |
379 | Server s( newName, serverurl->text() ); | 378 | Server s( newName, serverurl->text() ); |
380 | dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); | 379 | dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); |
381 | dataMgr->getServerList().last()->setActive( active->isChecked() ); | 380 | dataMgr->getServerList().last()->setActive( active->isChecked() ); |
382 | servers->insertItem( newName ); | 381 | servers->insertItem( newName ); |
383 | servers->setCurrentItem( servers->count() ); | 382 | servers->setCurrentItem( servers->count() ); |
384 | newserver = false; | 383 | newserver = false; |
385 | } | 384 | } |
386 | } | 385 | } |
387 | 386 | ||
388 | //------------------ Destinations tab ---------------------- | 387 | //------------------ Destinations tab ---------------------- |
389 | 388 | ||
390 | void SettingsImpl :: editDestination( int sel ) | 389 | void SettingsImpl :: editDestination( int sel ) |
391 | { | 390 | { |
392 | currentSelectedDestination = sel; | 391 | currentSelectedDestination = sel; |
393 | Destination *d = dataMgr->getDestination( destinations->currentText() ); | 392 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
394 | if ( d ) | 393 | if ( d ) |
395 | { | 394 | { |
396 | destinationName = d->getDestinationName(); | 395 | destinationName = d->getDestinationName(); |
397 | destinationname->setText( d->getDestinationName() ); | 396 | destinationname->setText( d->getDestinationName() ); |
398 | destinationurl->setText( d->getDestinationPath() ); | 397 | destinationurl->setText( d->getDestinationPath() ); |
399 | linkToRoot->setChecked( d->linkToRoot() ); | 398 | linkToRoot->setChecked( d->linkToRoot() ); |
400 | } | 399 | } |
401 | else | 400 | else |
402 | { | 401 | { |
403 | destinationName = ""; | 402 | destinationName = ""; |
404 | destinationname->setText( "" ); | 403 | destinationname->setText( "" ); |
405 | destinationurl->setText( "" ); | 404 | destinationurl->setText( "" ); |
406 | linkToRoot->setChecked( false ); | 405 | linkToRoot->setChecked( false ); |
407 | } | 406 | } |
408 | } | 407 | } |
409 | 408 | ||
410 | void SettingsImpl :: newDestination() | 409 | void SettingsImpl :: newDestination() |
411 | { | 410 | { |
412 | newdestination = true; | 411 | newdestination = true; |
413 | destinationname->setText( "" ); | 412 | destinationname->setText( "" ); |
414 | destinationurl->setText( "" ); | 413 | destinationurl->setText( "" ); |
415 | destinationname->setFocus(); | 414 | destinationname->setFocus(); |
416 | linkToRoot->setChecked( true ); | 415 | linkToRoot->setChecked( true ); |
417 | } | 416 | } |
418 | 417 | ||
419 | void SettingsImpl :: removeDestination() | 418 | void SettingsImpl :: removeDestination() |
420 | { | 419 | { |
421 | changed = true; | 420 | changed = true; |
422 | Destination *d = dataMgr->getDestination( destinations->currentText() ); | 421 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
423 | if ( d ) | 422 | if ( d ) |
424 | { | 423 | { |
425 | dataMgr->getDestinationList().removeRef( d ); | 424 | dataMgr->getDestinationList().removeRef( d ); |
426 | destinations->removeItem( currentSelectedDestination ); | 425 | destinations->removeItem( currentSelectedDestination ); |
427 | } | 426 | } |
428 | } | 427 | } |
429 | 428 | ||
430 | void SettingsImpl :: changeDestinationDetails() | 429 | void SettingsImpl :: changeDestinationDetails() |
431 | { | 430 | { |
432 | changed = true; | 431 | changed = true; |
433 | 432 | ||
434 | #ifdef QWS | 433 | #ifdef QWS |
435 | Config cfg( "aqpkg" ); | 434 | Config cfg( "aqpkg" ); |
436 | cfg.setGroup( "destinations" ); | 435 | cfg.setGroup( "destinations" ); |
437 | #endif | 436 | #endif |
438 | 437 | ||
439 | QString newName = destinationname->text(); | 438 | QString newName = destinationname->text(); |
440 | if ( !newdestination ) | 439 | if ( !newdestination ) |
441 | { | 440 | { |
442 | Destination *d = dataMgr->getDestination( destinations->currentText() ); | 441 | Destination *d = dataMgr->getDestination( destinations->currentText() ); |
443 | if ( d ) | 442 | if ( d ) |
444 | { | 443 | { |
445 | // Update url | 444 | // Update url |
446 | d->setDestinationPath( destinationurl->text() ); | 445 | d->setDestinationPath( destinationurl->text() ); |
447 | d->linkToRoot( linkToRoot->isChecked() ); | 446 | d->linkToRoot( linkToRoot->isChecked() ); |
448 | 447 | ||
449 | // Check if server name has changed, if it has then we need to replace the key in the map | 448 | // Check if server name has changed, if it has then we need to replace the key in the map |
450 | if ( destinationName != newName ) | 449 | if ( destinationName != newName ) |
451 | { | 450 | { |
452 | // Update server name | 451 | // Update server name |
453 | d->setDestinationName( newName ); | 452 | d->setDestinationName( newName ); |
454 | 453 | ||
455 | // Update list box | 454 | // Update list box |
456 | destinations->changeItem( newName, currentSelectedDestination ); | 455 | destinations->changeItem( newName, currentSelectedDestination ); |
457 | } | 456 | } |
458 | 457 | ||
459 | #ifdef QWS | 458 | #ifdef QWS |
460 | QString key = newName; | 459 | QString key = newName; |
461 | key += "_linkToRoot"; | 460 | key += "_linkToRoot"; |
462 | int val = d->linkToRoot(); | 461 | int val = d->linkToRoot(); |
463 | cfg.writeEntry( key, val ); | 462 | cfg.writeEntry( key, val ); |
464 | #endif | 463 | #endif |
465 | } | 464 | |
466 | } | 465 | } |
467 | else | 466 | } |
468 | { | 467 | else |
469 | dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) ); | 468 | { |
470 | destinations->insertItem( newName ); | 469 | dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) ); |
471 | destinations->setCurrentItem( destinations->count() ); | 470 | destinations->insertItem( newName ); |
472 | newdestination = false; | 471 | destinations->setCurrentItem( destinations->count() ); |
472 | newdestination = false; | ||
473 | 473 | ||
474 | #ifdef QWS | 474 | #ifdef QWS |
475 | QString key = newName; | 475 | QString key = newName; |
476 | key += "_linkToRoot"; | 476 | key += "_linkToRoot"; |
477 | cfg.writeEntry( key, true ); | 477 | cfg.writeEntry( key, true ); |
478 | #endif | 478 | #endif |
479 | } | 479 | |
480 | } | ||
480 | } | 481 | } |
481 | 482 | ||
482 | //------------------ Proxy tab ---------------------- | 483 | //------------------ Proxy tab ---------------------- |
483 | void SettingsImpl :: proxyApplyChanges() | 484 | void SettingsImpl :: proxyApplyChanges() |
484 | { | 485 | { |
485 | changed = true; | 486 | changed = true; |
486 | dataMgr->setHttpProxy( txtHttpProxy->text() ); | 487 | dataMgr->setHttpProxy( txtHttpProxy->text() ); |
487 | dataMgr->setFtpProxy( txtFtpProxy->text() ); | 488 | dataMgr->setFtpProxy( txtFtpProxy->text() ); |
488 | dataMgr->setProxyUsername( txtUsername->text() ); | 489 | dataMgr->setProxyUsername( txtUsername->text() ); |
489 | dataMgr->setProxyPassword( txtPassword->text() ); | 490 | dataMgr->setProxyPassword( txtPassword->text() ); |
490 | 491 | ||
491 | dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() ); | 492 | dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() ); |
492 | dataMgr->setFtpProxyEnabled( chkFtpProxyEnabled->isChecked() ); | 493 | dataMgr->setFtpProxyEnabled( chkFtpProxyEnabled->isChecked() ); |
493 | } | 494 | } |