Commit a5fa0c10 authored by Lisa's avatar Lisa

Cleanup of user messages and code.

Removing dead commented code, simplified if-else statement,
and displayed more sophisticated message for empty queue.
parent 9fb12d98
......@@ -88,7 +88,12 @@ void QueueOperation::start(AkabeiClient::PackageAction action, QList<Akabei::Pac
}
if (AkabeiClient::Backend::instance()->queue()->size() == 0) {
out << QObject::tr("Nothing to do") << endl;
// Just picking the best message for the job :)
if (action == AkabeiClient::Update) {
out << QObject::tr("System is up-to-date.") << endl;
} else {
out << QObject::tr("Nothing to do.") << endl;
}
emit finished();
return;
}
......@@ -133,46 +138,16 @@ void QueueOperation::transactionCreated(AkabeiClient::Transaction* t)
}
out << "(" << a.letter << ")";
}
/*if (m_options.contains(APM::NoConfirm)) {
q->setAnswer(q->suggestedAnswer());
continue;
}
out << q->question() << "[";
if (q->possibleAnswers() & AkabeiClient::TransactionQuestion::Yes) {
if (q->suggestedAnswer() == AkabeiClient::TransactionQuestion::Yes)
out << QObject::tr("Y");
else
out << QObject::tr("y");
if (q->possibleAnswers() & AkabeiClient::TransactionQuestion::No)
out << QObject::tr("/");
}
if (q->possibleAnswers() & AkabeiClient::TransactionQuestion::No) {
if (q->suggestedAnswer() == AkabeiClient::TransactionQuestion::No)
out << QObject::tr("N");
else
out << QObject::tr("n");
}*/
out << QObject::tr("]");
out.flush();
std::string input;
getline(std::cin, input);
/*AkabeiClient::TransactionAnswer answer;
foreach (AkabeiClient::TransactionAnswer a, q->possibleAnswers()) {
if (a.letter == ans) {
answer = a;
break;
}
}*/
if (!input.empty()) {
q->setAnswer(QString(input.c_str()));
} else if (input.empty()) {
q->setAnswer(q->suggestedAnswer().letter);
} else {
emit finished();
return;
q->setAnswer(q->suggestedAnswer().letter);
}
}
}
......
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