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