author | tille <tille> | 2002-04-28 01:35:36 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-28 01:35:36 (UTC) |
commit | 61cc74e0e4602d0df07b250f2786f0f0e96da28f (patch) (unidiff) | |
tree | 7fab7d278163082856f0561ec9e451922f6066e3 | |
parent | a64cc0ad0574ae1e15c4965d2557c3e06cc3fd65 (diff) | |
download | opie-61cc74e0e4602d0df07b250f2786f0f0e96da28f.zip opie-61cc74e0e4602d0df07b250f2786f0f0e96da28f.tar.gz opie-61cc74e0e4602d0df07b250f2786f0f0e96da28f.tar.bz2 |
gui fixes
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 16 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 24 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 1 |
5 files changed, 33 insertions, 14 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 6bf9a7a..c95f482 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,357 +1,371 @@ | |||
1 | // adadpted form qpe/qipkg | 1 | // adadpted form qpe/qipkg |
2 | 2 | ||
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | 5 | ||
6 | #include <qpe/qpemenubar.h> | 6 | #include <qpe/qpemenubar.h> |
7 | #include <qpe/qpemessagebox.h> | 7 | #include <qpe/qpemessagebox.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/qpetoolbar.h> | 9 | #include <qpe/qpetoolbar.h> |
10 | #include <qpe/qcopenvelope_qws.h> | 10 | #include <qpe/qcopenvelope_qws.h> |
11 | #include <qaction.h> | 11 | #include <qaction.h> |
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | #include <qpopupmenu.h> | 13 | #include <qpopupmenu.h> |
14 | #include <qtoolbutton.h> | 14 | #include <qtoolbutton.h> |
15 | #include <qstring.h> | 15 | #include <qstring.h> |
16 | #include <qlabel.h> | 16 | #include <qlabel.h> |
17 | #include <qfile.h> | 17 | #include <qfile.h> |
18 | #include <qlistview.h> | 18 | #include <qlistview.h> |
19 | #include <qtextview.h> | 19 | #include <qtextview.h> |
20 | #include <qlineedit.h> | 20 | #include <qlineedit.h> |
21 | #include <qtabwidget.h> | 21 | #include <qtabwidget.h> |
22 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
23 | #include <qmessagebox.h> | ||
23 | #include <qlayout.h> | 24 | #include <qlayout.h> |
24 | 25 | ||
25 | #include "pksettingsbase.h" | 26 | #include "pksettingsbase.h" |
26 | #include "packagelistitem.h" | 27 | #include "packagelistitem.h" |
27 | 28 | ||
29 | |||
28 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 30 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : |
29 | QMainWindow( parent, name, f ) | 31 | QMainWindow( parent, name, f ) |
30 | { | 32 | { |
31 | settings = new PackageManagerSettings(this,0,TRUE); | 33 | settings = new PackageManagerSettings(this,0,TRUE); |
32 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | 34 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); |
33 | ipkg = new PmIpkg( settings, this ); | 35 | ipkg = new PmIpkg( settings, this ); |
34 | 36 | ||
35 | setCentralWidget( listViewPackages ); | 37 | setCentralWidget( listViewPackages ); |
36 | setCaption( tr("Package Manager") ); | 38 | setCaption( tr("Package Manager") ); |
37 | 39 | ||
40 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); | ||
41 | wait = new QMessageBox(this); | ||
42 | wait->setText(tr("Please wait")); | ||
43 | |||
38 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | 44 | channel = new QCopChannel( "QPE/Application/oipkg", this ); |
39 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 45 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
40 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 46 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
41 | 47 | ||
42 | makeMenu(); | 48 | makeMenu(); |
43 | 49 | ||
44 | connect( section, SIGNAL( activated(int) ), | 50 | connect( section, SIGNAL( activated(int) ), |
45 | this, SLOT( sectionChanged() ) ); | 51 | this, SLOT( sectionChanged() ) ); |
46 | connect( subsection, SIGNAL(activated(int) ), | 52 | connect( subsection, SIGNAL(activated(int) ), |
47 | this, SLOT( subSectionChanged() ) ); | 53 | this, SLOT( subSectionChanged() ) ); |
48 | 54 | ||
49 | ipkg = new PmIpkg( settings, this ); | 55 | ipkg = new PmIpkg( settings, this ); |
50 | packageList.setSettings( settings ); | 56 | packageList.setSettings( settings ); |
51 | getList(); | 57 | getList(); |
52 | setSections(); | 58 | setSections(); |
53 | setSubSections(); | 59 | setSubSections(); |
54 | displayList(); | 60 | displayList(); |
55 | } | 61 | } |
56 | 62 | ||
57 | void MainWindow::makeMenu() | 63 | void MainWindow::makeMenu() |
58 | { | 64 | { |
59 | 65 | ||
60 | QPEToolBar *toolBar = new QPEToolBar( this ); | 66 | QPEToolBar *toolBar = new QPEToolBar( this ); |
61 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 67 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
62 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 68 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
63 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 69 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
64 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 70 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
65 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 71 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
66 | 72 | ||
67 | setToolBarsMovable( false ); | 73 | setToolBarsMovable( false ); |
68 | toolBar->setHorizontalStretchable( true ); | 74 | toolBar->setHorizontalStretchable( true ); |
69 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 75 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
70 | menuBar->insertItem( tr( "View" ), viewMenu ); | 76 | menuBar->insertItem( tr( "View" ), viewMenu ); |
71 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 77 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
72 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 78 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
73 | 79 | ||
74 | QLabel *spacer = new QLabel( "", toolBar ); | 80 | QLabel *spacer = new QLabel( "", toolBar ); |
75 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 81 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
76 | toolBar->setStretchableWidget( spacer ); | 82 | toolBar->setStretchableWidget( spacer ); |
77 | 83 | ||
78 | 84 | ||
79 | runAction = new QAction( tr( "Apply" ), | 85 | runAction = new QAction( tr( "Apply" ), |
80 | Resource::loadPixmap( "oipkg/install" ), | 86 | Resource::loadPixmap( "oipkg/install" ), |
81 | QString::null, 0, this, 0 ); | 87 | QString::null, 0, this, 0 ); |
82 | connect( runAction, SIGNAL( activated() ), | 88 | connect( runAction, SIGNAL( activated() ), |
83 | this, SLOT( runIpkg() ) ); | 89 | this, SLOT( runIpkg() ) ); |
84 | runAction->addTo( toolBar ); | 90 | runAction->addTo( toolBar ); |
85 | runAction->addTo( srvMenu ); | 91 | runAction->addTo( srvMenu ); |
86 | 92 | ||
87 | srvMenu->insertSeparator (); | 93 | srvMenu->insertSeparator (); |
88 | 94 | ||
89 | updateAction = new QAction( tr( "Update" ), | 95 | updateAction = new QAction( tr( "Update" ), |
90 | Resource::loadIconSet( "oipkg/update" ), | 96 | Resource::loadIconSet( "oipkg/update" ), |
91 | QString::null, 0, this, 0 ); | 97 | QString::null, 0, this, 0 ); |
92 | connect( updateAction, SIGNAL( activated() ), | 98 | connect( updateAction, SIGNAL( activated() ), |
93 | this , SLOT( updateList() ) ); | 99 | this , SLOT( updateList() ) ); |
94 | updateAction->addTo( toolBar ); | 100 | updateAction->addTo( toolBar ); |
95 | updateAction->addTo( srvMenu ); | 101 | updateAction->addTo( srvMenu ); |
96 | 102 | ||
97 | // would we use for find | 103 | // would we use for find |
98 | // detailsAction = new QAction( tr( "Details" ), | 104 | // detailsAction = new QAction( tr( "Details" ), |
99 | // Resource::loadIconSet( "find" ), | 105 | // Resource::loadIconSet( "find" ), |
100 | // QString::null, 0, this, 0 ); | 106 | // QString::null, 0, this, 0 ); |
101 | // connect( detailsAction, SIGNAL( activated() ), | 107 | // connect( detailsAction, SIGNAL( activated() ), |
102 | // this , SLOT( showDetails() ) ); | 108 | // this , SLOT( showDetails() ) ); |
103 | // detailsAction->addTo( toolBar ); | 109 | // detailsAction->addTo( toolBar ); |
104 | // detailsAction->addTo( srvMenu ); | 110 | // detailsAction->addTo( srvMenu ); |
105 | 111 | ||
106 | QAction *cfgact; | 112 | QAction *cfgact; |
107 | 113 | ||
108 | cfgact = new QAction( tr( "Setups" ), | 114 | cfgact = new QAction( tr( "Setups" ), |
109 | // Resource::loadIconSet( "" ), | 115 | // Resource::loadIconSet( "" ), |
110 | QString::null, 0, this, 0 ); | 116 | QString::null, 0, this, 0 ); |
111 | connect( cfgact, SIGNAL( activated() ), | 117 | connect( cfgact, SIGNAL( activated() ), |
112 | SLOT( showSettings() ) ); | 118 | SLOT( showSettings() ) ); |
113 | cfgact->addTo( cfgMenu ); | 119 | cfgact->addTo( cfgMenu ); |
114 | 120 | ||
115 | cfgact = new QAction( tr( "Servers" ), | 121 | cfgact = new QAction( tr( "Servers" ), |
116 | // Resource::loadIconSet( "" ), | 122 | // Resource::loadIconSet( "" ), |
117 | QString::null, 0, this, 0 ); | 123 | QString::null, 0, this, 0 ); |
118 | connect( cfgact, SIGNAL( activated() ), | 124 | connect( cfgact, SIGNAL( activated() ), |
119 | SLOT( showSettingsSrv() ) ); | 125 | SLOT( showSettingsSrv() ) ); |
120 | cfgact->addTo( cfgMenu ); | 126 | cfgact->addTo( cfgMenu ); |
121 | cfgact = new QAction( tr( "Destinations" ), | 127 | cfgact = new QAction( tr( "Destinations" ), |
122 | //Resource::loadIconSet( "" ), | 128 | //Resource::loadIconSet( "" ), |
123 | QString::null, 0, this, 0 ); | 129 | QString::null, 0, this, 0 ); |
124 | connect( cfgact, SIGNAL( activated() ), | 130 | connect( cfgact, SIGNAL( activated() ), |
125 | SLOT( showSettingsDst() ) ); | 131 | SLOT( showSettingsDst() ) ); |
126 | cfgact->addTo( cfgMenu ); | 132 | cfgact->addTo( cfgMenu ); |
127 | 133 | ||
128 | QAction *a; | 134 | QAction *a; |
129 | 135 | ||
130 | sectionBar = new QPEToolBar( this ); | 136 | sectionBar = new QPEToolBar( this ); |
131 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 137 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
132 | sectionBar->setHorizontalStretchable( true ); | 138 | sectionBar->setHorizontalStretchable( true ); |
133 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 139 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
134 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 140 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
135 | sectionBar->setStretchableWidget( label ); | 141 | sectionBar->setStretchableWidget( label ); |
136 | section = new QComboBox( false, sectionBar ); | 142 | section = new QComboBox( false, sectionBar ); |
137 | // section->setBackgroundMode( PaletteBackground ); | 143 | // section->setBackgroundMode( PaletteBackground ); |
138 | label = new QLabel( " / ", sectionBar ); | 144 | label = new QLabel( " / ", sectionBar ); |
139 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 145 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
140 | subsection = new QComboBox( false, sectionBar ); | 146 | subsection = new QComboBox( false, sectionBar ); |
141 | 147 | ||
142 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 148 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
143 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 149 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
144 | a->addTo( sectionBar ); | 150 | a->addTo( sectionBar ); |
145 | 151 | ||
146 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 152 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
147 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 153 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
148 | sectionAction->setToggleAction( true ); | 154 | sectionAction->setToggleAction( true ); |
149 | sectionAction->setOn( true ); | 155 | sectionAction->setOn( true ); |
150 | sectionAction->addTo( viewMenu ); | 156 | sectionAction->addTo( viewMenu ); |
151 | 157 | ||
152 | findBar = new QPEToolBar(this); | 158 | findBar = new QPEToolBar(this); |
153 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); | 159 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); |
154 | label = new QLabel( tr("Filter: "), findBar ); | 160 | label = new QLabel( tr("Filter: "), findBar ); |
155 | label->setBackgroundColor( findBar->backgroundColor() ); | 161 | label->setBackgroundColor( findBar->backgroundColor() ); |
156 | findBar->setHorizontalStretchable( TRUE ); | 162 | findBar->setHorizontalStretchable( TRUE ); |
157 | findEdit = new QLineEdit( findBar, "findEdit" ); | 163 | findEdit = new QLineEdit( findBar, "findEdit" ); |
158 | findBar->setStretchableWidget( findEdit ); | 164 | findBar->setStretchableWidget( findEdit ); |
159 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 165 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
160 | this, SLOT( displayList() ) ); | 166 | this, SLOT( displayList() ) ); |
161 | 167 | ||
162 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 168 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
163 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 169 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
164 | a->addTo( findBar ); | 170 | a->addTo( findBar ); |
165 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); | 171 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); |
166 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 172 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
167 | findAction->setToggleAction( true ); | 173 | findAction->setToggleAction( true ); |
168 | findAction->setOn( true ); | 174 | findAction->setOn( true ); |
169 | findAction->addTo( viewMenu ); | 175 | findAction->addTo( viewMenu ); |
170 | 176 | ||
171 | #ifdef NEW | 177 | #ifdef NEW |
172 | Config cfg( "oipkg", Config::User ); | 178 | Config cfg( "oipkg", Config::User ); |
173 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | 179 | cfg.setGroup( "Setting_" + QString::number( setting ) ); |
174 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); | 180 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); |
175 | findShow(bool b) | 181 | findShow(bool b) |
176 | sectionShow(bool b) | 182 | sectionShow(bool b) |
177 | #endif | 183 | #endif |
178 | } | 184 | } |
179 | 185 | ||
180 | MainWindow::~MainWindow() | 186 | MainWindow::~MainWindow() |
181 | { | 187 | { |
182 | } | 188 | } |
183 | 189 | ||
184 | void MainWindow::runIpkg() | 190 | void MainWindow::runIpkg() |
185 | { | 191 | { |
186 | ipkg->commit( packageList ); | 192 | ipkg->commit( packageList ); |
187 | // ##### If we looked in the list of files, we could send out accurate | 193 | // ##### If we looked in the list of files, we could send out accurate |
188 | // ##### messages. But we don't bother yet, and just do an "all". | 194 | // ##### messages. But we don't bother yet, and just do an "all". |
189 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 195 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
190 | QString lf = QString::null; | 196 | QString lf = QString::null; |
191 | e << lf; | 197 | e << lf; |
192 | displayList(); | 198 | displayList(); |
193 | } | 199 | } |
194 | 200 | ||
195 | void MainWindow::updateList() | 201 | void MainWindow::updateList() |
196 | { | 202 | { |
203 | wait->show(); | ||
197 | QTimer *t = new QTimer( this ); | 204 | QTimer *t = new QTimer( this ); |
198 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 205 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
199 | t->start( 0, false ); | 206 | t->start( 0, false ); |
200 | packageList.clear(); | 207 | packageList.clear(); |
201 | ipkg->update(); | 208 | ipkg->update(); |
202 | getList(); | 209 | getList(); |
203 | t->stop(); | 210 | t->stop(); |
211 | wait->hide(); | ||
212 | |||
204 | } | 213 | } |
205 | 214 | ||
206 | void MainWindow::getList() | 215 | void MainWindow::getList() |
207 | { | 216 | { |
217 | wait->show(); | ||
208 | packageList.update(); | 218 | packageList.update(); |
209 | displayList(); | 219 | displayList(); |
220 | wait->hide(); | ||
210 | } | 221 | } |
211 | 222 | ||
212 | void MainWindow::filterList() | 223 | void MainWindow::filterList() |
213 | { | 224 | { |
225 | wait->show(); | ||
214 | QString f = ""; | 226 | QString f = ""; |
215 | if ( findAction->isOn() ) f = findEdit->text(); | 227 | if ( findAction->isOn() ) f = findEdit->text(); |
216 | packageList.filterPackages( f ); | 228 | packageList.filterPackages( f ); |
229 | wait->hide(); | ||
217 | } | 230 | } |
218 | 231 | ||
219 | void MainWindow::displayList() | 232 | void MainWindow::displayList() |
220 | { | 233 | { |
234 | wait->hide(); | ||
221 | filterList(); | 235 | filterList(); |
222 | listViewPackages->clear(); | 236 | listViewPackages->clear(); |
223 | Package *pack = packageList.first(); | 237 | Package *pack = packageList.first(); |
224 | while( pack ) | 238 | while( pack ) |
225 | { | 239 | { |
226 | if ( pack && (pack->name() != "") ) | 240 | if ( pack && (pack->name() != "") ) |
227 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); | 241 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); |
228 | pack = packageList.next(); | 242 | pack = packageList.next(); |
229 | } | 243 | } |
230 | } | 244 | } |
231 | 245 | ||
232 | void MainWindow::sectionChanged() | 246 | void MainWindow::sectionChanged() |
233 | { | 247 | { |
234 | disconnect( section, SIGNAL( activated(int) ), | 248 | disconnect( section, SIGNAL( activated(int) ), |
235 | this, SLOT( sectionChanged() ) ); | 249 | this, SLOT( sectionChanged() ) ); |
236 | disconnect( subsection, SIGNAL(activated(int) ), | 250 | disconnect( subsection, SIGNAL(activated(int) ), |
237 | this, SLOT( subSectionChanged() ) ); | 251 | this, SLOT( subSectionChanged() ) ); |
238 | subsection->clear(); | 252 | subsection->clear(); |
239 | packageList.setSection( section->currentText() ); | 253 | packageList.setSection( section->currentText() ); |
240 | setSubSections(); | 254 | setSubSections(); |
241 | connect( section, SIGNAL( activated(int) ), | 255 | connect( section, SIGNAL( activated(int) ), |
242 | this, SLOT( sectionChanged() ) ); | 256 | this, SLOT( sectionChanged() ) ); |
243 | connect( subsection, SIGNAL(activated(int) ), | 257 | connect( subsection, SIGNAL(activated(int) ), |
244 | this, SLOT( subSectionChanged() ) ); | 258 | this, SLOT( subSectionChanged() ) ); |
245 | displayList(); | 259 | displayList(); |
246 | } | 260 | } |
247 | 261 | ||
248 | void MainWindow::subSectionChanged() | 262 | void MainWindow::subSectionChanged() |
249 | { | 263 | { |
250 | disconnect( section, SIGNAL( activated(int) ), | 264 | disconnect( section, SIGNAL( activated(int) ), |
251 | this, SLOT( sectionChanged() ) ); | 265 | this, SLOT( sectionChanged() ) ); |
252 | disconnect( subsection, SIGNAL(activated(int) ), | 266 | disconnect( subsection, SIGNAL(activated(int) ), |
253 | this, SLOT( subSectionChanged() ) ); | 267 | this, SLOT( subSectionChanged() ) ); |
254 | packageList.setSubSection( subsection->currentText() ); | 268 | packageList.setSubSection( subsection->currentText() ); |
255 | connect( section, SIGNAL( activated(int) ), | 269 | connect( section, SIGNAL( activated(int) ), |
256 | this, SLOT( sectionChanged() ) ); | 270 | this, SLOT( sectionChanged() ) ); |
257 | connect( subsection, SIGNAL(activated(int) ), | 271 | connect( subsection, SIGNAL(activated(int) ), |
258 | this, SLOT( subSectionChanged() ) ); | 272 | this, SLOT( subSectionChanged() ) ); |
259 | displayList(); | 273 | displayList(); |
260 | } | 274 | } |
261 | 275 | ||
262 | void MainWindow::setSections() | 276 | void MainWindow::setSections() |
263 | { | 277 | { |
264 | section->clear(); | 278 | section->clear(); |
265 | section->insertStringList( packageList.getSections() ); | 279 | section->insertStringList( packageList.getSections() ); |
266 | } | 280 | } |
267 | 281 | ||
268 | void MainWindow::setSubSections() | 282 | void MainWindow::setSubSections() |
269 | { | 283 | { |
270 | subsection->clear(); | 284 | subsection->clear(); |
271 | subsection->insertStringList( packageList.getSubSections() ); | 285 | subsection->insertStringList( packageList.getSubSections() ); |
272 | } | 286 | } |
273 | 287 | ||
274 | 288 | ||
275 | void MainWindow::showSettings() | 289 | void MainWindow::showSettings() |
276 | { | 290 | { |
277 | if ( settings->showDialog( 0 ) ) | 291 | if ( settings->showDialog( 0 ) ) |
278 | updateList(); | 292 | updateList(); |
279 | } | 293 | } |
280 | void MainWindow::showSettingsSrv() | 294 | void MainWindow::showSettingsSrv() |
281 | { | 295 | { |
282 | if ( settings->showDialog( 1 ) ) | 296 | if ( settings->showDialog( 1 ) ) |
283 | updateList(); | 297 | updateList(); |
284 | } | 298 | } |
285 | void MainWindow::showSettingsDst() | 299 | void MainWindow::showSettingsDst() |
286 | { | 300 | { |
287 | if ( settings->showDialog( 2 ) ) | 301 | if ( settings->showDialog( 2 ) ) |
288 | updateList(); | 302 | updateList(); |
289 | } | 303 | } |
290 | 304 | ||
291 | void MainWindow::sectionShow(bool b) | 305 | void MainWindow::sectionShow(bool b) |
292 | { | 306 | { |
293 | if (b) sectionBar->show(); | 307 | if (b) sectionBar->show(); |
294 | else sectionBar->hide(); | 308 | else sectionBar->hide(); |
295 | sectionAction->setOn( b ); | 309 | sectionAction->setOn( b ); |
296 | } | 310 | } |
297 | 311 | ||
298 | void MainWindow::sectionClose() | 312 | void MainWindow::sectionClose() |
299 | { | 313 | { |
300 | sectionAction->setOn( false ); | 314 | sectionAction->setOn( false ); |
301 | } | 315 | } |
302 | 316 | ||
303 | void MainWindow::findShow(bool b) | 317 | void MainWindow::findShow(bool b) |
304 | { | 318 | { |
305 | if (b) findBar->show(); | 319 | if (b) findBar->show(); |
306 | else findBar->hide(); | 320 | else findBar->hide(); |
307 | findAction->setOn( b ); | 321 | findAction->setOn( b ); |
308 | } | 322 | } |
309 | 323 | ||
310 | void MainWindow::findClose() | 324 | void MainWindow::findClose() |
311 | { | 325 | { |
312 | findAction->setOn( false ); | 326 | findAction->setOn( false ); |
313 | } | 327 | } |
314 | 328 | ||
315 | void MainWindow::rotateUpdateIcon() | 329 | void MainWindow::rotateUpdateIcon() |
316 | { | 330 | { |
317 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 331 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
318 | if ( updateIcon ) | 332 | if ( updateIcon ) |
319 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 333 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
320 | else | 334 | else |
321 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 335 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
322 | updateIcon = !updateIcon; | 336 | updateIcon = !updateIcon; |
323 | } | 337 | } |
324 | 338 | ||
325 | 339 | ||
326 | void MainWindow::setDocument(const QString &fileName) | 340 | void MainWindow::setDocument(const QString &fileName) |
327 | { | 341 | { |
328 | installFile(fileName); | 342 | installFile(fileName); |
329 | // ##### If we looked in the list of files, we could send out accurate | 343 | // ##### If we looked in the list of files, we could send out accurate |
330 | // ##### messages. But we don't bother yet, and just do an "all". | 344 | // ##### messages. But we don't bother yet, and just do an "all". |
331 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 345 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
332 | QString lf = QString::null; | 346 | QString lf = QString::null; |
333 | e << lf; | 347 | e << lf; |
334 | displayList(); | 348 | displayList(); |
335 | } | 349 | } |
336 | 350 | ||
337 | void MainWindow::installFile(const QString &fileName) | 351 | void MainWindow::installFile(const QString &fileName) |
338 | { | 352 | { |
339 | pvDebug(3, "MainWindow::installFile "+fileName); | 353 | pvDebug(3, "MainWindow::installFile "+fileName); |
340 | if ( !QFile::exists( fileName ) ) return; | 354 | if ( !QFile::exists( fileName ) ) return; |
341 | ipkg->installFile( fileName ); | 355 | ipkg->installFile( fileName ); |
342 | // ##### If we looked in the list of files, we could send out accurate | 356 | // ##### If we looked in the list of files, we could send out accurate |
343 | // ##### messages. But we don't bother yet, and just do an "all". | 357 | // ##### messages. But we don't bother yet, and just do an "all". |
344 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 358 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
345 | QString lf = QString::null; | 359 | QString lf = QString::null; |
346 | e << lf; | 360 | e << lf; |
347 | displayList(); | 361 | displayList(); |
348 | } | 362 | } |
349 | 363 | ||
350 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | 364 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) |
351 | { | 365 | { |
352 | pvDebug(3, "QCop "+msg); | 366 | pvDebug(3, "QCop "+msg); |
353 | if ( msg == "installFile(QString)" ) | 367 | if ( msg == "installFile(QString)" ) |
354 | { | 368 | { |
355 | installFile( QString(arg) ); | 369 | installFile( QString(arg) ); |
356 | } | 370 | } |
357 | } \ No newline at end of file | 371 | } \ No newline at end of file |
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index bcb0cc9..a713d00 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -1,76 +1,78 @@ | |||
1 | #ifndef MAINWINDOW_H | 1 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 2 | #define MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qpopupmenu.h> | 7 | #include <qpopupmenu.h> |
8 | 8 | ||
9 | #include "packagelist.h" | 9 | #include "packagelist.h" |
10 | #include "pmipkg.h" | 10 | #include "pmipkg.h" |
11 | #include "pksettings.h" | 11 | #include "pksettings.h" |
12 | #include "packagelistview.h" | 12 | #include "packagelistview.h" |
13 | 13 | ||
14 | class QComboBox; | 14 | class QComboBox; |
15 | class QPEToolBar; | 15 | class QPEToolBar; |
16 | class QLineEdit; | 16 | class QLineEdit; |
17 | class PackageListItem; | 17 | class PackageListItem; |
18 | class QCopChannel; | 18 | class QCopChannel; |
19 | class QMessageBox; | ||
19 | 20 | ||
20 | class MainWindow : public QMainWindow | 21 | class MainWindow : public QMainWindow |
21 | { | 22 | { |
22 | Q_OBJECT | 23 | Q_OBJECT |
23 | 24 | ||
24 | 25 | ||
25 | public: | 26 | public: |
26 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 27 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
27 | ~MainWindow(); | 28 | ~MainWindow(); |
28 | 29 | ||
29 | QCopChannel *channel; | 30 | QCopChannel *channel; |
30 | 31 | ||
31 | protected slots: | 32 | protected slots: |
32 | void runIpkg(); | 33 | void runIpkg(); |
33 | void getList(); | 34 | void getList(); |
34 | void updateList(); | 35 | void updateList(); |
35 | void displayList(); | 36 | void displayList(); |
36 | void subSectionChanged(); | 37 | void subSectionChanged(); |
37 | void sectionChanged(); | 38 | void sectionChanged(); |
38 | void showSettings(); | 39 | void showSettings(); |
39 | void showSettingsSrv(); | 40 | void showSettingsSrv(); |
40 | void showSettingsDst(); | 41 | void showSettingsDst(); |
41 | 42 | ||
42 | public slots: | 43 | public slots: |
43 | void sectionClose(); | 44 | void sectionClose(); |
44 | void sectionShow(bool); | 45 | void sectionShow(bool); |
45 | void findClose(); | 46 | void findClose(); |
46 | void findShow(bool); | 47 | void findShow(bool); |
47 | void filterList(); | 48 | void filterList(); |
48 | void receive (const QCString &, const QByteArray &); | 49 | void receive (const QCString &, const QByteArray &); |
49 | void setDocument (const QString &); | 50 | void setDocument (const QString &); |
50 | 51 | ||
51 | private: | 52 | private: |
52 | void makeMenu(); | 53 | void makeMenu(); |
53 | void setSections(); | 54 | void setSections(); |
54 | void setSubSections(); | 55 | void setSubSections(); |
55 | void installFile(const QString &); | 56 | void installFile(const QString &); |
56 | bool updateIcon; | 57 | bool updateIcon; |
57 | 58 | ||
58 | PmIpkg* ipkg; | 59 | PmIpkg* ipkg; |
59 | PackageManagerSettings *settings; | 60 | PackageManagerSettings *settings; |
60 | PackageList packageList; | 61 | PackageList packageList; |
61 | QAction *runAction; | 62 | QAction *runAction; |
62 | QAction *detailsAction; | 63 | QAction *detailsAction; |
63 | QAction *updateAction; | 64 | QAction *updateAction; |
64 | QAction *findAction; | 65 | QAction *findAction; |
65 | QAction *sectionAction; | 66 | QAction *sectionAction; |
66 | PackageListView *listViewPackages; | 67 | PackageListView *listViewPackages; |
67 | QPEToolBar *findBar; | 68 | QPEToolBar *findBar; |
68 | QLineEdit *findEdit; | 69 | QLineEdit *findEdit; |
69 | QPEToolBar *sectionBar; | 70 | QPEToolBar *sectionBar; |
70 | QComboBox *section; | 71 | QComboBox *section; |
71 | QComboBox *subsection; | 72 | QComboBox *subsection; |
73 | QMessageBox *wait; | ||
72 | private slots: | 74 | private slots: |
73 | void rotateUpdateIcon(); | 75 | void rotateUpdateIcon(); |
74 | }; | 76 | }; |
75 | 77 | ||
76 | #endif | 78 | #endif |
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index f84a9c4..be01837 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp | |||
@@ -1,511 +1,511 @@ | |||
1 | #include "pksettings.h" | 1 | #include "pksettings.h" |
2 | 2 | ||
3 | #include <qpe/process.h> | 3 | #include <qpe/process.h> |
4 | #include <qpe/resource.h> | 4 | #include <qpe/resource.h> |
5 | #include <qpe/stringutil.h> | 5 | #include <qpe/stringutil.h> |
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | #include <qpe/qcopenvelope_qws.h> | 7 | #include <qpe/qcopenvelope_qws.h> |
8 | #include <qpe/applnk.h> | 8 | #include <qpe/applnk.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | 10 | ||
11 | #include <qprogressbar.h> | 11 | #include <qprogressbar.h> |
12 | #include <qcombobox.h> | 12 | #include <qcombobox.h> |
13 | #include <qdict.h> | 13 | #include <qdict.h> |
14 | #include <qfile.h> | 14 | #include <qfile.h> |
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
17 | #include <qlistview.h> | 17 | #include <qlistview.h> |
18 | #include <qlistbox.h> | 18 | #include <qlistbox.h> |
19 | #include <qcheckbox.h> | 19 | #include <qcheckbox.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qpainter.h> | 21 | #include <qpainter.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | #include <qregexp.h> | 23 | #include <qregexp.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
27 | #include <qtextview.h> | 27 | #include <qtextview.h> |
28 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include "debug.h" | 33 | #include "debug.h" |
34 | 34 | ||
35 | PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) | 35 | PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) |
36 | : PackageManagerSettingsBase( parent, name, fl ) | 36 | : PackageManagerSettingsBase( parent, name, fl ) |
37 | { | 37 | { |
38 | connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); | 38 | connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); |
39 | connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); | 39 | connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); |
40 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 40 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
41 | connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); | 41 | connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); |
42 | connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); | 42 | connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); |
43 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 43 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
44 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), | 44 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), |
45 | // activeLinkDestination, SLOT(setEnabled(bool)) ); | 45 | // activeLinkDestination, SLOT(setEnabled(bool)) ); |
46 | 46 | ||
47 | connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); | 47 | connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); |
48 | connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); | 48 | connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); |
49 | connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); | 49 | connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); |
50 | connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); | 50 | connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); |
51 | connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); | 51 | connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); |
52 | servername->setEnabled(FALSE); | 52 | servername->setEnabled(FALSE); |
53 | serverurl->setEnabled(FALSE); | 53 | serverurl->setEnabled(FALSE); |
54 | serverurlDic.setAutoDelete(TRUE); | 54 | serverurlDic.setAutoDelete(TRUE); |
55 | destinationname->setEnabled(FALSE); | 55 | destinationname->setEnabled(FALSE); |
56 | destinationurl->setEnabled(FALSE); | 56 | destinationurl->setEnabled(FALSE); |
57 | destinationurlDic.setAutoDelete(TRUE); | 57 | destinationurlDic.setAutoDelete(TRUE); |
58 | readSettings(); | 58 | readSettings(); |
59 | } | 59 | } |
60 | 60 | ||
61 | PackageManagerSettings::~PackageManagerSettings() | 61 | PackageManagerSettings::~PackageManagerSettings() |
62 | { | 62 | { |
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | void PackageManagerSettings::newServer() | 66 | void PackageManagerSettings::newServer() |
67 | { | 67 | { |
68 | int i = servers->count(); | 68 | int i = servers->count(); |
69 | if ( servername->isEnabled() || serverurl->text().isEmpty() ) { | 69 | if ( servername->isEnabled() || serverurl->text().isEmpty() ) { |
70 | serverurlDic.insert(i,new QString("http://")); | 70 | serverurlDic.insert(i,new QString("http://")); |
71 | servers->insertItem(tr("New")); | 71 | servers->insertItem(tr("New")); |
72 | activeServers->insertItem(tr("New")); | 72 | activeServers->insertItem(tr("New")); |
73 | } else { | 73 | } else { |
74 | // allows one-level undo | 74 | // allows one-level undo |
75 | serverurlDic.insert(i,new QString(serverurl->text())); | 75 | serverurlDic.insert(i,new QString(serverurl->text())); |
76 | servers->insertItem(servername->text()); | 76 | servers->insertItem(servername->text()); |
77 | activeServers->insertItem(servername->text()); | 77 | activeServers->insertItem(servername->text()); |
78 | } | 78 | } |
79 | servers->setSelected(i,TRUE); | 79 | servers->setSelected(i,TRUE); |
80 | editServer(i); | 80 | editServer(i); |
81 | } | 81 | } |
82 | 82 | ||
83 | void PackageManagerSettings::newDestination() | 83 | void PackageManagerSettings::newDestination() |
84 | { | 84 | { |
85 | int i = destinations->count(); | 85 | int i = destinations->count(); |
86 | if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { | 86 | if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { |
87 | destinationurlDic.insert(i,new QString("/")); | 87 | destinationurlDic.insert(i,new QString("/")); |
88 | destinations->insertItem(tr("New")); | 88 | destinations->insertItem(tr("New")); |
89 | activeDestination->insertItem(tr("New")); | 89 | activeDestination->insertItem(tr("New")); |
90 | activeLinkDestination->insertItem(tr("New")); | 90 | activeLinkDestination->insertItem(tr("New")); |
91 | } else { | 91 | } else { |
92 | // allows one-level undo | 92 | // allows one-level undo |
93 | destinationurlDic.insert(i,new QString(destinationurl->text())); | 93 | destinationurlDic.insert(i,new QString(destinationurl->text())); |
94 | destinations->insertItem(destinationname->text()); | 94 | destinations->insertItem(destinationname->text()); |
95 | activeDestination->insertItem(destinationname->text()); | 95 | activeDestination->insertItem(destinationname->text()); |
96 | activeLinkDestination->insertItem(destinationname->text()); | 96 | activeLinkDestination->insertItem(destinationname->text()); |
97 | } | 97 | } |
98 | destinations->setSelected(i,TRUE); | 98 | destinations->setSelected(i,TRUE); |
99 | editDestination(i); | 99 | editDestination(i); |
100 | } | 100 | } |
101 | 101 | ||
102 | 102 | ||
103 | void PackageManagerSettings::editServer(int i) | 103 | void PackageManagerSettings::editServer(int i) |
104 | { | 104 | { |
105 | if ( servername->isEnabled() ) { | 105 | if ( servername->isEnabled() ) { |
106 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 106 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
107 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 107 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
108 | } else { | 108 | } else { |
109 | servername->setEnabled(TRUE); | 109 | servername->setEnabled(TRUE); |
110 | serverurl->setEnabled(TRUE); | 110 | serverurl->setEnabled(TRUE); |
111 | } | 111 | } |
112 | 112 | ||
113 | servername->setText( servers->text(i) ); | 113 | servername->setText( servers->text(i) ); |
114 | serverurl->setText( *serverurlDic[i] ); | 114 | serverurl->setText( *serverurlDic[i] ); |
115 | 115 | ||
116 | editedserver = i; | 116 | editedserver = i; |
117 | 117 | ||
118 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 118 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
119 | connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 119 | connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | void PackageManagerSettings::editDestination(int i) | 123 | void PackageManagerSettings::editDestination(int i) |
124 | { | 124 | { |
125 | if ( destinationname->isEnabled() ) { | 125 | if ( destinationname->isEnabled() ) { |
126 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 126 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
127 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 127 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
128 | } else { | 128 | } else { |
129 | destinationname->setEnabled(TRUE); | 129 | destinationname->setEnabled(TRUE); |
130 | destinationurl->setEnabled(TRUE); | 130 | destinationurl->setEnabled(TRUE); |
131 | } | 131 | } |
132 | 132 | ||
133 | destinationname->setText( destinations->text(i) ); | 133 | destinationname->setText( destinations->text(i) ); |
134 | destinationurl->setText( *destinationurlDic[i] ); | 134 | destinationurl->setText( *destinationurlDic[i] ); |
135 | 135 | ||
136 | editeddestination = i; | 136 | editeddestination = i; |
137 | 137 | ||
138 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 138 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
139 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 139 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
140 | } | 140 | } |
141 | 141 | ||
142 | void PackageManagerSettings::removeServer() | 142 | void PackageManagerSettings::removeServer() |
143 | { | 143 | { |
144 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 144 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
145 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 145 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
146 | servername->setText(servers->text(editedserver)); | 146 | servername->setText(servers->text(editedserver)); |
147 | serverurl->setText(*serverurlDic[editedserver]); | 147 | serverurl->setText(*serverurlDic[editedserver]); |
148 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 148 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
149 | servers->removeItem(editedserver); | 149 | servers->removeItem(editedserver); |
150 | activeServers->removeItem(editedserver); | 150 | activeServers->removeItem(editedserver); |
151 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 151 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
152 | servername->setEnabled(FALSE); | 152 | servername->setEnabled(FALSE); |
153 | serverurl->setEnabled(FALSE); | 153 | serverurl->setEnabled(FALSE); |
154 | } | 154 | } |
155 | 155 | ||
156 | void PackageManagerSettings::removeDestination() | 156 | void PackageManagerSettings::removeDestination() |
157 | { | 157 | { |
158 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 158 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
159 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 159 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
160 | destinationname->setText(destinations->text(editedserver)); | 160 | destinationname->setText(destinations->text(editedserver)); |
161 | destinationurl->setText(*destinationurlDic[editedserver]); | 161 | destinationurl->setText(*destinationurlDic[editedserver]); |
162 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 162 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
163 | destinations->removeItem(editeddestination); | 163 | destinations->removeItem(editeddestination); |
164 | activeDestination->removeItem(editeddestination); | 164 | activeDestination->removeItem(editeddestination); |
165 | activeLinkDestination->removeItem(editeddestination); | 165 | activeLinkDestination->removeItem(editeddestination); |
166 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 166 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
167 | destinationname->setEnabled(FALSE); | 167 | destinationname->setEnabled(FALSE); |
168 | destinationurl->setEnabled(FALSE); | 168 | destinationurl->setEnabled(FALSE); |
169 | } | 169 | } |
170 | 170 | ||
171 | void PackageManagerSettings::serverNameChanged(const QString& t) | 171 | void PackageManagerSettings::serverNameChanged(const QString& t) |
172 | { | 172 | { |
173 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 173 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
174 | servers->changeItem( t, editedserver ); | 174 | servers->changeItem( t, editedserver ); |
175 | activeServers->changeItem( t, editedserver ); | 175 | activeServers->changeItem( t, editedserver ); |
176 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 176 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
177 | } | 177 | } |
178 | 178 | ||
179 | void PackageManagerSettings::destNameChanged(const QString& t) | 179 | void PackageManagerSettings::destNameChanged(const QString& t) |
180 | { | 180 | { |
181 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 181 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
182 | destinations->changeItem( t, editeddestination ); | 182 | destinations->changeItem( t, editeddestination ); |
183 | activeDestination->changeItem( t, editeddestination ); | 183 | activeDestination->changeItem( t, editeddestination ); |
184 | activeLinkDestination->changeItem( t, editeddestination ); | 184 | activeLinkDestination->changeItem( t, editeddestination ); |
185 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 185 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
186 | } | 186 | } |
187 | 187 | ||
188 | void PackageManagerSettings::serverUrlChanged(const QString& t) | 188 | void PackageManagerSettings::serverUrlChanged(const QString& t) |
189 | { | 189 | { |
190 | serverurlDic.replace(editedserver, new QString(t)); | 190 | serverurlDic.replace(editedserver, new QString(t)); |
191 | } | 191 | } |
192 | 192 | ||
193 | void PackageManagerSettings::destUrlChanged(const QString& t) | 193 | void PackageManagerSettings::destUrlChanged(const QString& t) |
194 | { | 194 | { |
195 | destinationurlDic.replace(editeddestination, new QString(t)); | 195 | destinationurlDic.replace(editeddestination, new QString(t)); |
196 | } | 196 | } |
197 | 197 | ||
198 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) | 198 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) |
199 | { | 199 | { |
200 | QFile conf(conffile); | 200 | QFile conf(conffile); |
201 | if ( ! conf.open(IO_WriteOnly) ) return; | 201 | if ( ! conf.open(IO_WriteOnly) ) return; |
202 | QTextStream s(&conf); | 202 | QTextStream s(&conf); |
203 | s << "# Written by qpie Package Manager\n"; | 203 | s << "# Written by qpie Package Manager\n"; |
204 | for (int i=0; i<(int)activeServers->count(); i++) | 204 | for (int i=0; i<(int)activeServers->count(); i++) |
205 | { | 205 | { |
206 | QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); | 206 | QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); |
207 | if ( !activeServers->isSelected(i) ) | 207 | if ( !activeServers->isSelected(i) ) |
208 | s << "#"; | 208 | s << "#"; |
209 | s << "src " << activeServers->text(i) << " " << url << "\n"; | 209 | s << "src " << activeServers->text(i) << " " << url << "\n"; |
210 | } | 210 | } |
211 | for (int i=0; i<(int)destinations->count(); i++) | 211 | for (int i=0; i<(int)destinations->count(); i++) |
212 | { | 212 | { |
213 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); | 213 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); |
214 | s << "dest " << destinations->text(i) << " " << url << "\n"; | 214 | s << "dest " << destinations->text(i) << " " << url << "\n"; |
215 | } | 215 | } |
216 | conf.close(); | 216 | conf.close(); |
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | void PackageManagerSettings::readInstallationSettings() | 220 | void PackageManagerSettings::readInstallationSettings() |
221 | { | 221 | { |
222 | Config cfg( "oipkg", Config::User ); | 222 | Config cfg( "oipkg", Config::User ); |
223 | cfg.setGroup( "Settings" ); | 223 | cfg.setGroup( "Settings" ); |
224 | installationSettingsCount = cfg.readNumEntry( "count", -1 ); | 224 | installationSettingsCount = cfg.readNumEntry( "count", -1 ); |
225 | currentSetting = cfg.readNumEntry( "current", 0 );// o should be -1 | 225 | currentSetting = cfg.readNumEntry( "current", 0 );// o should be -1 |
226 | 226 | ||
227 | for (int i = 0; i < installationSettingsCount; i++) | 227 | for (int i = 0; i < installationSettingsCount; i++) |
228 | { | 228 | { |
229 | cfg.setGroup( "Setting_" + QString::number(i) ); | 229 | cfg.setGroup( "Setting_" + QString::number(i) ); |
230 | settingName->insertItem( cfg.readEntry( "name", "???" ), i ); | 230 | settingName->insertItem( cfg.readEntry( "name", "???" ), i ); |
231 | }; | 231 | }; |
232 | readInstallationSetting( currentSetting ); | 232 | readInstallationSetting( currentSetting ); |
233 | } | 233 | } |
234 | 234 | ||
235 | 235 | ||
236 | 236 | ||
237 | /** | 237 | /** |
238 | * remove from conf file | 238 | * remove from conf file |
239 | */ | 239 | */ |
240 | void PackageManagerSettings::removeInstallationSetting() | 240 | void PackageManagerSettings::removeInstallationSetting() |
241 | { | 241 | { |
242 | settingName->removeItem( settingName->currentItem() ); | 242 | settingName->removeItem( settingName->currentItem() ); |
243 | Config cfg( "oipkg", Config::User ); | 243 | Config cfg( "oipkg", Config::User ); |
244 | cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); | 244 | cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); |
245 | cfg.clearGroup(); | 245 | cfg.clearGroup(); |
246 | installationSettingsCount--; | 246 | installationSettingsCount--; |
247 | changed = true; | 247 | changed = true; |
248 | settingName->setEditable( false ); | 248 | settingName->setEditable( false ); |
249 | } | 249 | } |
250 | 250 | ||
251 | /** | 251 | /** |
252 | * write to confgile | 252 | * write to confgile |
253 | */ | 253 | */ |
254 | void PackageManagerSettings::newInstallationSetting() | 254 | void PackageManagerSettings::newInstallationSetting() |
255 | { | 255 | { |
256 | installationSettingsCount++; | 256 | installationSettingsCount++; |
257 | settingName->insertItem( "New", installationSettingsCount ); | 257 | settingName->insertItem( "New", installationSettingsCount ); |
258 | settingName->setCurrentItem( installationSettingsCount ); | 258 | settingName->setCurrentItem( installationSettingsCount ); |
259 | settingName->setEditable( true ); | 259 | settingName->setEditable( true ); |
260 | changed = true; | 260 | changed = true; |
261 | } | 261 | } |
262 | 262 | ||
263 | void PackageManagerSettings::installationSettingChange(int cs) | 263 | void PackageManagerSettings::installationSettingChange(int cs) |
264 | { | 264 | { |
265 | writeCurrentInstallationSetting(); | 265 | writeCurrentInstallationSetting(); |
266 | currentSetting = cs; | 266 | currentSetting = cs; |
267 | readInstallationSetting( cs ); | 267 | readInstallationSetting( cs ); |
268 | } | 268 | } |
269 | 269 | ||
270 | void PackageManagerSettings::writeInstallationSettings() | 270 | void PackageManagerSettings::writeInstallationSettings() |
271 | { | 271 | { |
272 | if ( ! changed ) return ; | 272 | if ( ! changed ) return ; |
273 | { | 273 | { |
274 | Config cfg( "oipkg", Config::User ); | 274 | Config cfg( "oipkg", Config::User ); |
275 | cfg.setGroup( "Settings" ); | 275 | cfg.setGroup( "Settings" ); |
276 | cfg.writeEntry( "count", installationSettingsCount ); | 276 | cfg.writeEntry( "count", installationSettingsCount ); |
277 | cfg.writeEntry( "current", currentSetting ); | 277 | cfg.writeEntry( "current", currentSetting ); |
278 | } | 278 | } |
279 | writeCurrentInstallationSetting(); | 279 | writeCurrentInstallationSetting(); |
280 | } | 280 | } |
281 | 281 | ||
282 | 282 | ||
283 | void PackageManagerSettings::readInstallationSetting(int setting) | 283 | void PackageManagerSettings::readInstallationSetting(int setting) |
284 | { | 284 | { |
285 | if ( setting < 0 ) return; | 285 | if ( setting < 0 ) return; |
286 | Config cfg( "oipkg", Config::User ); | 286 | Config cfg( "oipkg", Config::User ); |
287 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | 287 | cfg.setGroup( "Setting_" + QString::number( setting ) ); |
288 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); | 288 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); |
289 | QString dest = cfg.readEntry( "dest" ); | 289 | QString dest = cfg.readEntry( "dest" ); |
290 | QString linkdest = cfg.readEntry( "linkdest" ); | 290 | QString linkdest = cfg.readEntry( "linkdest" ); |
291 | pvDebug(3, "dest="+dest); | 291 | pvDebug(3, "dest="+dest); |
292 | pvDebug(3, "linkdest="+linkdest); | 292 | pvDebug(3, "linkdest="+linkdest); |
293 | 293 | ||
294 | for ( int i = 0; i < activeDestination->count(); i++) | 294 | for ( int i = 0; i < activeDestination->count(); i++) |
295 | { | 295 | { |
296 | if ( activeDestination->text( i ) == dest ) | 296 | if ( activeDestination->text( i ) == dest ) |
297 | activeDestination->setCurrentItem( i ); | 297 | activeDestination->setCurrentItem( i ); |
298 | if ( activeLinkDestination->text( i ) == linkdest ) | 298 | if ( activeLinkDestination->text( i ) == linkdest ) |
299 | activeLinkDestination->setCurrentItem( i ); | 299 | activeLinkDestination->setCurrentItem( i ); |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | void PackageManagerSettings::writeCurrentInstallationSetting() | 303 | void PackageManagerSettings::writeCurrentInstallationSetting() |
304 | { | 304 | { |
305 | Config cfg( "oipkg", Config::User ); | 305 | Config cfg( "oipkg", Config::User ); |
306 | changed = false; | 306 | changed = false; |
307 | cfg.setGroup( "Setting_" + QString::number(currentSetting) ); | 307 | cfg.setGroup( "Setting_" + QString::number(currentSetting) ); |
308 | cfg.writeEntry( "link", CheckBoxLink->isChecked() ); | 308 | cfg.writeEntry( "link", CheckBoxLink->isChecked() ); |
309 | cfg.writeEntry( "dest", getDestinationName() ); | 309 | cfg.writeEntry( "dest", getDestinationName() ); |
310 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); | 310 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); |
311 | QStringList sers = getActiveServers(); | 311 | QStringList sers = getActiveServers(); |
312 | int srvc = 0; | 312 | int srvc = 0; |
313 | for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { | 313 | for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { |
314 | cfg.writeEntry( "server_" + QString::number(srvc++), *it ); | 314 | cfg.writeEntry( "server_" + QString::number(srvc++), *it ); |
315 | } | 315 | } |
316 | cfg.writeEntry( "server_count", srvc ); | 316 | cfg.writeEntry( "server_count", srvc ); |
317 | } | 317 | } |
318 | 318 | ||
319 | void PackageManagerSettings::renameInstallationSetting() | 319 | void PackageManagerSettings::renameInstallationSetting() |
320 | { | 320 | { |
321 | settingName->setEditable( true ); | 321 | settingName->setEditable( true ); |
322 | changed = true; | 322 | changed = true; |
323 | } | 323 | } |
324 | 324 | ||
325 | void PackageManagerSettings::installationSettingSetName(const QString &name) | 325 | void PackageManagerSettings::installationSettingSetName(const QString &name) |
326 | { | 326 | { |
327 | settingName->changeItem( name, settingName->currentItem() ); | 327 | settingName->changeItem( name, settingName->currentItem() ); |
328 | changed = true; | 328 | changed = true; |
329 | } | 329 | } |
330 | 330 | ||
331 | 331 | ||
332 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) | 332 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) |
333 | { | 333 | { |
334 | QFile conf(conffile); | 334 | QFile conf(conffile); |
335 | if ( conf.open(IO_ReadOnly) ) { | 335 | if ( conf.open(IO_ReadOnly) ) { |
336 | QTextStream s(&conf); | 336 | QTextStream s(&conf); |
337 | servers->clear(); | 337 | servers->clear(); |
338 | activeServers->clear(); | 338 | activeServers->clear(); |
339 | activeDestination->clear(); | 339 | activeDestination->clear(); |
340 | activeLinkDestination->clear(); | 340 | activeLinkDestination->clear(); |
341 | serverurlDic.clear(); | 341 | serverurlDic.clear(); |
342 | destinationurlDic.clear(); | 342 | destinationurlDic.clear(); |
343 | ipkg_old=0; | 343 | ipkg_old=0; |
344 | int currentserver=0; | 344 | int currentserver=0; |
345 | while ( !s.atEnd() ) { | 345 | while ( !s.atEnd() ) { |
346 | QString l = s.readLine(); | 346 | QString l = s.readLine(); |
347 | QStringList token = QStringList::split(' ', l); | 347 | QStringList token = QStringList::split(' ', l); |
348 | if ( token[0] == "src" || token[0] == "#src" ) { | 348 | if ( token[0] == "src" || token[0] == "#src" ) { |
349 | currentserver=servers->count(); | 349 | currentserver=servers->count(); |
350 | serverurlDic.insert(servers->count(),new QString(token[2])); | 350 | serverurlDic.insert(servers->count(),new QString(token[2])); |
351 | int a = token[0] == "src" ? 1 : 0; | 351 | int a = token[0] == "src" ? 1 : 0; |
352 | int i = servers->count(); | 352 | int i = servers->count(); |
353 | servers->insertItem(token[1]); | 353 | servers->insertItem(token[1]); |
354 | activeServers->insertItem( token[1] ); | 354 | activeServers->insertItem( token[1] ); |
355 | activeServers->setSelected(i,a); | 355 | activeServers->setSelected(i,a); |
356 | } else if ( token[0] == "dest" ) { | 356 | } else if ( token[0] == "dest" ) { |
357 | currentserver=destinations->count(); | 357 | currentserver=destinations->count(); |
358 | destinationurlDic.insert(destinations->count(),new QString(token[2])); | 358 | destinationurlDic.insert(destinations->count(),new QString(token[2])); |
359 | destinations->insertItem(token[1]); | 359 | destinations->insertItem(token[1]); |
360 | activeDestination->insertItem( token[1] ); | 360 | activeDestination->insertItem( token[1] ); |
361 | activeLinkDestination->insertItem( token[1] ); | 361 | activeLinkDestination->insertItem( token[1] ); |
362 | 362 | ||
363 | } else if ( token[0] == "option" ) { | 363 | } else if ( token[0] == "option" ) { |
364 | // ### somehow need to use the settings from netsetup | 364 | // ### somehow need to use the settings from netsetup |
365 | // if ( token[1] == "http_proxy" ) | 365 | // if ( token[1] == "http_proxy" ) |
366 | // http->setText(token[2]); | 366 | // http->setText(token[2]); |
367 | // else if ( token[1] == "ftp_proxy" ) | 367 | // else if ( token[1] == "ftp_proxy" ) |
368 | // ftp->setText(token[2]); | 368 | // ftp->setText(token[2]); |
369 | // else if ( token[1] == "proxy_username" ) | 369 | // else if ( token[1] == "proxy_username" ) |
370 | // username->setText(token[2]); | 370 | // username->setText(token[2]); |
371 | // else if ( token[1] == "proxy_password" ) | 371 | // else if ( token[1] == "proxy_password" ) |
372 | // password->setText(token[2]); | 372 | // password->setText(token[2]); |
373 | } else { | 373 | } else { |
374 | // Old style? | 374 | // Old style? |
375 | int eq = l.find('='); | 375 | int eq = l.find('='); |
376 | if ( eq >= 0 ) { | 376 | if ( eq >= 0 ) { |
377 | QString v = l.mid(eq+1).stripWhiteSpace(); | 377 | QString v = l.mid(eq+1).stripWhiteSpace(); |
378 | if ( v[0] == '"' || v[0] == '\'' ) { | 378 | if ( v[0] == '"' || v[0] == '\'' ) { |
379 | int cl=v.find(v[0],1); | 379 | int cl=v.find(v[0],1); |
380 | if ( cl >= 0 ) | 380 | if ( cl >= 0 ) |
381 | v = v.mid(1,cl-1); | 381 | v = v.mid(1,cl-1); |
382 | } | 382 | } |
383 | if ( l.left(12) == "IPKG_SOURCE=" ) { | 383 | if ( l.left(12) == "IPKG_SOURCE=" ) { |
384 | ipkg_old=1; | 384 | ipkg_old=1; |
385 | currentserver=servers->count(); | 385 | currentserver=servers->count(); |
386 | serverurlDic.insert(servers->count(),new QString(v)); | 386 | serverurlDic.insert(servers->count(),new QString(v)); |
387 | servers->insertItem(v); | 387 | servers->insertItem(v); |
388 | } else if ( l.left(13) == "#IPKG_SOURCE=" ) { | 388 | } else if ( l.left(13) == "#IPKG_SOURCE=" ) { |
389 | serverurlDic.insert(servers->count(),new QString(v)); | 389 | serverurlDic.insert(servers->count(),new QString(v)); |
390 | servers->insertItem(v); | 390 | servers->insertItem(v); |
391 | } else if ( l.left(10) == "IPKG_ROOT=" ) { | 391 | } else if ( l.left(10) == "IPKG_ROOT=" ) { |
392 | // ### no UI | 392 | // ### no UI |
393 | // } else if ( l.left(20) == "IPKG_PROXY_USERNAME=" ) { | 393 | // } else if ( l.left(20) == "IPKG_PROXY_USERNAME=" ) { |
394 | // username->setText(v); | 394 | // username->setText(v); |
395 | // } else if ( l.left(20) == "IPKG_PROXY_PASSWORD=" ) { | 395 | // } else if ( l.left(20) == "IPKG_PROXY_PASSWORD=" ) { |
396 | // password->setText(v); | 396 | // password->setText(v); |
397 | // } else if ( l.left(16) == "IPKG_PROXY_HTTP=" ) { | 397 | // } else if ( l.left(16) == "IPKG_PROXY_HTTP=" ) { |
398 | // http->setText(v); | 398 | // http->setText(v); |
399 | // } else if ( l.left(16) == "IPKG_PROXY_FTP=" ) { | 399 | // } else if ( l.left(16) == "IPKG_PROXY_FTP=" ) { |
400 | // ftp->setText(v); | 400 | // ftp->setText(v); |
401 | } | 401 | } |
402 | } | 402 | } |
403 | } | 403 | } |
404 | } | 404 | } |
405 | if ( ipkg_old ) { | 405 | if ( ipkg_old ) { |
406 | servers->setSelectionMode(QListBox::Single); | 406 | servers->setSelectionMode(QListBox::Single); |
407 | servers->setSelected(currentserver,TRUE); | 407 | servers->setSelected(currentserver,TRUE); |
408 | } | 408 | } |
409 | return TRUE; | 409 | return TRUE; |
410 | } else { | 410 | } else { |
411 | return FALSE; | 411 | return FALSE; |
412 | } | 412 | } |
413 | } | 413 | } |
414 | 414 | ||
415 | 415 | ||
416 | /** | 416 | /** |
417 | * read from config file(s) | 417 | * read from config file(s) |
418 | */ | 418 | */ |
419 | void PackageManagerSettings::readSettings() | 419 | void PackageManagerSettings::readSettings() |
420 | { | 420 | { |
421 | readIpkgConfig("/etc/ipkg.conf"); | 421 | readIpkgConfig("/etc/ipkg.conf"); |
422 | readInstallationSettings(); | 422 | readInstallationSettings(); |
423 | } | 423 | } |
424 | 424 | ||
425 | void PackageManagerSettings::writeSettings() | 425 | void PackageManagerSettings::writeSettings() |
426 | { | 426 | { |
427 | writeIpkgConfig("/etc/ipkg.conf"); | 427 | writeIpkgConfig("/etc/ipkg.conf"); |
428 | writeInstallationSettings(); | 428 | writeInstallationSettings(); |
429 | } | 429 | } |
430 | /** shows the setting dialog */ | 430 | /** shows the setting dialog */ |
431 | bool PackageManagerSettings::showDialog( int i ) | 431 | bool PackageManagerSettings::showDialog( int i ) |
432 | { | 432 | { |
433 | TabWidget->setCurrentPage( i ); | 433 | TabWidget->setCurrentPage( i ); |
434 | showMaximized(); | 434 | showMaximized(); |
435 | bool ret = exec(); | 435 | bool ret = exec(); |
436 | if ( ret ) writeSettings(); | 436 | if ( ret ) writeSettings(); |
437 | else readSettings(); | 437 | else readSettings(); |
438 | return ret; | 438 | return ret; |
439 | } | 439 | } |
440 | /** Returns the installation destination */ | 440 | /** Returns the installation destination */ |
441 | QString PackageManagerSettings::getDestinationName() | 441 | QString PackageManagerSettings::getDestinationName() |
442 | { | 442 | { |
443 | return activeDestination->currentText(); | 443 | return activeDestination->currentText(); |
444 | } | 444 | } |
445 | /** Returns the link destination */ | 445 | /** Returns the link destination */ |
446 | QString PackageManagerSettings::getLinkDestinationName() | 446 | QString PackageManagerSettings::getLinkDestinationName() |
447 | { | 447 | { |
448 | return activeLinkDestination->currentText(); | 448 | return activeLinkDestination->currentText(); |
449 | } | 449 | } |
450 | /** Returns the URL of the active destination */ | 450 | /** Returns the URL of the active destination */ |
451 | QString PackageManagerSettings::getDestinationUrl() | 451 | QString PackageManagerSettings::getDestinationUrl() |
452 | { | 452 | { |
453 | int dnr = activeDestination->currentItem(); | 453 | int dnr = activeDestination->currentItem(); |
454 | return *destinationurlDic.find(dnr); | 454 | return *destinationurlDic.find(dnr); |
455 | } | 455 | } |
456 | /** Should oipkg create links form install destination to link destination */ | 456 | /** Should oipkg create links form install destination to link destination */ |
457 | bool PackageManagerSettings::createLinks() | 457 | bool PackageManagerSettings::createLinks() |
458 | { | 458 | { |
459 | return CheckBoxLink->isChecked(); | 459 | return CheckBoxLink->isChecked(); |
460 | } | 460 | } |
461 | /** get the servers that are active */ | 461 | /** get the servers that are active */ |
462 | QStringList PackageManagerSettings::getActiveServers() | 462 | QStringList PackageManagerSettings::getActiveServers() |
463 | { | 463 | { |
464 | QStringList sl; | 464 | QStringList sl; |
465 | for (int i=0; i<(int)activeServers->count(); i++) | 465 | for (int i=0; i<(int)activeServers->count(); i++) |
466 | { | 466 | { |
467 | if ( activeServers->isSelected(i) ) | 467 | if ( activeServers->isSelected(i) ) |
468 | sl += activeServers->text(i); | 468 | sl += activeServers->text(i); |
469 | } | 469 | } |
470 | return sl; | 470 | return sl; |
471 | } | 471 | } |
472 | 472 | ||
473 | /** returns the destination listed in ipkg.conf */ | 473 | /** returns the destination listed in ipkg.conf */ |
474 | QStringList PackageManagerSettings::getDestinationUrls() | 474 | QStringList PackageManagerSettings::getDestinationUrls() |
475 | { | 475 | { |
476 | QStringList sl; | 476 | QStringList sl; |
477 | for (int i=0; i<(int)destinations->count(); i++) | 477 | for (int i=0; i<(int)destinations->count(); i++) |
478 | { | 478 | { |
479 | sl += *destinationurlDic[i]; | 479 | sl += *destinationurlDic[i]; |
480 | } | 480 | } |
481 | return sl; | 481 | return sl; |
482 | } | 482 | } |
483 | 483 | ||
484 | /** returns the destination listed in ipkg.conf */ | 484 | /** returns the destination listed in ipkg.conf */ |
485 | QString PackageManagerSettings::getDestinationUrlByName(QString n) | 485 | QString PackageManagerSettings::getDestinationUrlByName(QString n) |
486 | { | 486 | { |
487 | QStringList sl; | 487 | QStringList sl; |
488 | for (int i=0; i<(int)destinations->count(); i++) | 488 | for (int i=0; i<(int)destinations->count(); i++) |
489 | { | 489 | { |
490 | if ( n == destinations->text(i)) return*destinationurlDic[i]; | 490 | if ( n == destinations->text(i)) return*destinationurlDic[i]; |
491 | } | 491 | } |
492 | return ""; | 492 | return ""; |
493 | } | 493 | } |
494 | 494 | ||
495 | /** returns the destination listed in ipkg.conf */ | 495 | /** returns the destination listed in ipkg.conf */ |
496 | QStringList PackageManagerSettings::getDestinationNames() | 496 | QStringList PackageManagerSettings::getDestinationNames() |
497 | { | 497 | { |
498 | QStringList sl; | 498 | QStringList sl; |
499 | for (int i=0; i<(int)destinations->count(); i++) | 499 | for (int i=0; i<(int)destinations->count(); i++) |
500 | { | 500 | { |
501 | sl += destinations->text(i); | 501 | sl += destinations->text(i); |
502 | } | 502 | } |
503 | return sl; | 503 | return sl; |
504 | } | 504 | } |
505 | 505 | ||
506 | 506 | ||
507 | void PackageManagerSettings::linkEnabled( bool b ) | 507 | void PackageManagerSettings::linkEnabled( bool b ) |
508 | { | 508 | { |
509 | changed = true; | 509 | changed = true; |
510 | activeLinkDestination->setEnabled( b ); | 510 | activeLinkDestination->setEnabled( b ); |
511 | } | 511 | } |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index f0992f5..ecc97b2 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,386 +1,388 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pksettings.h" | 2 | #include "pksettings.h" |
3 | #include "package.h" | 3 | #include "package.h" |
4 | #include "packagelistitem.h" | 4 | #include "packagelistitem.h" |
5 | 5 | ||
6 | #include <qpe/process.h> | 6 | #include <qpe/process.h> |
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
9 | #include <qpe/stringutil.h> | 9 | #include <qpe/stringutil.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qmultilineedit.h> | 12 | #include <qmultilineedit.h> |
13 | #include <qstring.h> | 13 | #include <qstring.h> |
14 | #include <qcheckbox.h> | 14 | #include <qcheckbox.h> |
15 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
16 | #include <qtextview.h> | 16 | #include <qtextview.h> |
17 | 17 | ||
18 | #include <qprogressbar.h> | 18 | #include <qprogressbar.h> |
19 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
20 | #include <qlayout.h> | 20 | #include <qlayout.h> |
21 | 21 | ||
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <unistd.h> | 23 | #include <unistd.h> |
24 | 24 | ||
25 | #include "mainwindow.h" | 25 | #include "mainwindow.h" |
26 | 26 | ||
27 | 27 | ||
28 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 28 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
29 | : QObject ( p ) | 29 | : QObject ( p ) |
30 | { | 30 | { |
31 | settings = s; | 31 | settings = s; |
32 | runwindowopen = false; | 32 | runwindowopen = false; |
33 | runwindow = new RunWindow( p, name, true, f ); | 33 | runwindow = new RunWindow( p, name, true, f ); |
34 | } | 34 | } |
35 | 35 | ||
36 | PmIpkg::~PmIpkg() | 36 | PmIpkg::~PmIpkg() |
37 | { | 37 | { |
38 | } | 38 | } |
39 | 39 | ||
40 | //#define PROC | 40 | //#define PROC |
41 | #define SYSTEM | 41 | #define SYSTEM |
42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) | 42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) |
43 | { | 43 | { |
44 | pvDebug(2,"PmIpkg::runIpkg "+args); | 44 | pvDebug(2,"PmIpkg::runIpkg "+args); |
45 | 45 | ||
46 | #ifdef PROC | 46 | #ifdef PROC |
47 | QStringList cmd = "/usr/bin/ipkg "; | 47 | QStringList cmd = "/usr/bin/ipkg "; |
48 | #endif | 48 | #endif |
49 | #ifdef SYSTEM | 49 | #ifdef SYSTEM |
50 | QString cmd = "/usr/bin/ipkg "; | 50 | QString cmd = "/usr/bin/ipkg "; |
51 | #endif | 51 | #endif |
52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
53 | if ( dest == "" ) | 53 | if ( dest == "" ) |
54 | cmd += " -dest "+settings->getDestinationName(); | 54 | cmd += " -dest "+settings->getDestinationName(); |
55 | else | 55 | else |
56 | cmd += " -dest "+ dest; | 56 | cmd += " -dest "+ dest; |
57 | 57 | ||
58 | cmd += " -force-defaults "; | 58 | cmd += " -force-defaults "; |
59 | 59 | ||
60 | // if (runwindow->forcedepends->isChecked()) | 60 | // if (runwindow->forcedepends->isChecked()) |
61 | // cmd += " -force-depends "; | 61 | // cmd += " -force-depends "; |
62 | 62 | ||
63 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 63 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
64 | cmd += args; | 64 | cmd += args; |
65 | int r = 0; | 65 | int r = 0; |
66 | #ifdef PROC | 66 | #ifdef PROC |
67 | QString o = "start"; | 67 | QString o = "start"; |
68 | Process *ipkg = new Process( "ls");//cmd ); | 68 | Process *ipkg = new Process( "ls");//cmd ); |
69 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); | 69 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); |
70 | QString description; | 70 | QString description; |
71 | ipkg->exec("",o); | 71 | ipkg->exec("",o); |
72 | // out( o ); | 72 | // out( o ); |
73 | #endif | 73 | #endif |
74 | #ifdef SYSTEM | 74 | #ifdef SYSTEM |
75 | out( "running:<br>\n"+cmd+"<br>\n" ); | 75 | out( "running:<br>\n"+cmd+"<br>\n" ); |
76 | QString redirect = "/tmp/oipkg.pipe"; | 76 | QString redirect = "/tmp/oipkg.pipe"; |
77 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; | 77 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; |
78 | pvDebug(2, "running >"+cmd+"<"); | 78 | pvDebug(2, "running >"+cmd+"<"); |
79 | r = system(cmd.latin1()); | 79 | r = system(cmd.latin1()); |
80 | QFile f( redirect ); | 80 | QFile f( redirect ); |
81 | QString line; | 81 | QString line; |
82 | QString oldLine; | 82 | QString oldLine; |
83 | while ( ! f.open(IO_ReadOnly) ) {}; | 83 | while ( ! f.open(IO_ReadOnly) ) {}; |
84 | // { | 84 | // { |
85 | QTextStream t( &f ); | 85 | QTextStream t( &f ); |
86 | // QString fp; | 86 | // QString fp; |
87 | while ( !t.eof() ) | 87 | while ( !t.eof() ) |
88 | { | 88 | { |
89 | line = t.readLine(); | 89 | line = t.readLine(); |
90 | if ( line != oldLine ) | 90 | if ( line != oldLine ) |
91 | { | 91 | { |
92 | out( line +"<br>" ); | 92 | out( line +"<br>" ); |
93 | oldLine = line; | 93 | oldLine = line; |
94 | } | 94 | } |
95 | } | 95 | } |
96 | // } | 96 | // } |
97 | f.close(); | 97 | f.close(); |
98 | out( "Finished!<br>"); | 98 | out( "Finished!<br>"); |
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | return r; | 101 | return r; |
102 | } | 102 | } |
103 | 103 | ||
104 | void PmIpkg::makeLinks(Package *pack) | 104 | void PmIpkg::makeLinks(Package *pack) |
105 | { | 105 | { |
106 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 106 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
107 | QString dest = settings->getDestinationUrlByName( pack->dest() ); | 107 | QString dest = settings->getDestinationUrlByName( pack->dest() ); |
108 | if (dest == "/" ) return; | 108 | if (dest == "/" ) return; |
109 | { | 109 | { |
110 | Config cfg( "oipkg", Config::User ); | 110 | Config cfg( "oipkg", Config::User ); |
111 | cfg.setGroup( "Common" ); | 111 | cfg.setGroup( "Common" ); |
112 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 112 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
113 | } | 113 | } |
114 | QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; | 114 | QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; |
115 | linkPackage( fn, dest ); | 115 | linkPackage( fn, dest ); |
116 | } | 116 | } |
117 | 117 | ||
118 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 118 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
119 | { | 119 | { |
120 | QFile f( packFileName ); | 120 | QFile f( packFileName ); |
121 | if ( ! f.open(IO_ReadOnly) ) | 121 | if ( ! f.open(IO_ReadOnly) ) |
122 | { | 122 | { |
123 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); | 123 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); |
124 | return; | 124 | return; |
125 | }; | 125 | }; |
126 | out( "<br>creating links<br>" ); | 126 | out( "<br>creating links<br>" ); |
127 | out("for package "+packFileName+" in "+dest+"<br>"); | 127 | out("for package "+packFileName+" in "+dest+"<br>"); |
128 | QTextStream t( &f ); | 128 | QTextStream t( &f ); |
129 | QString fp; | 129 | QString fp; |
130 | while ( !t.eof() ) | 130 | while ( !t.eof() ) |
131 | { | 131 | { |
132 | fp = t.readLine(); | 132 | fp = t.readLine(); |
133 | processLinkDir( fp, dest ); | 133 | processLinkDir( fp, dest ); |
134 | } | 134 | } |
135 | f.close(); | 135 | f.close(); |
136 | } | 136 | } |
137 | 137 | ||
138 | void PmIpkg::processLinkDir( QString file, QString dest ) | 138 | void PmIpkg::processLinkDir( QString file, QString dest ) |
139 | { | 139 | { |
140 | pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); | 140 | pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); |
141 | if ( dest == "???" ) return; | 141 | if ( dest == "???" ) return; |
142 | QString destFile = file; | 142 | QString destFile = file; |
143 | file = dest+"/"+file; | 143 | file = dest+"/"+file; |
144 | if (file == dest) return; | 144 | if (file == dest) return; |
145 | QFileInfo fileInfo( file ); | 145 | QFileInfo fileInfo( file ); |
146 | if ( fileInfo.isDir() ) | 146 | if ( fileInfo.isDir() ) |
147 | { | 147 | { |
148 | QDir destDir( destFile ); | 148 | QDir destDir( destFile ); |
149 | destDir.mkdir( destFile, true ); | 149 | destDir.mkdir( destFile, true ); |
150 | QDir d( file ); | 150 | QDir d( file ); |
151 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 151 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
152 | const QFileInfoList *list = d.entryInfoList(); | 152 | const QFileInfoList *list = d.entryInfoList(); |
153 | QFileInfoListIterator it( *list ); | 153 | QFileInfoListIterator it( *list ); |
154 | QFileInfo *fi; | 154 | QFileInfo *fi; |
155 | while ( (fi=it.current()) ) | 155 | while ( (fi=it.current()) ) |
156 | { | 156 | { |
157 | // out( "<b>"+fi->absFilePath()+"</b>" ); | 157 | // out( "<b>"+fi->absFilePath()+"</b>" ); |
158 | processLinkDir( fi->absFilePath(), dest ); | 158 | processLinkDir( fi->absFilePath(), dest ); |
159 | ++it; | 159 | ++it; |
160 | } | 160 | } |
161 | } else | 161 | } else |
162 | if ( fileInfo.isFile() ) | 162 | if ( fileInfo.isFile() ) |
163 | { | 163 | { |
164 | const char *instFile = strdup( (file).ascii() ); | 164 | const char *instFile = strdup( (file).ascii() ); |
165 | const char *linkFile = strdup( (destFile).ascii()); | 165 | const char *linkFile = strdup( (destFile).ascii()); |
166 | // out( "linking: "+file+" -> "+destFile ); | 166 | // out( "linking: "+file+" -> "+destFile ); |
167 | qDebug( "linking: %s -> %s", instFile, linkFile ); | 167 | qDebug( "linking: %s -> %s", instFile, linkFile ); |
168 | symlink( instFile, linkFile ); | 168 | symlink( instFile, linkFile ); |
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | void PmIpkg::commit( PackageList pl ) | 172 | void PmIpkg::commit( PackageList pl ) |
173 | { | 173 | { |
174 | int sizecount = 0; | 174 | int sizecount = 0; |
175 | to_install.clear(); | 175 | to_install.clear(); |
176 | to_remove.clear(); | 176 | to_remove.clear(); |
177 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; | 177 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; |
178 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; | 178 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; |
179 | pl.allPackages(); | 179 | pl.allPackages(); |
180 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 180 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
181 | { | 181 | { |
182 | if ( pack && (pack->name() != "") && pack) | 182 | if ( pack && (pack->name() != "") && pack) |
183 | { | 183 | { |
184 | if ( pack->toInstall() ) | 184 | if ( pack->toInstall() ) |
185 | { | 185 | { |
186 | to_install.append( pack ); | 186 | to_install.append( pack ); |
187 | sizecount += pack->size().toInt(); | 187 | sizecount += pack->size().toInt(); |
188 | inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>"; | 188 | inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>"; |
189 | } | 189 | } |
190 | if ( pack->toRemove() ) | 190 | if ( pack->toRemove() ) |
191 | { | 191 | { |
192 | to_remove.append( pack ); | 192 | to_remove.append( pack ); |
193 | sizecount += 1; | 193 | sizecount += 1; |
194 | rem += pack->name()+"<br>"; | 194 | rem += pack->name()+"<br>"; |
195 | } | 195 | } |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | startDialog(); | 199 | startDialog(); |
200 | 200 | ||
201 | } | 201 | } |
202 | 202 | ||
203 | void PmIpkg::startDialog() | 203 | void PmIpkg::startDialog() |
204 | { | 204 | { |
205 | QDialog *d = new QDialog(); | 205 | installDialog = new QDialog(0,0,true); |
206 | QGridLayout *RunWindowLayout = new QGridLayout( d ); | 206 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); |
207 | RunWindowLayout->setSpacing( 2 ); | 207 | RunWindowLayout->setSpacing( 2 ); |
208 | RunWindowLayout->setMargin( 2 ); | 208 | RunWindowLayout->setMargin( 2 ); |
209 | 209 | ||
210 | QHBoxLayout *buttons = new QHBoxLayout; | 210 | QHBoxLayout *buttons = new QHBoxLayout; |
211 | buttons->setSpacing( 6 ); | 211 | buttons->setSpacing( 6 ); |
212 | buttons->setMargin( 0 ); | 212 | buttons->setMargin( 0 ); |
213 | 213 | ||
214 | PackageListView *plv = new PackageListView(d, "install",settings); | 214 | PackageListView *plv = new PackageListView(installDialog, "install",settings); |
215 | RunWindowLayout->addWidget( plv, 1, 0 ); | 215 | RunWindowLayout->addWidget( plv, 1, 0 ); |
216 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 216 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
217 | { | 217 | { |
218 | plv->insertItem( new PackageListItem(plv, it,settings) ); | 218 | plv->insertItem( new PackageListItem(plv, it,settings) ); |
219 | } | 219 | } |
220 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 220 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
221 | { | 221 | { |
222 | plv->insertItem( new PackageListItem(plv, it,settings) ); | 222 | plv->insertItem( new PackageListItem(plv, it,settings) ); |
223 | } | 223 | } |
224 | QPushButton *doItButton = new QPushButton( d, "doItButton" ); | 224 | QPushButton *doItButton = new QPushButton( installDialog, "doItButton" ); |
225 | doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) ); | 225 | doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) ); |
226 | QFont doItButton_font( doItButton->font() ); | 226 | QFont doItButton_font( doItButton->font() ); |
227 | doItButton_font.setPointSize( 8 ); | 227 | doItButton_font.setPointSize( 8 ); |
228 | doItButton->setFont( doItButton_font ); | 228 | doItButton->setFont( doItButton_font ); |
229 | doItButton->setText( tr( "Do all " ) ); | 229 | doItButton->setText( tr( "Do all " ) ); |
230 | doItButton->setAutoResize( FALSE ); | 230 | doItButton->setAutoResize( FALSE ); |
231 | buttons->addWidget( doItButton ); | 231 | buttons->addWidget( doItButton ); |
232 | 232 | ||
233 | QPushButton *installButton = new QPushButton( d, "installButton" ); | 233 | QPushButton *installButton = new QPushButton( installDialog, "installButton" ); |
234 | QFont installButton_font( installButton->font() ); | 234 | QFont installButton_font( installButton->font() ); |
235 | installButton_font.setPointSize( 8 ); | 235 | installButton_font.setPointSize( 8 ); |
236 | installButton->setFont( installButton_font ); | 236 | installButton->setFont( installButton_font ); |
237 | installButton->setText( tr( "Install" ) ); | 237 | installButton->setText( tr( "Install" ) ); |
238 | installButton->setAutoResize( TRUE ); | 238 | installButton->setAutoResize( TRUE ); |
239 | buttons->addWidget( installButton ); | 239 | buttons->addWidget( installButton ); |
240 | 240 | ||
241 | QPushButton *removeButton = new QPushButton( d, "removeButton" ); | 241 | QPushButton *removeButton = new QPushButton( installDialog, "removeButton" ); |
242 | QFont removeButton_font( removeButton->font() ); | 242 | QFont removeButton_font( removeButton->font() ); |
243 | removeButton_font.setPointSize( 7 ); | 243 | removeButton_font.setPointSize( 7 ); |
244 | removeButton->setFont( removeButton_font ); | 244 | removeButton->setFont( removeButton_font ); |
245 | removeButton->setText( tr( "Remove" ) ); | 245 | removeButton->setText( tr( "Remove" ) ); |
246 | removeButton->setAutoResize( TRUE ); | 246 | removeButton->setAutoResize( TRUE ); |
247 | buttons->addWidget( removeButton ); | 247 | buttons->addWidget( removeButton ); |
248 | 248 | ||
249 | QPushButton *cancelButton = new QPushButton( d, "cancelButton" ); | 249 | QPushButton *cancelButton = new QPushButton( installDialog, "cancelButton" ); |
250 | QFont cancelButton_font( cancelButton->font() ); | 250 | QFont cancelButton_font( cancelButton->font() ); |
251 | cancelButton_font.setPointSize( 8 ); | 251 | cancelButton_font.setPointSize( 8 ); |
252 | cancelButton->setFont( cancelButton_font ); | 252 | cancelButton->setFont( cancelButton_font ); |
253 | cancelButton->setText( tr( "Cancel" ) ); | 253 | cancelButton->setText( tr( "Cancel" ) ); |
254 | cancelButton->setAutoResize( TRUE ); | 254 | cancelButton->setAutoResize( TRUE ); |
255 | buttons->addWidget( cancelButton ); | 255 | buttons->addWidget( cancelButton ); |
256 | 256 | ||
257 | RunWindowLayout->addLayout( buttons, 3, 0 ); | 257 | RunWindowLayout->addLayout( buttons, 3, 0 ); |
258 | 258 | ||
259 | connect( doItButton, SIGNAL( clicked() ), | 259 | connect( doItButton, SIGNAL( clicked() ), |
260 | this, SLOT( doIt() ) ); | 260 | this, SLOT( doIt() ) ); |
261 | connect( installButton, SIGNAL( clicked() ), | 261 | connect( installButton, SIGNAL( clicked() ), |
262 | this, SLOT( install() ) ); | 262 | this, SLOT( install() ) ); |
263 | connect( removeButton, SIGNAL( clicked() ), | 263 | connect( removeButton, SIGNAL( clicked() ), |
264 | this, SLOT( remove() ) ); | 264 | this, SLOT( remove() ) ); |
265 | connect( cancelButton, SIGNAL( clicked() ), | 265 | connect( cancelButton, SIGNAL( clicked() ), |
266 | d, SLOT( close() ) ); | 266 | installDialog, SLOT( close() ) ); |
267 | d->showMaximized(); | 267 | installDialog->showMaximized(); |
268 | d->exec(); | 268 | if ( installDialog->exec() ) doIt(); |
269 | // d->close(); | 269 | installDialog->close(); |
270 | } | 270 | } |
271 | 271 | ||
272 | void PmIpkg::doIt() | 272 | void PmIpkg::doIt() |
273 | { | 273 | { |
274 | remove(); | 274 | remove(); |
275 | install(); | 275 | install(); |
276 | } | 276 | } |
277 | 277 | ||
278 | 278 | ||
279 | void PmIpkg::remove() | 279 | void PmIpkg::remove() |
280 | { | 280 | { |
281 | if ( to_remove.count() == 0 ) return; | 281 | if ( to_remove.count() == 0 ) return; |
282 | installDialog->close(); | ||
282 | show( true ); | 283 | show( true ); |
283 | 284 | ||
284 | out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); | 285 | out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); |
285 | 286 | ||
286 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 287 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
287 | { | 288 | { |
288 | if ( runIpkg("remove " + it->name()) == 0) | 289 | if ( runIpkg("remove " + it->name()) == 0) |
289 | { | 290 | { |
290 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 291 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
291 | it->processed(); | 292 | it->processed(); |
292 | runwindow->progress->setProgress( 1 ); | 293 | runwindow->progress->setProgress( 1 ); |
293 | }else{ | 294 | }else{ |
294 | out("<b>"+tr("Error while removing")+"</b>"+it->name()); | 295 | out("<b>"+tr("Error while removing")+"</b>"+it->name()); |
295 | } | 296 | } |
296 | } | 297 | } |
297 | } | 298 | } |
298 | 299 | ||
299 | 300 | ||
300 | void PmIpkg::install() | 301 | void PmIpkg::install() |
301 | { | 302 | { |
302 | if ( to_install.count() == 0 ) return; | 303 | if ( to_install.count() == 0 ) return; |
304 | installDialog->close(); | ||
303 | show( true ); | 305 | show( true ); |
304 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 306 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
305 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 307 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
306 | { | 308 | { |
307 | 309 | ||
308 | if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) | 310 | if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) |
309 | { | 311 | { |
310 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 312 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
311 | if ( it->link() ) | 313 | if ( it->link() ) |
312 | makeLinks( it ); | 314 | makeLinks( it ); |
313 | it->processed(); | 315 | it->processed(); |
314 | }else{ | 316 | }else{ |
315 | out("<b>"+tr("Error while installing")+"</b>"+it->name()); | 317 | out("<b>"+tr("Error while installing")+"</b>"+it->name()); |
316 | } | 318 | } |
317 | } | 319 | } |
318 | } | 320 | } |
319 | 321 | ||
320 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) | 322 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) |
321 | { | 323 | { |
322 | qDebug("msg="+msg+" -- "+QString(dest) ); | 324 | qDebug("msg="+msg+" -- "+QString(dest) ); |
323 | // QDir d( src ); | 325 | // QDir d( src ); |
324 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 326 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
325 | //// if (! d.exists() ) return; | 327 | //// if (! d.exists() ) return; |
326 | // const QFileInfoList *list = d.entryInfoList(); | 328 | // const QFileInfoList *list = d.entryInfoList(); |
327 | // QFileInfoListIterator it( *list ); | 329 | // QFileInfoListIterator it( *list ); |
328 | // QFileInfo *fi; | 330 | // QFileInfo *fi; |
329 | // while ( (fi=it.current()) ) { | 331 | // while ( (fi=it.current()) ) { |
330 | // processLinkDir( fi->absFilePath(), dest ); | 332 | // processLinkDir( fi->absFilePath(), dest ); |
331 | // ++it; | 333 | // ++it; |
332 | // } | 334 | // } |
333 | } | 335 | } |
334 | 336 | ||
335 | void PmIpkg::update() | 337 | void PmIpkg::update() |
336 | { | 338 | { |
337 | show( false ); | 339 | show( false ); |
338 | runIpkg( "update" ); | 340 | runIpkg( "update" ); |
339 | runwindow->close(); | 341 | runwindow->close(); |
340 | } | 342 | } |
341 | 343 | ||
342 | void PmIpkg::out( QString o ) | 344 | void PmIpkg::out( QString o ) |
343 | { | 345 | { |
344 | runwindow->outPut->setText( runwindow->outPut->text()+o ); | 346 | runwindow->outPut->setText( runwindow->outPut->text()+o ); |
345 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); | 347 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); |
346 | } | 348 | } |
347 | 349 | ||
348 | 350 | ||
349 | void PmIpkg::showButtons(bool b) | 351 | void PmIpkg::showButtons(bool b) |
350 | { | 352 | { |
351 | if ( b ) | 353 | if ( b ) |
352 | { | 354 | { |
353 | runwindow->cancelButton->hide(); | 355 | runwindow->cancelButton->hide(); |
354 | runwindow->doItButton->hide(); | 356 | runwindow->doItButton->hide(); |
355 | runwindow->removeButton->hide(); | 357 | runwindow->removeButton->hide(); |
356 | runwindow->installButton->hide(); | 358 | runwindow->installButton->hide(); |
357 | }else{ | 359 | }else{ |
358 | runwindow->cancelButton->show(); | 360 | runwindow->cancelButton->show(); |
359 | runwindow->doItButton->show(); | 361 | runwindow->doItButton->show(); |
360 | runwindow->removeButton->show(); | 362 | runwindow->removeButton->show(); |
361 | runwindow->installButton->show(); | 363 | runwindow->installButton->show(); |
362 | 364 | ||
363 | } | 365 | } |
364 | } | 366 | } |
365 | 367 | ||
366 | void PmIpkg::show(bool b) | 368 | void PmIpkg::show(bool b) |
367 | { | 369 | { |
368 | if (!runwindow->isVisible()) | 370 | if (!runwindow->isVisible()) |
369 | runwindow->showMaximized(); | 371 | runwindow->showMaximized(); |
370 | showButtons(b); | 372 | showButtons(b); |
371 | if ( !b ) | 373 | if ( !b ) |
372 | runwindow->progress->hide(); | 374 | runwindow->progress->hide(); |
373 | else | 375 | else |
374 | runwindow->progress->show(); | 376 | runwindow->progress->show(); |
375 | } | 377 | } |
376 | 378 | ||
377 | void PmIpkg::installFile(const QString &fileName) | 379 | void PmIpkg::installFile(const QString &fileName) |
378 | { | 380 | { |
379 | 381 | ||
380 | to_install.clear(); | 382 | to_install.clear(); |
381 | to_remove.clear(); | 383 | to_remove.clear(); |
382 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 384 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
383 | to_install.append( new Package(fileName,settings) ); | 385 | to_install.append( new Package(fileName,settings) ); |
384 | startDialog(); | 386 | startDialog(); |
385 | } | 387 | } |
386 | 388 | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index f70283e..c5e6255 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,51 +1,52 @@ | |||
1 | #ifndef PMIPKG_H | 1 | #ifndef PMIPKG_H |
2 | #define PMIPKG_H | 2 | #define PMIPKG_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qwidget.h> | 8 | #include <qwidget.h> |
9 | #include "pksettings.h" | 9 | #include "pksettings.h" |
10 | #include "runwindow.h" | 10 | #include "runwindow.h" |
11 | #include "packagelist.h" | 11 | #include "packagelist.h" |
12 | #include "debug.h" | 12 | #include "debug.h" |
13 | 13 | ||
14 | class Package; | 14 | class Package; |
15 | class PmIpkg : public QObject | 15 | class PmIpkg : public QObject |
16 | { | 16 | { |
17 | Q_OBJECT | 17 | Q_OBJECT |
18 | public: | 18 | public: |
19 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); | 19 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); |
20 | ~PmIpkg(); | 20 | ~PmIpkg(); |
21 | 21 | ||
22 | void commit( PackageList ); | 22 | void commit( PackageList ); |
23 | void update(); | 23 | void update(); |
24 | PackageList* getPackageList(); | 24 | PackageList* getPackageList(); |
25 | void showButtons(bool b=true); | 25 | void showButtons(bool b=true); |
26 | void show( bool buttons=true ); | 26 | void show( bool buttons=true ); |
27 | 27 | ||
28 | private: | 28 | private: |
29 | PackageManagerSettings* settings; | 29 | PackageManagerSettings* settings; |
30 | RunWindow *runwindow; | 30 | RunWindow *runwindow; |
31 | QDialog *installDialog; | ||
31 | QList<Package> to_remove; | 32 | QList<Package> to_remove; |
32 | QList<Package> to_install; | 33 | QList<Package> to_install; |
33 | bool runwindowopen; | 34 | bool runwindowopen; |
34 | QString fileNameToInstall; | 35 | QString fileNameToInstall; |
35 | 36 | ||
36 | void startDialog(); | 37 | void startDialog(); |
37 | void makeLinks(Package*); | 38 | void makeLinks(Package*); |
38 | void linkPackage( QString, QString ); | 39 | void linkPackage( QString, QString ); |
39 | void processLinkDir( QString, QString ); | 40 | void processLinkDir( QString, QString ); |
40 | int runIpkg(const QString& args, const QString& dest="" ); | 41 | int runIpkg(const QString& args, const QString& dest="" ); |
41 | void out( QString ); | 42 | void out( QString ); |
42 | 43 | ||
43 | public slots: | 44 | public slots: |
44 | void doIt(); | 45 | void doIt(); |
45 | void install(); | 46 | void install(); |
46 | void remove(); | 47 | void remove(); |
47 | void installFile(const QString &fileName); | 48 | void installFile(const QString &fileName); |
48 | void linkDestination( const QString, const QByteArray ); | 49 | void linkDestination( const QString, const QByteArray ); |
49 | }; | 50 | }; |
50 | 51 | ||
51 | #endif | 52 | #endif |