author | drw <drw> | 2003-02-01 02:07:22 (UTC) |
---|---|---|
committer | drw <drw> | 2003-02-01 02:07:22 (UTC) |
commit | 766f09a89eef17808e77836f76371aab8ebc4c1c (patch) (unidiff) | |
tree | 3a298c40d5b688dc409a0e6d251a514d88eada48 /noncore | |
parent | 266feac1ac442947651bf169dbf993c4d46d56ea (diff) | |
download | opie-766f09a89eef17808e77836f76371aab8ebc4c1c.zip opie-766f09a89eef17808e77836f76371aab8ebc4c1c.tar.gz opie-766f09a89eef17808e77836f76371aab8ebc4c1c.tar.bz2 |
Many updates to install dialog
-rw-r--r-- | noncore/settings/aqpkg/.cvsignore | 4 | ||||
-rw-r--r-- | noncore/settings/aqpkg/aqpkg.pro | 1 | ||||
-rw-r--r-- | noncore/settings/aqpkg/install.ui | 147 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 132 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.h | 38 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 86 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 3 |
7 files changed, 164 insertions, 247 deletions
diff --git a/noncore/settings/aqpkg/.cvsignore b/noncore/settings/aqpkg/.cvsignore index ef0e27f..751040e 100644 --- a/noncore/settings/aqpkg/.cvsignore +++ b/noncore/settings/aqpkg/.cvsignore | |||
@@ -1,10 +1,8 @@ | |||
1 | Makefile* | 1 | Makefile* |
2 | install.cpp | ||
3 | install.h | ||
4 | instoptions.cpp | 2 | instoptions.cpp |
5 | instoptions.h | 3 | instoptions.h |
6 | moc* | 4 | moc* |
7 | settings.cpp | 5 | settings.cpp |
8 | settings.h | 6 | settings.h |
9 | categoryfilter.cpp | 7 | categoryfilter.cpp |
10 | categoryfilter.h \ No newline at end of file | 8 | categoryfilter.h |
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro index d8eee6a..d3f898b 100644 --- a/noncore/settings/aqpkg/aqpkg.pro +++ b/noncore/settings/aqpkg/aqpkg.pro | |||
@@ -30,13 +30,12 @@ SOURCES = mainwin.cpp \ | |||
30 | helpwindow.cpp \ | 30 | helpwindow.cpp \ |
31 | letterpushbutton.cpp \ | 31 | letterpushbutton.cpp \ |
32 | inputdlg.cpp \ | 32 | inputdlg.cpp \ |
33 | version.cpp \ | 33 | version.cpp \ |
34 | categoryfilterimpl.cpp | 34 | categoryfilterimpl.cpp |
35 | INTERFACES= settings.ui \ | 35 | INTERFACES= settings.ui \ |
36 | install.ui \ | ||
37 | instoptions.ui \ | 36 | instoptions.ui \ |
38 | categoryfilter.ui | 37 | categoryfilter.ui |
39 | TARGET = aqpkg | 38 | TARGET = aqpkg |
40 | INCLUDEPATH += $(OPIEDIR)/include | 39 | INCLUDEPATH += $(OPIEDIR)/include |
41 | DEPENDPATH += $(OPIEDIR)/include | 40 | DEPENDPATH += $(OPIEDIR)/include |
42 | LIBS += -lqpe -lopie -lstdc++ | 41 | LIBS += -lqpe -lopie -lstdc++ |
diff --git a/noncore/settings/aqpkg/install.ui b/noncore/settings/aqpkg/install.ui deleted file mode 100644 index 53622dd..0000000 --- a/noncore/settings/aqpkg/install.ui +++ b/dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>InstallDlg</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>InstallDlg</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>196</width> | ||
15 | <height>278</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Install</string> | ||
21 | </property> | ||
22 | <grid> | ||
23 | <property stdset="1"> | ||
24 | <name>margin</name> | ||
25 | <number>11</number> | ||
26 | </property> | ||
27 | <property stdset="1"> | ||
28 | <name>spacing</name> | ||
29 | <number>6</number> | ||
30 | </property> | ||
31 | <widget row="0" column="1" > | ||
32 | <class>QComboBox</class> | ||
33 | <property stdset="1"> | ||
34 | <name>name</name> | ||
35 | <cstring>destination</cstring> | ||
36 | </property> | ||
37 | </widget> | ||
38 | <widget row="3" column="0" > | ||
39 | <class>QPushButton</class> | ||
40 | <property stdset="1"> | ||
41 | <name>name</name> | ||
42 | <cstring>btnInstall</cstring> | ||
43 | </property> | ||
44 | <property stdset="1"> | ||
45 | <name>text</name> | ||
46 | <string>Start</string> | ||
47 | </property> | ||
48 | </widget> | ||
49 | <widget row="3" column="1" > | ||
50 | <class>QPushButton</class> | ||
51 | <property stdset="1"> | ||
52 | <name>name</name> | ||
53 | <cstring>btnOptions</cstring> | ||
54 | </property> | ||
55 | <property stdset="1"> | ||
56 | <name>text</name> | ||
57 | <string>Options</string> | ||
58 | </property> | ||
59 | </widget> | ||
60 | <widget row="2" column="0" rowspan="1" colspan="2" > | ||
61 | <class>QGroupBox</class> | ||
62 | <property stdset="1"> | ||
63 | <name>name</name> | ||
64 | <cstring>GroupBox2</cstring> | ||
65 | </property> | ||
66 | <property stdset="1"> | ||
67 | <name>title</name> | ||
68 | <string>Output</string> | ||
69 | </property> | ||
70 | <grid> | ||
71 | <property stdset="1"> | ||
72 | <name>margin</name> | ||
73 | <number>11</number> | ||
74 | </property> | ||
75 | <property stdset="1"> | ||
76 | <name>spacing</name> | ||
77 | <number>6</number> | ||
78 | </property> | ||
79 | <widget row="0" column="0" > | ||
80 | <class>QMultiLineEdit</class> | ||
81 | <property stdset="1"> | ||
82 | <name>name</name> | ||
83 | <cstring>output</cstring> | ||
84 | </property> | ||
85 | </widget> | ||
86 | </grid> | ||
87 | </widget> | ||
88 | <widget row="0" column="0" > | ||
89 | <class>QLabel</class> | ||
90 | <property stdset="1"> | ||
91 | <name>name</name> | ||
92 | <cstring>TextLabel1</cstring> | ||
93 | </property> | ||
94 | <property stdset="1"> | ||
95 | <name>text</name> | ||
96 | <string>Destination</string> | ||
97 | </property> | ||
98 | </widget> | ||
99 | <widget row="1" column="0" > | ||
100 | <class>QLabel</class> | ||
101 | <property stdset="1"> | ||
102 | <name>name</name> | ||
103 | <cstring>TextLabel3</cstring> | ||
104 | </property> | ||
105 | <property stdset="1"> | ||
106 | <name>text</name> | ||
107 | <string>Space Avail</string> | ||
108 | </property> | ||
109 | </widget> | ||
110 | <widget row="1" column="1" > | ||
111 | <class>QLabel</class> | ||
112 | <property stdset="1"> | ||
113 | <name>name</name> | ||
114 | <cstring>txtAvailableSpace</cstring> | ||
115 | </property> | ||
116 | <property stdset="1"> | ||
117 | <name>text</name> | ||
118 | <string></string> | ||
119 | </property> | ||
120 | </widget> | ||
121 | </grid> | ||
122 | </widget> | ||
123 | <connections> | ||
124 | <connection> | ||
125 | <sender>btnOptions</sender> | ||
126 | <signal>clicked()</signal> | ||
127 | <receiver>InstallDlg</receiver> | ||
128 | <slot>optionsSelected()</slot> | ||
129 | </connection> | ||
130 | <connection> | ||
131 | <sender>btnInstall</sender> | ||
132 | <signal>clicked()</signal> | ||
133 | <receiver>InstallDlg</receiver> | ||
134 | <slot>installSelected()</slot> | ||
135 | </connection> | ||
136 | <connection> | ||
137 | <sender>destination</sender> | ||
138 | <signal>highlighted(const QString&)</signal> | ||
139 | <receiver>InstallDlg</receiver> | ||
140 | <slot>displayAvailableSpace( const QString& )</slot> | ||
141 | </connection> | ||
142 | <slot access="public">displayAvailableSpace( const QString& )</slot> | ||
143 | <slot access="public">installSelected()</slot> | ||
144 | <slot access="public">displayText( const QString & )</slot> | ||
145 | <slot access="public">optionsSelected()</slot> | ||
146 | </connections> | ||
147 | </UI> | ||
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 75ce1a1..65aaa32 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -12,36 +12,44 @@ | |||
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include <stdio.h> | ||
19 | |||
18 | #ifdef QWS | 20 | #ifdef QWS |
19 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
20 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qpe/resource.h> | ||
21 | #include <qpe/storage.h> | 24 | #include <qpe/storage.h> |
22 | #endif | 25 | #endif |
23 | 26 | ||
24 | #include <qmultilineedit.h> | ||
25 | #include <qdialog.h> | ||
26 | #include <qcombobox.h> | ||
27 | #include <qcheckbox.h> | 27 | #include <qcheckbox.h> |
28 | #include <qpushbutton.h> | 28 | #include <qcombobox.h> |
29 | #include <qdialog.h> | ||
30 | #include <qgroupbox.h> | ||
31 | #include <qmultilineedit.h> | ||
29 | #include <qlabel.h> | 32 | #include <qlabel.h> |
30 | 33 | #include <qlayout.h> | |
34 | #include <qpushbutton.h> | ||
31 | 35 | ||
32 | #include "datamgr.h" | 36 | #include "datamgr.h" |
33 | #include "instoptionsimpl.h" | ||
34 | #include "destination.h" | 37 | #include "destination.h" |
38 | #include "instoptionsimpl.h" | ||
35 | #include "installdlgimpl.h" | 39 | #include "installdlgimpl.h" |
40 | #include "ipkg.h" | ||
36 | #include "utils.h" | 41 | #include "utils.h" |
37 | #include "global.h" | 42 | #include "global.h" |
38 | 43 | ||
39 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) | 44 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ) |
40 | : InstallDlg( parent, name, modal, fl ) | 45 | : QWidget( 0, 0, 0 ) |
41 | { | 46 | { |
47 | setCaption( title ); | ||
48 | init( TRUE ); | ||
49 | |||
42 | pIpkg = 0; | 50 | pIpkg = 0; |
43 | upgradePackages = false; | 51 | upgradePackages = false; |
44 | dataMgr = dataManager; | 52 | dataMgr = dataManager; |
45 | vector<Destination>::iterator dit; | 53 | vector<Destination>::iterator dit; |
46 | 54 | ||
47 | QString defaultDest = "root"; | 55 | QString defaultDest = "root"; |
@@ -55,15 +63,15 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
55 | #else | 63 | #else |
56 | flags = 0; | 64 | flags = 0; |
57 | #endif | 65 | #endif |
58 | 66 | ||
59 | // Output text is read only | 67 | // Output text is read only |
60 | output->setReadOnly( true ); | 68 | output->setReadOnly( true ); |
61 | QFont f( "helvetica" ); | 69 | //QFont f( "helvetica" ); |
62 | f.setPointSize( 10 ); | 70 | //f.setPointSize( 10 ); |
63 | output->setFont( f ); | 71 | //output->setFont( f ); |
64 | 72 | ||
65 | 73 | ||
66 | // setup destination data | 74 | // setup destination data |
67 | int defIndex = 0; | 75 | int defIndex = 0; |
68 | int i; | 76 | int i; |
69 | for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) | 77 | for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) |
@@ -74,61 +82,103 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d | |||
74 | } | 82 | } |
75 | 83 | ||
76 | destination->setCurrentItem( defIndex ); | 84 | destination->setCurrentItem( defIndex ); |
77 | 85 | ||
78 | vector<InstallData>::iterator it; | 86 | vector<InstallData>::iterator it; |
79 | // setup package data | 87 | // setup package data |
80 | QString remove = "Remove\n"; | 88 | QString remove = tr( "Remove\n" ); |
81 | QString install = "\nInstall\n"; | 89 | QString install = tr( "Install\n" ); |
82 | QString upgrade = "\nUpgrade\n"; | 90 | QString upgrade = tr( "Upgrade\n" ); |
83 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) | 91 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) |
84 | { | 92 | { |
85 | InstallData item = *it; | 93 | InstallData item = *it; |
86 | if ( item.option == "I" ) | 94 | if ( item.option == "I" ) |
87 | { | 95 | { |
88 | installList.push_back( item ); | 96 | installList.push_back( item ); |
89 | install += " " + item.packageName + "\n"; | 97 | install.append( QString( " %1\n" ).arg( item.packageName ) ); |
90 | } | 98 | } |
91 | else if ( item.option == "D" ) | 99 | else if ( item.option == "D" ) |
92 | { | 100 | { |
93 | removeList.push_back( item ); | 101 | removeList.push_back( item ); |
94 | remove += " " + item.packageName + "\n"; | 102 | remove.append( QString( " %1\n" ).arg( item.packageName ) ); |
95 | } | 103 | } |
96 | else if ( item.option == "U" || item.option == "R" ) | 104 | else if ( item.option == "U" || item.option == "R" ) |
97 | { | 105 | { |
98 | updateList.push_back( item ); | 106 | updateList.push_back( item ); |
99 | QString type = " (Upgrade)"; | 107 | QString type; |
100 | if ( item.option == "R" ) | 108 | if ( item.option == "R" ) |
101 | type = " (ReInstall)"; | 109 | type = tr( "(ReInstall)" ); |
102 | upgrade += " " + item.packageName + type + "\n"; | 110 | else |
103 | } | 111 | type = tr( "(Upgrade)" ); |
112 | upgrade.append( QString( " %1 %2\n" ).arg( item.packageName ).arg( type ) ); | ||
113 | } | ||
104 | } | 114 | } |
105 | 115 | ||
106 | output->setText( remove + install + upgrade ); | 116 | output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); |
107 | 117 | ||
108 | displayAvailableSpace( destination->currentText() ); | 118 | displayAvailableSpace( destination->currentText() ); |
109 | } | 119 | } |
110 | 120 | ||
111 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) | 121 | InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ) |
112 | : InstallDlg( parent, name, modal, fl ) | 122 | : QWidget( 0, 0, 0 ) |
113 | { | 123 | { |
124 | setCaption( title ); | ||
125 | init( FALSE ); | ||
114 | pIpkg = ipkg; | 126 | pIpkg = ipkg; |
115 | output->setText( initialText ); | 127 | output->setText( initialText ); |
116 | } | 128 | } |
117 | 129 | ||
118 | 130 | ||
119 | InstallDlgImpl::~InstallDlgImpl() | 131 | InstallDlgImpl::~InstallDlgImpl() |
120 | { | 132 | { |
133 | if ( pIpkg ) | ||
134 | delete pIpkg; | ||
121 | } | 135 | } |
122 | 136 | ||
123 | bool InstallDlgImpl :: showDlg() | 137 | void InstallDlgImpl :: init( bool displayextrainfo ) |
124 | { | 138 | { |
125 | showMaximized(); | 139 | QGridLayout *layout = new QGridLayout( this ); |
126 | bool ret = exec(); | 140 | layout->setSpacing( 4 ); |
141 | layout->setMargin( 4 ); | ||
127 | 142 | ||
128 | return ret; | 143 | if ( displayextrainfo ) |
144 | { | ||
145 | QLabel *label = new QLabel( tr( "Destination" ), this ); | ||
146 | layout->addWidget( label, 0, 0 ); | ||
147 | destination = new QComboBox( FALSE, this ); | ||
148 | layout->addWidget( destination, 0, 1 ); | ||
149 | connect( destination, SIGNAL( highlighted( const QString & ) ), | ||
150 | this, SLOT( displayAvailableSpace( const QString & ) ) ); | ||
151 | |||
152 | QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); | ||
153 | layout->addWidget( label2, 1, 0 ); | ||
154 | txtAvailableSpace = new QLabel( "", this ); | ||
155 | layout->addWidget( txtAvailableSpace, 1, 1 ); | ||
156 | } | ||
157 | else | ||
158 | { | ||
159 | destination = 0x0; | ||
160 | txtAvailableSpace = 0x0; | ||
161 | } | ||
162 | |||
163 | QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); | ||
164 | GroupBox2->layout()->setSpacing( 0 ); | ||
165 | GroupBox2->layout()->setMargin( 4 ); | ||
166 | |||
167 | QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); | ||
168 | output = new QMultiLineEdit( GroupBox2 ); | ||
169 | GroupBox2Layout->addWidget( output ); | ||
170 | layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); | ||
171 | |||
172 | btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); | ||
173 | layout->addWidget( btnInstall, 3, 0 ); | ||
174 | connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); | ||
175 | |||
176 | btnOptions = new QPushButton( Resource::loadPixmap( "aqpkg/config" ), tr( "Options" ), this ); | ||
177 | layout->addWidget( btnOptions, 3, 1 ); | ||
178 | connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); | ||
129 | } | 179 | } |
130 | 180 | ||
131 | void InstallDlgImpl :: optionsSelected() | 181 | void InstallDlgImpl :: optionsSelected() |
132 | { | 182 | { |
133 | InstallOptionsDlgImpl opt( flags, this, "Option", true ); | 183 | InstallOptionsDlgImpl opt( flags, this, "Option", true ); |
134 | opt.exec(); | 184 | opt.exec(); |
@@ -142,40 +192,40 @@ void InstallDlgImpl :: optionsSelected() | |||
142 | cfg.writeEntry( "installFlags", flags ); | 192 | cfg.writeEntry( "installFlags", flags ); |
143 | #endif | 193 | #endif |
144 | } | 194 | } |
145 | 195 | ||
146 | void InstallDlgImpl :: installSelected() | 196 | void InstallDlgImpl :: installSelected() |
147 | { | 197 | { |
148 | if ( btnInstall->text() == "Abort" ) | 198 | if ( btnInstall->text() == tr( "Abort" ) ) |
149 | { | 199 | { |
150 | if ( pIpkg ) | 200 | if ( pIpkg ) |
151 | { | 201 | { |
152 | displayText( "\n**** User Clicked ABORT ***" ); | 202 | displayText( tr( "\n**** User Clicked ABORT ***" ) ); |
153 | pIpkg->abort(); | 203 | pIpkg->abort(); |
154 | displayText( "**** Process Aborted ****" ); | 204 | displayText( tr( "**** Process Aborted ****" ) ); |
155 | } | 205 | } |
156 | 206 | ||
157 | btnInstall->setText( tr( "Close" ) ); | 207 | btnInstall->setText( tr( "Close" ) ); |
208 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | ||
158 | return; | 209 | return; |
159 | } | 210 | } |
160 | else if ( btnInstall->text() == tr( "Close" ) ) | 211 | else if ( btnInstall->text() == tr( "Close" ) ) |
161 | { | 212 | { |
162 | done( 1 ); | 213 | emit reloadData( this ); |
163 | return; | 214 | return; |
164 | } | 215 | } |
165 | 216 | ||
166 | // Disable buttons | 217 | // Disable buttons |
167 | btnOptions->setEnabled( false ); | 218 | btnOptions->setEnabled( false ); |
168 | // btnInstall->setEnabled( false ); | 219 | // btnInstall->setEnabled( false ); |
169 | 220 | ||
170 | btnInstall->setText( "Abort" ); | 221 | btnInstall->setText( tr( "Abort" ) ); |
171 | 222 | btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); | |
172 | if ( pIpkg ) | 223 | if ( pIpkg ) |
173 | { | 224 | { |
174 | output->setText( "" ); | 225 | output->setText( "" ); |
175 | |||
176 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 226 | connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
177 | pIpkg->runIpkg(); | 227 | pIpkg->runIpkg(); |
178 | } | 228 | } |
179 | else | 229 | else |
180 | { | 230 | { |
181 | output->setText( "" ); | 231 | output->setText( "" ); |
@@ -239,27 +289,30 @@ void InstallDlgImpl :: installSelected() | |||
239 | tmpFlags |= MAKE_LINKS; | 289 | tmpFlags |= MAKE_LINKS; |
240 | pIpkg->setFlags( tmpFlags ); | 290 | pIpkg->setFlags( tmpFlags ); |
241 | pIpkg->runIpkg(); | 291 | pIpkg->runIpkg(); |
242 | } | 292 | } |
243 | 293 | ||
244 | delete pIpkg; | 294 | delete pIpkg; |
295 | pIpkg = 0; | ||
245 | } | 296 | } |
246 | 297 | ||
247 | btnOptions->setEnabled( true ); | 298 | btnOptions->setEnabled( true ); |
248 | // btnInstall->setEnabled( true ); | 299 | // btnInstall->setEnabled( true ); |
249 | btnInstall->setText( tr( "Close" ) ); | 300 | btnInstall->setText( tr( "Close" ) ); |
301 | btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); | ||
250 | 302 | ||
251 | if ( destination->currentText() != 0 && destination->currentText() != "" ) | 303 | if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) |
252 | displayAvailableSpace( destination->currentText() ); | 304 | displayAvailableSpace( destination->currentText() ); |
253 | } | 305 | } |
254 | 306 | ||
255 | 307 | ||
256 | void InstallDlgImpl :: displayText(const QString &text ) | 308 | void InstallDlgImpl :: displayText(const QString &text ) |
257 | { | 309 | { |
258 | QString t = output->text() + "\n" + text; | 310 | //output->setText( QString( "%1\n%2" ).arg( output->text() ).arg( text ) ); |
259 | output->setText( t ); | 311 | QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); |
312 | output->setText( newtext ); | ||
260 | output->setCursorPosition( output->numLines(), 0 ); | 313 | output->setCursorPosition( output->numLines(), 0 ); |
261 | } | 314 | } |
262 | 315 | ||
263 | 316 | ||
264 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | 317 | void InstallDlgImpl :: displayAvailableSpace( const QString &text ) |
265 | { | 318 | { |
@@ -281,11 +334,12 @@ void InstallDlgImpl :: displayAvailableSpace( const QString &text ) | |||
281 | long avail = availBlocks * mult / div; | 334 | long avail = availBlocks * mult / div; |
282 | // long used = total - avail; | 335 | // long used = total - avail; |
283 | 336 | ||
284 | space.sprintf( "%ld Kb", avail ); | 337 | space.sprintf( "%ld Kb", avail ); |
285 | } | 338 | } |
286 | else | 339 | else |
287 | space = "Unknown"; | 340 | space = tr( "Unknown" ); |
288 | 341 | ||
289 | txtAvailableSpace->setText( space ); | 342 | if ( txtAvailableSpace ) |
343 | txtAvailableSpace->setText( space ); | ||
290 | } | 344 | } |
291 | 345 | ||
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h index 2f80f08..4c9f087 100644 --- a/noncore/settings/aqpkg/installdlgimpl.h +++ b/noncore/settings/aqpkg/installdlgimpl.h | |||
@@ -17,51 +17,69 @@ | |||
17 | #ifndef INSTALLDLGIMPL_H | 17 | #ifndef INSTALLDLGIMPL_H |
18 | #define INSTALLDLGIMPL_H | 18 | #define INSTALLDLGIMPL_H |
19 | 19 | ||
20 | #include <vector> | 20 | #include <vector> |
21 | using namespace std; | 21 | using namespace std; |
22 | 22 | ||
23 | #include <qwidget.h> | ||
23 | #include <qstring.h> | 24 | #include <qstring.h> |
24 | 25 | ||
25 | #include "ipkg.h" | 26 | class QComboBox; |
26 | #include "install.h" | 27 | class QLabel; |
28 | class QMultiLineEdit; | ||
29 | class QPushButton; | ||
30 | |||
31 | class DataManager; | ||
32 | class Destination; | ||
33 | class Ipkg; | ||
27 | 34 | ||
28 | class InstallData | 35 | class InstallData |
29 | { | 36 | { |
30 | public: | 37 | public: |
31 | QString option; // I - install, D - delete, R- reinstall U - upgrade | 38 | QString option; // I - install, D - delete, R- reinstall U - upgrade |
32 | QString packageName; | 39 | QString packageName; |
33 | Destination *destination; | 40 | Destination *destination; |
34 | bool recreateLinks; | 41 | bool recreateLinks; |
35 | }; | 42 | }; |
36 | 43 | ||
37 | class InstallDlgImpl : public InstallDlg | 44 | class InstallDlgImpl : public QWidget |
38 | { | 45 | { |
46 | Q_OBJECT | ||
39 | public: | 47 | public: |
40 | InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); | 48 | InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ); |
41 | InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); | 49 | InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ); |
42 | ~InstallDlgImpl(); | 50 | ~InstallDlgImpl(); |
43 | 51 | ||
44 | bool showDlg(); | ||
45 | bool upgradeServer( QString &server ); | 52 | bool upgradeServer( QString &server ); |
46 | 53 | ||
47 | |||
48 | protected: | 54 | protected: |
49 | 55 | ||
50 | private: | 56 | private: |
51 | DataManager *dataMgr; | 57 | DataManager *dataMgr; |
52 | vector<InstallData> installList; | 58 | vector<InstallData> installList; |
53 | vector<InstallData> removeList; | 59 | vector<InstallData> removeList; |
54 | vector<InstallData> updateList; | 60 | vector<InstallData> updateList; |
55 | int flags; | 61 | int flags; |
56 | Ipkg *pIpkg; | 62 | Ipkg *pIpkg; |
57 | bool upgradePackages; | 63 | bool upgradePackages; |
64 | |||
65 | QComboBox *destination; | ||
66 | QPushButton *btnInstall; | ||
67 | QPushButton *btnOptions; | ||
68 | QMultiLineEdit *output; | ||
69 | QLabel *txtAvailableSpace; | ||
58 | 70 | ||
59 | bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); | 71 | void init( bool ); |
72 | |||
73 | bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); | ||
60 | 74 | ||
61 | void optionsSelected(); | 75 | signals: |
62 | void installSelected(); | 76 | void reloadData( InstallDlgImpl * ); |
77 | |||
78 | public slots: | ||
79 | void optionsSelected(); | ||
80 | void installSelected(); | ||
63 | void displayText(const QString &text ); | 81 | void displayText(const QString &text ); |
64 | void displayAvailableSpace( const QString &text); | 82 | void displayAvailableSpace( const QString &text); |
65 | }; | 83 | }; |
66 | 84 | ||
67 | #endif | 85 | #endif |
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index a25f5a7..947aace 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -42,12 +42,13 @@ | |||
42 | 42 | ||
43 | #include "categoryfilterimpl.h" | 43 | #include "categoryfilterimpl.h" |
44 | #include "datamgr.h" | 44 | #include "datamgr.h" |
45 | #include "global.h" | 45 | #include "global.h" |
46 | #include "helpwindow.h" | 46 | #include "helpwindow.h" |
47 | #include "inputdlg.h" | 47 | #include "inputdlg.h" |
48 | #include "ipkg.h" | ||
48 | #include "installdlgimpl.h" | 49 | #include "installdlgimpl.h" |
49 | #include "letterpushbutton.h" | 50 | #include "letterpushbutton.h" |
50 | #include "mainwin.h" | 51 | #include "mainwin.h" |
51 | #include "settingsimpl.h" | 52 | #include "settingsimpl.h" |
52 | #include "utils.h" | 53 | #include "utils.h" |
53 | 54 | ||
@@ -85,30 +86,21 @@ MainWindow :: MainWindow() | |||
85 | addToolBar( jumpBar, QMainWindow::Top, true ); | 86 | addToolBar( jumpBar, QMainWindow::Top, true ); |
86 | jumpBar->setHorizontalStretchable( true ); | 87 | jumpBar->setHorizontalStretchable( true ); |
87 | QWidget *w = new QWidget( jumpBar ); | 88 | QWidget *w = new QWidget( jumpBar ); |
88 | jumpBar->setStretchableWidget( w ); | 89 | jumpBar->setStretchableWidget( w ); |
89 | 90 | ||
90 | QGridLayout *layout = new QGridLayout( w ); | 91 | QGridLayout *layout = new QGridLayout( w ); |
91 | //QVBoxLayout *vbox = new QVBoxLayout( w, 0, -1 ); | ||
92 | //QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 ); | ||
93 | //QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 ); | ||
94 | 92 | ||
95 | char text[2]; | 93 | char text[2]; |
96 | text[1] = '\0'; | 94 | text[1] = '\0'; |
97 | for ( int i = 0 ; i < 26 ; ++i ) | 95 | for ( int i = 0 ; i < 26 ; ++i ) |
98 | { | 96 | { |
99 | text[0] = 'A' + i; | 97 | text[0] = 'A' + i; |
100 | LetterPushButton *b = new LetterPushButton( text, w ); | 98 | LetterPushButton *b = new LetterPushButton( text, w ); |
101 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | 99 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); |
102 | layout->addWidget( b, i / 13, i % 13); | 100 | layout->addWidget( b, i / 13, i % 13); |
103 | /* | ||
104 | if ( i < 13 ) | ||
105 | hbox3->addWidget( b ); | ||
106 | else | ||
107 | hbox4->addWidget( b ); | ||
108 | */ | ||
109 | } | 101 | } |
110 | 102 | ||
111 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); | 103 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); |
112 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); | 104 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); |
113 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); | 105 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); |
114 | a->addTo( jumpBar ); | 106 | a->addTo( jumpBar ); |
@@ -795,19 +787,19 @@ void MainWindow :: updateServer() | |||
795 | 787 | ||
796 | // Disable buttons to stop silly people clicking lots on them :) | 788 | // Disable buttons to stop silly people clicking lots on them :) |
797 | 789 | ||
798 | // First, write out ipkg_conf file so that ipkg can use it | 790 | // First, write out ipkg_conf file so that ipkg can use it |
799 | mgr->writeOutIpkgConf(); | 791 | mgr->writeOutIpkgConf(); |
800 | 792 | ||
801 | Ipkg ipkg; | 793 | Ipkg *ipkg = new Ipkg; |
802 | ipkg.setOption( "update" ); | 794 | ipkg->setOption( "update" ); |
803 | |||
804 | InstallDlgImpl dlg( &ipkg, tr( "Refreshing server package lists" ), this, tr( "Upgrade" ), true ); | ||
805 | dlg.showDlg(); | ||
806 | 795 | ||
807 | reloadData(); | 796 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), |
797 | tr( "Update lists" ) ); | ||
798 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | ||
799 | dlg->showMaximized(); | ||
808 | 800 | ||
809 | // delete progDlg; | 801 | // delete progDlg; |
810 | } | 802 | } |
811 | 803 | ||
812 | void MainWindow :: upgradePackages() | 804 | void MainWindow :: upgradePackages() |
813 | { | 805 | { |
@@ -824,22 +816,23 @@ void MainWindow :: upgradePackages() | |||
824 | if ( warn.exec() == QMessageBox::Yes ) | 816 | if ( warn.exec() == QMessageBox::Yes ) |
825 | { | 817 | { |
826 | // First, write out ipkg_conf file so that ipkg can use it | 818 | // First, write out ipkg_conf file so that ipkg can use it |
827 | mgr->writeOutIpkgConf(); | 819 | mgr->writeOutIpkgConf(); |
828 | 820 | ||
829 | // Now run upgrade | 821 | // Now run upgrade |
830 | Ipkg ipkg; | 822 | Ipkg *ipkg = new Ipkg; |
831 | ipkg.setOption( "upgrade" ); | 823 | ipkg->setOption( "upgrade" ); |
832 | |||
833 | InstallDlgImpl dlg( &ipkg, tr( "Upgrading installed packages" ), this, tr( "Upgrade" ), true ); | ||
834 | dlg.showDlg(); | ||
835 | 824 | ||
836 | reloadData(); | 825 | InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), |
826 | tr ( "Upgrade" ) ); | ||
827 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); | ||
828 | dlg->showMaximized(); | ||
837 | } | 829 | } |
838 | } | 830 | } |
839 | void MainWindow :: downloadPackage() | 831 | |
832 | void MainWindow :: downloadPackage() | ||
840 | { | 833 | { |
841 | bool doUpdate = true; | 834 | bool doUpdate = true; |
842 | if ( downloadEnabled ) | 835 | if ( downloadEnabled ) |
843 | { | 836 | { |
844 | // See if any packages are selected | 837 | // See if any packages are selected |
845 | bool found = false; | 838 | bool found = false; |
@@ -895,13 +888,13 @@ void MainWindow :: upgradePackages() | |||
895 | } | 888 | } |
896 | } | 889 | } |
897 | } | 890 | } |
898 | 891 | ||
899 | if ( doUpdate ) | 892 | if ( doUpdate ) |
900 | { | 893 | { |
901 | reloadData(); | 894 | reloadData( 0x0 ); |
902 | } | 895 | } |
903 | } | 896 | } |
904 | 897 | ||
905 | void MainWindow :: downloadSelectedPackages() | 898 | void MainWindow :: downloadSelectedPackages() |
906 | { | 899 | { |
907 | // First, write out ipkg_conf file so that ipkg can use it | 900 | // First, write out ipkg_conf file so that ipkg can use it |
@@ -967,23 +960,15 @@ void MainWindow :: downloadRemotePackage() | |||
967 | InstallData item; | 960 | InstallData item; |
968 | item.option = "I"; | 961 | item.option = "I"; |
969 | item.packageName = package; | 962 | item.packageName = package; |
970 | vector<InstallData> workingPackages; | 963 | vector<InstallData> workingPackages; |
971 | workingPackages.push_back( item ); | 964 | workingPackages.push_back( item ); |
972 | 965 | ||
973 | InstallDlgImpl dlg2( workingPackages, mgr, this, "Install", true ); | 966 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); |
974 | dlg2.showDlg(); | 967 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
975 | 968 | dlg->showMaximized(); | |
976 | reloadData(); | ||
977 | |||
978 | #ifdef QWS | ||
979 | // Finally let the main system update itself | ||
980 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
981 | QString lf = QString::null; | ||
982 | e << lf; | ||
983 | #endif | ||
984 | } | 969 | } |
985 | 970 | ||
986 | 971 | ||
987 | void MainWindow :: applyChanges() | 972 | void MainWindow :: applyChanges() |
988 | { | 973 | { |
989 | stickyOption = ""; | 974 | stickyOption = ""; |
@@ -1013,23 +998,15 @@ void MainWindow :: applyChanges() | |||
1013 | tr( "No packages selected" ), tr( "OK" ) ); | 998 | tr( "No packages selected" ), tr( "OK" ) ); |
1014 | 999 | ||
1015 | return; | 1000 | return; |
1016 | } | 1001 | } |
1017 | 1002 | ||
1018 | // do the stuff | 1003 | // do the stuff |
1019 | InstallDlgImpl dlg( workingPackages, mgr, this, "Install", true ); | 1004 | InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); |
1020 | dlg.showDlg(); | 1005 | connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); |
1021 | 1006 | dlg->showMaximized(); | |
1022 | reloadData(); | ||
1023 | |||
1024 | #ifdef QWS | ||
1025 | // Finally let the main system update itself | ||
1026 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
1027 | QString lf = QString::null; | ||
1028 | e << lf; | ||
1029 | #endif | ||
1030 | } | 1007 | } |
1031 | 1008 | ||
1032 | // decide what to do - either remove, upgrade or install | 1009 | // decide what to do - either remove, upgrade or install |
1033 | // Current rules: | 1010 | // Current rules: |
1034 | // If not installed - install | 1011 | // If not installed - install |
1035 | // If installed and different version available - upgrade | 1012 | // If installed and different version available - upgrade |
@@ -1147,17 +1124,34 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1147 | 1124 | ||
1148 | // User hit cancel (on dlg - assume remove) | 1125 | // User hit cancel (on dlg - assume remove) |
1149 | return item; | 1126 | return item; |
1150 | } | 1127 | } |
1151 | } | 1128 | } |
1152 | 1129 | ||
1153 | void MainWindow :: reloadData() | 1130 | void MainWindow :: reloadData( InstallDlgImpl *dlg ) |
1154 | { | 1131 | { |
1155 | stack->raiseWidget( progressWindow ); | 1132 | stack->raiseWidget( progressWindow ); |
1133 | |||
1134 | if ( dlg ) | ||
1135 | { | ||
1136 | dlg->close(); | ||
1137 | delete dlg; | ||
1138 | } | ||
1139 | |||
1156 | mgr->reloadServerData(); | 1140 | mgr->reloadServerData(); |
1157 | serverSelected( -1, FALSE ); | 1141 | serverSelected( -1, FALSE ); |
1142 | |||
1143 | #ifdef QWS | ||
1144 | m_status->setText( tr( "Updating Launcher..." ) ); | ||
1145 | |||
1146 | // Finally let the main system update itself | ||
1147 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
1148 | QString lf = QString::null; | ||
1149 | e << lf; | ||
1150 | #endif | ||
1151 | |||
1158 | stack->raiseWidget( networkPkgWindow ); | 1152 | stack->raiseWidget( networkPkgWindow ); |
1159 | } | 1153 | } |
1160 | 1154 | ||
1161 | void MainWindow :: letterPushed( QString t ) | 1155 | void MainWindow :: letterPushed( QString t ) |
1162 | { | 1156 | { |
1163 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); | 1157 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index b49c819..d0777fb 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -20,12 +20,13 @@ | |||
20 | 20 | ||
21 | #include <qmainwindow.h> | 21 | #include <qmainwindow.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | 23 | ||
24 | class DataManager; | 24 | class DataManager; |
25 | class InstallData; | 25 | class InstallData; |
26 | class InstallDlgImpl; | ||
26 | 27 | ||
27 | class QAction; | 28 | class QAction; |
28 | class QCheckListItem; | 29 | class QCheckListItem; |
29 | class QComboBox; | 30 | class QComboBox; |
30 | class QLabel; | 31 | class QLabel; |
31 | class QLineEdit; | 32 | class QLineEdit; |
@@ -89,13 +90,12 @@ private: | |||
89 | void serverSelected( int index, bool showProgress ); | 90 | void serverSelected( int index, bool showProgress ); |
90 | void searchForPackage( const QString & ); | 91 | void searchForPackage( const QString & ); |
91 | bool filterByCategory( bool val ); | 92 | bool filterByCategory( bool val ); |
92 | void downloadSelectedPackages(); | 93 | void downloadSelectedPackages(); |
93 | void downloadRemotePackage(); | 94 | void downloadRemotePackage(); |
94 | InstallData dealWithItem( QCheckListItem *item ); | 95 | InstallData dealWithItem( QCheckListItem *item ); |
95 | void reloadData(); | ||
96 | 96 | ||
97 | // Progress widget | 97 | // Progress widget |
98 | QWidget *progressWindow; | 98 | QWidget *progressWindow; |
99 | QLabel *m_status; | 99 | QLabel *m_status; |
100 | QProgressBar *m_progress; | 100 | QProgressBar *m_progress; |
101 | 101 | ||
@@ -118,12 +118,13 @@ public slots: | |||
118 | void filterCategory(); | 118 | void filterCategory(); |
119 | bool setFilterCategory(); | 119 | bool setFilterCategory(); |
120 | void raiseMainWidget(); | 120 | void raiseMainWidget(); |
121 | void raiseProgressWidget(); | 121 | void raiseProgressWidget(); |
122 | void enableUpgrade( bool ); | 122 | void enableUpgrade( bool ); |
123 | void enableDownload( bool ); | 123 | void enableDownload( bool ); |
124 | void reloadData( InstallDlgImpl * ); | ||
124 | 125 | ||
125 | private slots: | 126 | private slots: |
126 | void init(); | 127 | void init(); |
127 | void setProgressSteps( int ); | 128 | void setProgressSteps( int ); |
128 | void setProgressMessage( const QString & ); | 129 | void setProgressMessage( const QString & ); |
129 | void updateProgress( int ); | 130 | void updateProgress( int ); |