// this is called by KviApplication when no local kvirc directory has been found // we have nothing to rely on yet... (settings have not been loaded yet) KVIMODULEEXPORTFUNC bool setup_begin() { // FIXME: try to guess the user's .kvirc directory // and the preferred nickname from a previous installation SetupWizard * w = new SetupWizard(); int retcode = w->exec(); delete w; return (retcode == QDialog::Accepted); }
int main(int argc, char** argv) { KLocalizedString::setApplicationDomain("apper"); KAboutData aboutData("apper-appsetup", "apper", APPER_VERSION, i18n("KDE Application Installer"), KAboutLicense::LicenseKey::GPL); aboutData.addAuthor(i18nc("@info:credit", "Daniel Nicoletti"), i18n("Developer"), "*****@*****.**"); aboutData.addAuthor(i18nc("@info:credit", "Matthias Klumpp"), i18n("Developer"), "*****@*****.**"); aboutData.setProductName("apper/limba"); QApplication app(argc, argv); QCommandLineParser parser; KAboutData::setApplicationData(aboutData); parser.addVersionOption(); parser.addHelpOption(); aboutData.setupCommandLine(&parser); parser.process(app); aboutData.processCommandLine(&parser); // Add --verbose as commandline option parser.addOption(QCommandLineOption(QStringList() << QLatin1String("verbose"), i18n("Show verbose information"))); parser.addPositionalArgument(QLatin1String("file"), i18n("IPK package filename")); // Set if we are in verbose mode li_set_verbose_mode(parser.isSet("verbose")); QString fname; for(int i = 0; i < parser.positionalArguments().count(); i++) { fname = parser.positionalArguments()[i]; QFileInfo file(fname); if (!file.exists()) fname = ""; else break; } // Check if we have a package if (fname.isEmpty()) { KMessageBox::sorry (0, i18n("We did not receive a path to an IPK package as parameter."), i18n("Package not found!")); return 1; } // Create & run the setup wizard SetupWizard *wizard = new SetupWizard(); wizard->initialize(fname); wizard->show(); return app.exec(); }
void SetupWizard::reboot() const { SetupWizard *wiz = const_cast<SetupWizard *>(this); wiz->setWindowFlags(wiz->windowFlags() & ~Qt::WindowStaysOnTopHint); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); Q_ASSERT(pm); UploaderGadgetFactory *uploader = pm->getObject<UploaderGadgetFactory>(); Q_ASSERT(uploader); uploader->reboot(); wiz->setRestartNeeded(false); wiz->setWindowFlags(wiz->windowFlags() | Qt::WindowStaysOnTopHint); wiz->show(); }