summaryrefslogtreecommitdiff
authordrw <drw>2004-01-24 01:30:42 (UTC)
committer drw <drw>2004-01-24 01:30:42 (UTC)
commitd542ba6a426f9868d521dbd9eb502184086535fc (patch) (side-by-side diff)
tree6c975a8d20949d10dc48f2f372b836032988dcbd
parent77ad4fd70864e36745dbee587ca959a2e56998a6 (diff)
downloadopie-d542ba6a426f9868d521dbd9eb502184086535fc.zip
opie-d542ba6a426f9868d521dbd9eb502184086535fc.tar.gz
opie-d542ba6a426f9868d521dbd9eb502184086535fc.tar.bz2
Added download packages (requires current version of libipkg) and code to have Opie update links so apps will display properly in Launcher after adding/removing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/ChangeLog6
-rw-r--r--noncore/settings/packagemanager/entrydlg.cpp82
-rw-r--r--noncore/settings/packagemanager/entrydlg.h57
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp2
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp50
-rw-r--r--noncore/settings/packagemanager/mainwindow.h2
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp9
-rw-r--r--noncore/settings/packagemanager/packagemanager.pro4
-rw-r--r--noncore/settings/packagemanager/promptdlg.cpp2
9 files changed, 185 insertions, 29 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,2 +1,8 @@
+2004-01-23 Dan Williams <drw@handhelds.org>
+
+ * Added package download functionality
+ * Have Opie update links after install/removal so that apps
+ will display properly in Launcher
+
2004-01-20 Dan Williams <drw@handhelds.org>
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 @@
+/*
+                This file is part of the OPIE Project
+
+ =. Copyright (c) 2004 Dan Williams <drw@handhelds.org>
+             .=l.
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#include "entrydlg.h"
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+
+EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal )
+ : QDialog( parent, name, modal )
+{
+ QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
+
+ QLabel *l = new QLabel( label, this );
+ l->setAlignment( AlignLeft | AlignTop | WordBreak );
+ vbox->addWidget( l );
+
+ m_entry = new QLineEdit( this );
+ vbox->addWidget( m_entry );
+
+ connect( m_entry, SIGNAL(returnPressed()), this, SLOT(tryAccept()) );
+}
+
+void EntryDlg::setText( const QString &text )
+{
+ m_entry->setText( text );
+ m_entry->selectAll();
+}
+
+QString EntryDlg::getText()
+{
+ return m_entry->text();
+}
+
+QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok,
+ QWidget *parent, const char *name )
+{
+ EntryDlg *dlg = new EntryDlg( label, parent, name, true );
+ dlg->setCaption( caption );
+ dlg->setText( text );
+
+ QString result;
+ *ok = ( dlg->exec() == QDialog::Accepted );
+ if ( *ok )
+ result = dlg->getText();
+
+ delete dlg;
+ return result;
+}
+void EntryDlg::tryAccept()
+{
+ if ( !m_entry->text().isEmpty() )
+ accept();
+}
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 @@
+/*
+                This file is part of the OPIE Project
+
+ =. Copyright (c) 2004 Dan Williams <drw@handhelds.org>
+             .=l.
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef ENTRYDLG_H
+#define ENTRYDLG_H
+
+#include <qdialog.h>
+
+class QLineEdit;
+
+class EntryDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ static QString getText( const QString &caption, const QString &label, const QString &text = QString::null,
+ bool *ok = 0, QWidget *parent = 0, const char *name = 0 );
+
+ EntryDlg( const QString &label, QWidget* parent = 0, const char* name = 0, bool modal = true );
+
+ void setText( const QString &text );
+ QString getText();
+
+private slots:
+ void tryAccept();
+
+private:
+ QLineEdit *m_entry;
+};
+
+#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
@@ -142,4 +142,6 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap
case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) );
break;
+ case OPackage::Download : lineStr.append( tr( "download" ) );
+ break;
default :
break;
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
@@ -29,4 +29,5 @@
#include <qaction.h>
+#include <qdir.h>
#include <qlayout.h>
#include <qlineedit.h>
@@ -38,4 +39,5 @@
#include <qwhatsthis.h>
+#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
@@ -45,4 +47,5 @@
#include "filterdlg.h"
#include "promptdlg.h"
+#include "entrydlg.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl )
@@ -163,5 +166,4 @@ void MainWindow::initUI()
actionUpgrade->addTo( &m_toolBar );
-/*
QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" );
QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" );
@@ -171,5 +173,4 @@ void MainWindow::initUI()
actionDownload->addTo( popup );
actionDownload->addTo( &m_toolBar );
-*/
a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 );
@@ -371,5 +372,4 @@ void MainWindow::slotUpgrade()
}
-/*
void MainWindow::slotDownload()
{
@@ -387,5 +387,6 @@ void MainWindow::slotDownload()
if ( workingPackages->isEmpty() )
{
- // No packages were selected, prompt for URL of package to download
+ QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
+ return;
}
else
@@ -395,31 +396,27 @@ void MainWindow::slotDownload()
QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" );
-// QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), workingDir, &ok, this );
-// if ( ok && !text.isEmpty() )
-// workingDir = text; // user entered something and pressed ok
-// else
-// return; // user entered nothing or pressed cancel
+ bool ok = false;
+ QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this );
+ if ( ok && !text.isEmpty() )
+ workingDir = text; // user entered something and pressed ok
+ else
+ return; // user entered nothing or pressed cancel
-// // Store download directory in config file
-// m_config.writeEntry( "DownloadDir", workingDir );
+ // Store download directory in config file
+ m_config.writeEntry( "DownloadDir", workingDir );
// Get starting directory
-// char initDir[PATH_MAX];
-// getcwd( initDir, PATH_MAX );
+ QDir::setCurrent( workingDir );
- // Download packages
+ // Create package manager output widget
+ InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false,
+ OPackage::Download, workingPackages );
+ connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
+ // Display widget
+ m_widgetStack.addWidget( dlg, 3 );
+ m_widgetStack.raiseWidget( dlg );
}
-
- // Create package manager output widget
- InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false,
- OPackage::Download, workingPackages );
- connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
-
- // Display widget
- m_widgetStack.addWidget( dlg, 3 );
- m_widgetStack.raiseWidget( dlg );
}
-*/
void MainWindow::slotApply()
@@ -527,4 +524,9 @@ void MainWindow::slotCloseInstallDlg()
// Reload package list
initPackageInfo();
+
+ // Update Opie launcher links
+ QCopEnvelope e("QPE/System", "linkChanged(QString)");
+ QString lf = QString::null;
+ e << lf;
}
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
@@ -115,5 +115,5 @@ private slots:
void slotUpdate();
void slotUpgrade();
-// void slotDownload();
+ void slotDownload();
void slotApply();
void slotCloseInstallDlg();
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
@@ -328,6 +328,11 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
};
break;
- //case OPackage::Download : ;
- // break;
+ case OPackage::Download : {
+ for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
+ {
+ ipkg_packages_download( &m_ipkgArgs, (*it) );
+ }
+ };
+ break;
default : break;
};
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
@@ -14,4 +14,5 @@ SOURCES = opackage.cpp \
filterdlg.cpp \
promptdlg.cpp \
+ entrydlg.cpp \
main.cpp
HEADERS = opackage.h \
@@ -24,5 +25,6 @@ HEADERS = opackage.h \
packageinfodlg.h \
filterdlg.h \
- promptdlg.h
+ promptdlg.h \
+ entrydlg.h
DEFINES += IPKG_LIB
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
@@ -46,5 +46,5 @@ PromptDlg::PromptDlg( const QString &caption, const QString &text, const QString
QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 2 );
QLabel *label = new QLabel( text, this );
- label->setAlignment( AlignCenter | WordBreak );
+ label->setAlignment( AlignCenter | AlignTop | WordBreak );
layout->addMultiCellWidget( label, 0, 0, 0, 1 );