[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/libs/plasma/appletbrowser
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-09-29 23:52:04
Message-ID: 1222732324.031656.32401.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 866084 by aseigo:

this is still messed up =/


 M  +16 -9     openwidgetassistant.cpp  


--- trunk/KDE/kdebase/workspace/libs/plasma/appletbrowser/openwidgetassistant.cpp \
#866083:866084 @@ -25,6 +25,7 @@
 #include <KDebug>
 #include <kfilewidget.h>
 #include <KListWidget>
+#include <KMessageBox>
 #include <KService>
 #include <KServiceTypeTrader>
 #include <KStandardDirs>
@@ -82,7 +83,6 @@
     addPage(m_filePage);
 
     connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), \
                SLOT(prepPage(KPageWidgetItem*,KPageWidgetItem*)));
-    connect(this, SIGNAL(user1Clicked()), this, SLOT(finished()));
     enableButton( KDialog::Help, false );
     //connect( this, SIGNAL( helpClicked() ), this, SLOT( slotHelpClicked() ) );
     m_widgetTypeList->setFocus();
@@ -109,6 +109,8 @@
         m_fileDialog = new KFileWidget(KUrl(), m_filePageWidget);
         m_fileDialog->setOperationMode(KFileWidget::Opening);
         m_fileDialog->setMode(KFile::File | KFile::ExistingOnly);
+        connect(this, SIGNAL(user1Clicked()), m_fileDialog, SLOT(slotOk()));
+        connect(m_fileDialog, SIGNAL(accepted()), this, SLOT(finished()));
         //m_fileDialog->setWindowFlags(Qt::Widget);
         layout->addWidget(m_fileDialog);
     }
@@ -151,15 +153,15 @@
 
 void OpenWidgetAssistant::finished()
 {
-    m_fileDialog->slotOk();
     m_fileDialog->accept(); // how interesting .. accept() must be called before the \
                state is set
-
-    if (m_fileDialog->selectedFile().isEmpty()) {
+    QString packageFilePath = m_fileDialog->selectedFile();
+    if (packageFilePath.isEmpty()) {
         //TODO: user visible error handling
+        kDebug() << "hm. no file path?";
         return;
     }
 
-    //kDebug() << "selected uri is" << m_fileDialog->selectedFile() << "of type" << \
m_fileDialog->currentFilter(); +    kDebug() << "selected uri is" << packageFilePath \
<< "of type" << m_fileDialog->currentFilter();  PackageStructure *installer = 0;
     if (m_packageStructureService) {
         QString error;
@@ -167,6 +169,9 @@
         if (!installer) {
             kDebug() << "Could not load requested PackageStructure installer "
                      << m_packageStructureService << ". Error given: " << error;
+            KMessageBox::error(this, i18n("Could not load the required installer %1. \
The error given was: ", +                                          \
m_packageStructureService, error), +                               i18n("Installation \
Failure"));  return;
         }
     } else {
@@ -174,12 +179,14 @@
     }
 
     QString root = KStandardDirs::locateLocal("data", "plasma/plasmoids/");
-    //kDebug() << "installing to root dir of" << root;
-    bool success = installer->installPackage(m_fileDialog->selectedFile(), root);
+    kDebug() << "installing" << packageFilePath << "to root dir of" << root;
+    bool success = installer->installPackage(packageFilePath, root);
 
     delete installer;
-    kDebug() << "install returned. were we successful?" << success;
-    //TODO: user visible feedback
+    if (!success) {
+        KMessageBox::error(this, i18n("Installing the package %1 failed.", \
packageFilePath), +                           i18n("Installation Failure"));
+    }
 }
 
 } // Plasma namespace


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic