summaryrefslogtreecommitdiff
Side-by-side diff
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,4 +1,10 @@
+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>
* Released version 0.2.0
* Converted to use libipkg in place of spawning ipkg process
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
@@ -140,8 +140,10 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap
case OPackage::Remove : lineStr.append( tr( "remove" ) );
break;
case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) );
break;
+ case OPackage::Download : lineStr.append( tr( "download" ) );
+ break;
default :
break;
};
lineStr.append( ":\n" );
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
@@ -27,8 +27,9 @@
*/
#include <qaction.h>
+#include <qdir.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmenubar.h>
#include <qmessagebox.h>
@@ -36,15 +37,17 @@
#include <qtimer.h>
#include <qtoolbar.h>
#include <qwhatsthis.h>
+#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include "mainwindow.h"
#include "installdlg.h"
#include "filterdlg.h"
#include "promptdlg.h"
+#include "entrydlg.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl )
: QMainWindow( parent, name, fl || WStyle_ContextHelp )
, m_config( "packman" )
@@ -161,17 +164,15 @@ void MainWindow::initUI()
connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) );
actionUpgrade->addTo( popup );
actionUpgrade->addTo( &m_toolBar );
-/*
QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" );
QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" );
QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) );
actionDownload->addTo( popup );
actionDownload->addTo( &m_toolBar );
-*/
a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
connect( a, SIGNAL(activated()), this, SLOT(slotApply()) );
@@ -369,9 +370,8 @@ void MainWindow::slotUpgrade()
m_widgetStack.addWidget( dlg, 3 );
m_widgetStack.raiseWidget( dlg );
}
-/*
void MainWindow::slotDownload()
{
// Retrieve list of packages selected for download (if any)
QStringList *workingPackages = new QStringList();
@@ -385,43 +385,40 @@ 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
{
// Download selected packages
m_config.setGroup( "settings" );
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()
{
QStringList *removeList = 0x0;
@@ -525,8 +522,13 @@ void MainWindow::slotCloseInstallDlg()
delete m_widgetStack.visibleWidget();
// Reload package list
initPackageInfo();
+
+ // Update Opie launcher links
+ QCopEnvelope e("QPE/System", "linkChanged(QString)");
+ QString lf = QString::null;
+ e << lf;
}
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
@@ -113,9 +113,9 @@ private slots:
// Actions menu action slots
void slotUpdate();
void slotUpgrade();
-// void slotDownload();
+ void slotDownload();
void slotApply();
void slotCloseInstallDlg();
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
@@ -326,10 +326,15 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
ipkg_packages_remove( &m_ipkgArgs, (*it), true );
}
};
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;
};
return true;
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
@@ -12,8 +12,9 @@ SOURCES = opackage.cpp \
installdlg.cpp \
packageinfodlg.cpp \
filterdlg.cpp \
promptdlg.cpp \
+ entrydlg.cpp \
main.cpp
HEADERS = opackage.h \
oconfitem.h \
oipkg.h \
@@ -22,9 +23,10 @@ HEADERS = opackage.h \
mainwindow.h \
installdlg.h \
packageinfodlg.h \
filterdlg.h \
- promptdlg.h
+ promptdlg.h \
+ entrydlg.h
DEFINES += IPKG_LIB
DEFINES += HAVE_MKDTEMP
TARGET = packagemanager
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
@@ -44,9 +44,9 @@ PromptDlg::PromptDlg( const QString &caption, const QString &text, const QString
setCaption( caption );
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 );
QPushButton *btn = new QPushButton( btn1, this );
layout->addWidget( btn, 1, 0 );