-rw-r--r-- | noncore/settings/packagemanager/ChangeLog | 6 | ||||
-rw-r--r-- | noncore/settings/packagemanager/entrydlg.cpp | 82 | ||||
-rw-r--r-- | noncore/settings/packagemanager/entrydlg.h | 57 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 38 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.h | 2 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 9 | ||||
-rw-r--r-- | noncore/settings/packagemanager/packagemanager.pro | 4 | ||||
-rw-r--r-- | noncore/settings/packagemanager/promptdlg.cpp | 2 |
9 files changed, 179 insertions, 23 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog index 1ba12af..efa75b1 100644 --- a/noncore/settings/packagemanager/ChangeLog +++ b/noncore/settings/packagemanager/ChangeLog | |||
@@ -1,3 +1,9 @@ | |||
1 | 2004-01-23 Dan Williams <drw@handhelds.org> | ||
2 | |||
3 | * Added package download functionality | ||
4 | * Have Opie update links after install/removal so that apps | ||
5 | will display properly in Launcher | ||
6 | |||
1 | 2004-01-20 Dan Williams <drw@handhelds.org> | 7 | 2004-01-20 Dan Williams <drw@handhelds.org> |
2 | 8 | ||
3 | * Released version 0.2.0 | 9 | * Released version 0.2.0 |
diff --git a/noncore/settings/packagemanager/entrydlg.cpp b/noncore/settings/packagemanager/entrydlg.cpp new file mode 100644 index 0000000..8deaa37 --- a/dev/null +++ b/noncore/settings/packagemanager/entrydlg.cpp | |||
@@ -0,0 +1,82 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | |||
4 | =. Copyright (c) 2004 Dan Williams <drw@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This file is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | |||
30 | #include "entrydlg.h" | ||
31 | |||
32 | #include <qlabel.h> | ||
33 | #include <qlayout.h> | ||
34 | #include <qlineedit.h> | ||
35 | #include <qpushbutton.h> | ||
36 | |||
37 | EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal ) | ||
38 | : QDialog( parent, name, modal ) | ||
39 | { | ||
40 | QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); | ||
41 | |||
42 | QLabel *l = new QLabel( label, this ); | ||
43 | l->setAlignment( AlignLeft | AlignTop | WordBreak ); | ||
44 | vbox->addWidget( l ); | ||
45 | |||
46 | m_entry = new QLineEdit( this ); | ||
47 | vbox->addWidget( m_entry ); | ||
48 | |||
49 | connect( m_entry, SIGNAL(returnPressed()), this, SLOT(tryAccept()) ); | ||
50 | } | ||
51 | |||
52 | void EntryDlg::setText( const QString &text ) | ||
53 | { | ||
54 | m_entry->setText( text ); | ||
55 | m_entry->selectAll(); | ||
56 | } | ||
57 | |||
58 | QString EntryDlg::getText() | ||
59 | { | ||
60 | return m_entry->text(); | ||
61 | } | ||
62 | |||
63 | QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok, | ||
64 | QWidget *parent, const char *name ) | ||
65 | { | ||
66 | EntryDlg *dlg = new EntryDlg( label, parent, name, true ); | ||
67 | dlg->setCaption( caption ); | ||
68 | dlg->setText( text ); | ||
69 | |||
70 | QString result; | ||
71 | *ok = ( dlg->exec() == QDialog::Accepted ); | ||
72 | if ( *ok ) | ||
73 | result = dlg->getText(); | ||
74 | |||
75 | delete dlg; | ||
76 | return result; | ||
77 | } | ||
78 | void EntryDlg::tryAccept() | ||
79 | { | ||
80 | if ( !m_entry->text().isEmpty() ) | ||
81 | accept(); | ||
82 | } | ||
diff --git a/noncore/settings/packagemanager/entrydlg.h b/noncore/settings/packagemanager/entrydlg.h new file mode 100644 index 0000000..33a7920 --- a/dev/null +++ b/noncore/settings/packagemanager/entrydlg.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | |||
4 | =. Copyright (c) 2004 Dan Williams <drw@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This file is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This file is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
19 | ..}^=.= = ; Public License for more details. | ||
20 | ++= -. .` .: | ||
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
29 | |||
30 | #ifndef ENTRYDLG_H | ||
31 | #define ENTRYDLG_H | ||
32 | |||
33 | #include <qdialog.h> | ||
34 | |||
35 | class QLineEdit; | ||
36 | |||
37 | class EntryDlg : public QDialog | ||
38 | { | ||
39 | Q_OBJECT | ||
40 | |||
41 | public: | ||
42 | static QString getText( const QString &caption, const QString &label, const QString &text = QString::null, | ||
43 | bool *ok = 0, QWidget *parent = 0, const char *name = 0 ); | ||
44 | |||
45 | EntryDlg( const QString &label, QWidget* parent = 0, const char* name = 0, bool modal = true ); | ||
46 | |||
47 | void setText( const QString &text ); | ||
48 | QString getText(); | ||
49 | |||
50 | private slots: | ||
51 | void tryAccept(); | ||
52 | |||
53 | private: | ||
54 | QLineEdit *m_entry; | ||
55 | }; | ||
56 | |||
57 | #endif // EntryDlg_H | ||
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 6a9ccbd..0c2ea78 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp | |||
@@ -141,6 +141,8 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap | |||
141 | break; | 141 | break; |
142 | case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); | 142 | case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); |
143 | break; | 143 | break; |
144 | case OPackage::Download : lineStr.append( tr( "download" ) ); | ||
145 | break; | ||
144 | default : | 146 | default : |
145 | break; | 147 | break; |
146 | }; | 148 | }; |
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 4611404..486561d 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -28,6 +28,7 @@ | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <qaction.h> | 30 | #include <qaction.h> |
31 | #include <qdir.h> | ||
31 | #include <qlayout.h> | 32 | #include <qlayout.h> |
32 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
33 | #include <qmenubar.h> | 34 | #include <qmenubar.h> |
@@ -37,6 +38,7 @@ | |||
37 | #include <qtoolbar.h> | 38 | #include <qtoolbar.h> |
38 | #include <qwhatsthis.h> | 39 | #include <qwhatsthis.h> |
39 | 40 | ||
41 | #include <qpe/qcopenvelope_qws.h> | ||
40 | #include <qpe/qpeapplication.h> | 42 | #include <qpe/qpeapplication.h> |
41 | #include <qpe/resource.h> | 43 | #include <qpe/resource.h> |
42 | 44 | ||
@@ -44,6 +46,7 @@ | |||
44 | #include "installdlg.h" | 46 | #include "installdlg.h" |
45 | #include "filterdlg.h" | 47 | #include "filterdlg.h" |
46 | #include "promptdlg.h" | 48 | #include "promptdlg.h" |
49 | #include "entrydlg.h" | ||
47 | 50 | ||
48 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) | 51 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) |
49 | : QMainWindow( parent, name, fl || WStyle_ContextHelp ) | 52 | : QMainWindow( parent, name, fl || WStyle_ContextHelp ) |
@@ -162,7 +165,6 @@ void MainWindow::initUI() | |||
162 | actionUpgrade->addTo( popup ); | 165 | actionUpgrade->addTo( popup ); |
163 | actionUpgrade->addTo( &m_toolBar ); | 166 | actionUpgrade->addTo( &m_toolBar ); |
164 | 167 | ||
165 | /* | ||
166 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); | 168 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); |
167 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); | 169 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); |
168 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 170 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
@@ -170,7 +172,6 @@ void MainWindow::initUI() | |||
170 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); | 172 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); |
171 | actionDownload->addTo( popup ); | 173 | actionDownload->addTo( popup ); |
172 | actionDownload->addTo( &m_toolBar ); | 174 | actionDownload->addTo( &m_toolBar ); |
173 | */ | ||
174 | 175 | ||
175 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); | 176 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); |
176 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 177 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
@@ -370,7 +371,6 @@ void MainWindow::slotUpgrade() | |||
370 | m_widgetStack.raiseWidget( dlg ); | 371 | m_widgetStack.raiseWidget( dlg ); |
371 | } | 372 | } |
372 | 373 | ||
373 | /* | ||
374 | void MainWindow::slotDownload() | 374 | void MainWindow::slotDownload() |
375 | { | 375 | { |
376 | // Retrieve list of packages selected for download (if any) | 376 | // Retrieve list of packages selected for download (if any) |
@@ -386,7 +386,8 @@ void MainWindow::slotDownload() | |||
386 | 386 | ||
387 | if ( workingPackages->isEmpty() ) | 387 | if ( workingPackages->isEmpty() ) |
388 | { | 388 | { |
389 | // No packages were selected, prompt for URL of package to download | 389 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
390 | return; | ||
390 | } | 391 | } |
391 | else | 392 | else |
392 | { | 393 | { |
@@ -394,22 +395,18 @@ void MainWindow::slotDownload() | |||
394 | m_config.setGroup( "settings" ); | 395 | m_config.setGroup( "settings" ); |
395 | QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); | 396 | QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); |
396 | 397 | ||
397 | // QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), workingDir, &ok, this ); | 398 | bool ok = false; |
398 | // if ( ok && !text.isEmpty() ) | 399 | QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this ); |
399 | // workingDir = text; // user entered something and pressed ok | 400 | if ( ok && !text.isEmpty() ) |
400 | // else | 401 | workingDir = text; // user entered something and pressed ok |
401 | // return; // user entered nothing or pressed cancel | 402 | else |
403 | return; // user entered nothing or pressed cancel | ||
402 | 404 | ||
403 | // // Store download directory in config file | 405 | // Store download directory in config file |
404 | // m_config.writeEntry( "DownloadDir", workingDir ); | 406 | m_config.writeEntry( "DownloadDir", workingDir ); |
405 | 407 | ||
406 | // Get starting directory | 408 | // Get starting directory |
407 | // char initDir[PATH_MAX]; | 409 | QDir::setCurrent( workingDir ); |
408 | // getcwd( initDir, PATH_MAX ); | ||
409 | |||
410 | // Download packages | ||
411 | |||
412 | } | ||
413 | 410 | ||
414 | // Create package manager output widget | 411 | // Create package manager output widget |
415 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, | 412 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, |
@@ -420,7 +417,7 @@ void MainWindow::slotDownload() | |||
420 | m_widgetStack.addWidget( dlg, 3 ); | 417 | m_widgetStack.addWidget( dlg, 3 ); |
421 | m_widgetStack.raiseWidget( dlg ); | 418 | m_widgetStack.raiseWidget( dlg ); |
422 | } | 419 | } |
423 | */ | 420 | } |
424 | 421 | ||
425 | void MainWindow::slotApply() | 422 | void MainWindow::slotApply() |
426 | { | 423 | { |
@@ -526,6 +523,11 @@ void MainWindow::slotCloseInstallDlg() | |||
526 | 523 | ||
527 | // Reload package list | 524 | // Reload package list |
528 | initPackageInfo(); | 525 | initPackageInfo(); |
526 | |||
527 | // Update Opie launcher links | ||
528 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
529 | QString lf = QString::null; | ||
530 | e << lf; | ||
529 | } | 531 | } |
530 | 532 | ||
531 | void MainWindow::slotConfigure() | 533 | void MainWindow::slotConfigure() |
diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h index 49bb66c..285cddf 100644 --- a/noncore/settings/packagemanager/mainwindow.h +++ b/noncore/settings/packagemanager/mainwindow.h | |||
@@ -114,7 +114,7 @@ private slots: | |||
114 | // Actions menu action slots | 114 | // Actions menu action slots |
115 | void slotUpdate(); | 115 | void slotUpdate(); |
116 | void slotUpgrade(); | 116 | void slotUpgrade(); |
117 | // void slotDownload(); | 117 | void slotDownload(); |
118 | void slotApply(); | 118 | void slotApply(); |
119 | void slotCloseInstallDlg(); | 119 | void slotCloseInstallDlg(); |
120 | void slotConfigure(); | 120 | void slotConfigure(); |
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index eeb0131..ed9ea10 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp | |||
@@ -327,8 +327,13 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, | |||
327 | } | 327 | } |
328 | }; | 328 | }; |
329 | break; | 329 | break; |
330 | //case OPackage::Download : ; | 330 | case OPackage::Download : { |
331 | // break; | 331 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) |
332 | { | ||
333 | ipkg_packages_download( &m_ipkgArgs, (*it) ); | ||
334 | } | ||
335 | }; | ||
336 | break; | ||
332 | default : break; | 337 | default : break; |
333 | }; | 338 | }; |
334 | 339 | ||
diff --git a/noncore/settings/packagemanager/packagemanager.pro b/noncore/settings/packagemanager/packagemanager.pro index 55af13e..9a64322 100644 --- a/noncore/settings/packagemanager/packagemanager.pro +++ b/noncore/settings/packagemanager/packagemanager.pro | |||
@@ -13,6 +13,7 @@ SOURCES = opackage.cpp \ | |||
13 | packageinfodlg.cpp \ | 13 | packageinfodlg.cpp \ |
14 | filterdlg.cpp \ | 14 | filterdlg.cpp \ |
15 | promptdlg.cpp \ | 15 | promptdlg.cpp \ |
16 | entrydlg.cpp \ | ||
16 | main.cpp | 17 | main.cpp |
17 | HEADERS = opackage.h \ | 18 | HEADERS = opackage.h \ |
18 | oconfitem.h \ | 19 | oconfitem.h \ |
@@ -23,7 +24,8 @@ HEADERS = opackage.h \ | |||
23 | installdlg.h \ | 24 | installdlg.h \ |
24 | packageinfodlg.h \ | 25 | packageinfodlg.h \ |
25 | filterdlg.h \ | 26 | filterdlg.h \ |
26 | promptdlg.h | 27 | promptdlg.h \ |
28 | entrydlg.h | ||
27 | 29 | ||
28 | DEFINES += IPKG_LIB | 30 | DEFINES += IPKG_LIB |
29 | DEFINES += HAVE_MKDTEMP | 31 | DEFINES += HAVE_MKDTEMP |
diff --git a/noncore/settings/packagemanager/promptdlg.cpp b/noncore/settings/packagemanager/promptdlg.cpp index 3122699..bb27190 100644 --- a/noncore/settings/packagemanager/promptdlg.cpp +++ b/noncore/settings/packagemanager/promptdlg.cpp | |||
@@ -45,7 +45,7 @@ PromptDlg::PromptDlg( const QString &caption, const QString &text, const QString | |||
45 | 45 | ||
46 | QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 2 ); | 46 | QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 2 ); |
47 | QLabel *label = new QLabel( text, this ); | 47 | QLabel *label = new QLabel( text, this ); |
48 | label->setAlignment( AlignCenter | WordBreak ); | 48 | label->setAlignment( AlignCenter | AlignTop | WordBreak ); |
49 | layout->addMultiCellWidget( label, 0, 0, 0, 1 ); | 49 | layout->addMultiCellWidget( label, 0, 0, 0, 1 ); |
50 | 50 | ||
51 | QPushButton *btn = new QPushButton( btn1, this ); | 51 | QPushButton *btn = new QPushButton( btn1, this ); |