Diffstat (limited to 'noncore/settings/packagemanager/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
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 @@ -25,28 +25,31 @@ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qaction.h> +#include <qdir.h> #include <qlayout.h> #include <qlineedit.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qpopupmenu.h> #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" ) , m_packman( &m_config, this ) , m_menuBar( this ) @@ -159,21 +162,19 @@ void MainWindow::initUI() QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); 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()) ); a->addTo( popup ); a->addTo( &m_toolBar ); @@ -367,13 +368,12 @@ void MainWindow::slotUpgrade() // Display widget 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(); for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); @@ -383,47 +383,44 @@ void MainWindow::slotDownload() if ( item->isOn() ) workingPackages->append( item->text() ); } 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 ); - - // Download packages - - } + QDir::setCurrent( workingDir ); // 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; QStringList *installList = 0x0; QStringList *upgradeList = 0x0; @@ -523,12 +520,17 @@ void MainWindow::slotCloseInstallDlg() { // Close install dialog 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() { if ( m_packman.configureDlg( false ) ) { |