Diffstat (limited to 'noncore/settings/packagemanager/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 50 |
1 files changed, 26 insertions, 24 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 @@ -19,40 +19,43 @@ ..}^=.= = ; 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 <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 ) , m_toolBar( this ) , m_findBar( this ) , m_widgetStack( this ) , m_packageList( this ) , m_statusWidget( this ) , m_statusText( &m_statusWidget ) @@ -153,33 +156,31 @@ void MainWindow::initUI() QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); a->addTo( popup ); a->addTo( &m_toolBar ); 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 ); popup->insertSeparator(); a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to configure this application." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); @@ -361,75 +362,71 @@ void MainWindow::slotUpdate() void MainWindow::slotUpgrade() { // Create package manager output widget InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, OPackage::Upgrade ); connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); // 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()); item != 0 ; item = static_cast<QCheckListItem *>(item->nextSibling()) ) { 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 ); + 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; QStringList *installList = 0x0; QStringList *upgradeList = 0x0; for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); item != 0 ; item = static_cast<QCheckListItem *>(item->nextSibling()) ) { if ( item->isOn() ) @@ -517,24 +514,29 @@ void MainWindow::slotApply() // Display widget m_widgetStack.addWidget( dlg, 3 ); m_widgetStack.raiseWidget( dlg ); } 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 ) ) { if ( PromptDlg::ask( tr( "Config updated" ), tr( "The configuration has been updated. Do you want to update server and package information now?" ), tr( "Yes" ), tr( "No" ), this ) == 1 ) { // Update package list and reload package info slotUpdate(); |