Commit 2b61f4e6 authored by Lukas Appelhans's avatar Lukas Appelhans

FINALLY proper input handling... fuck shit QCoreApplication

parent 07e6a2e1
......@@ -9,7 +9,7 @@
*/
#include <kcmdlineargs.h>
#include <klocalizedstring.h>
#include <kuniqueapplication.h>
#include <qcoreapplication.h>
#include <kaboutdata.h>
#include <kdebug.h>
#include "apm.h"
......@@ -79,14 +79,14 @@ int main(int argc, char** argv)
KCmdLineArgs::addCmdLineOptions(options);
// Add options from other components
KUniqueApplication::addCmdLineOptions();
//KUniqueApplication::addCmdLineOptions();
if (!KUniqueApplication::start()) {
fprintf(stderr, "Akabei is already running!\n");
return 0;
}
//if (!KUniqueApplication::start()) {
// fprintf(stderr, "Akabei is already running!\n");
// return 0;
//}
KUniqueApplication app;
QCoreApplication app(argc, argv);
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
......@@ -191,7 +191,7 @@ int main(int argc, char** argv)
for (int i = 0; i < args->count(); i++) {
rest << args->arg(i);
}
args->clear(); // Free up some memory
APM apm(type, list, opts, rest);
......
......@@ -183,20 +183,20 @@ void SyncOperation::install(QUuid , QList< Akabei::Package* > packages)
out << ",";
}
out << "." << endl;
out << i18n("Do you want to reinstall them?[y/n]");
out << i18n("Do you want to reinstall them?[Y/n]");
} else {
out << i18n("The package %1 (%2) is already installed.", local.values().first()->name(), local.values().first()->version().toByteArray().data()) << endl;
out << i18n("Do you want to reinstall it?[y/n]");
out << i18n("Do you want to reinstall it?[Y/n]");
}
out.flush();
std::string input;
getline(std::cin, input);
out << QLatin1String(input.c_str()) << endl;
if (input != i18n("y").toStdString())
if (!input.empty() && input != i18n("y").toStdString()) {
QCoreApplication::instance()->quit();
return;
}
}
kDebug() << "Let's do this";
foreach (Akabei::Package * pkg, toBeInstalled.values()) {
AkabeiClient::Backend::instance()->queue()->addPackage(pkg, AkabeiClient::Install);
......@@ -250,13 +250,14 @@ void SyncOperation::validationFinished(bool valid)
out << i18n("Installed size: %1", KIO::convertSize(installSize)) << endl;
out.flush();
out << i18n("Continue with installation?[y/n]");
out << i18n("Continue with installation?[Y/n]");
out.flush();
//std::string input;
//getline(std::cin, input);
//if (input != "y")
// return;
kDebug() << "Let's install";
std::string input;
getline(std::cin, input);
if (!input.empty() && input != i18n("y").toStdString()) {
QCoreApplication::instance()->quit();
return;
}
connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(progressChanged(int)), SLOT(showProgress(int)));
connect(AkabeiClient::Backend::instance()->transactionHandler(), SIGNAL(finished()), SLOT(finished()));
AkabeiClient::Backend::instance()->transactionHandler()->process();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment