Commit d39af9f4 authored by Lukas Appelhans's avatar Lukas Appelhans

Little constification and add --root option to akabei-key

parent d29fab48
......@@ -415,11 +415,11 @@ void SyncOperation::updateNextDatabase()
db->update(forceDbUpdate);
}
void SyncOperation::databaseErrorTriggered(Akabei::Error::List errors)
void SyncOperation::databaseErrorTriggered(const Akabei::Error::List &errors)
{
QTextStream err(stderr);
QString message = Akabei::errorPrefix + QObject::tr("There has been an error while updating %1:").arg( static_cast<AkabeiClient::DatabaseHandler*>(QObject::sender())->name() );
foreach (Akabei::Error error, errors)
foreach (const Akabei::Error &error, errors)
message.append(' ' + error.description());
err << m_bar.replaceMessage(message) << endl;
......
......@@ -34,7 +34,7 @@ private slots:
void showGroup(QUuid,QList<Akabei::Group*>);
void databaseStatusChanged(AkabeiClient::DatabaseHandler::Status);
void databaseProgressChanged(int);
void databaseErrorTriggered(Akabei::Error::List);
void databaseErrorTriggered(const Akabei::Error::List &);
void install(QUuid,QList<Akabei::Package*>);
void nextOperation();
......
......@@ -22,7 +22,7 @@
#define YESNO(x) ((x) == 1 ? QObject::tr("yes") : QObject::tr("no"))
/* Keyring directory */
const QString AkabeiKeyringDir( "/etc/akabei.d/keyring" );
QString AkabeiKeyringDir( "/etc/akabei.d/keyring" );
using namespace std;
......@@ -41,7 +41,7 @@ void printHelp()
QTextStream out(stdout);
out << QObject::tr(":: akabei-key v2.0 (Akabei).") << endl;
out << QObject::tr("usage: akabei-key [op] [args]") << endl;
out << QObject::tr("usage: akabei-key [op] [--root /path/to/root] [args]") << endl;
out << endl;
out << "help, -h, --help" << endl;
......@@ -323,10 +323,25 @@ void getFromServer(gpgme_ctx_t ctx, QString id)
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QDir keyring(AkabeiKeyringDir);
QTextStream out( stdout );
QTextStream err( stderr );
QStringList args = QCoreApplication::arguments();
if (args.contains("--root")) {
int index = args.indexOf("--root");
if (index + 1 >= args.count()) {
printHelp();
exit(-1);
}
AkabeiKeyringDir = args[index + 1] + "/etc/akabei.d/keyring";
args.removeAt(index);
args.removeAt(index);
}
QDir keyring(AkabeiKeyringDir);
if (!keyring.exists()) {
out << QObject::tr(":: akabei-key v2.0 (akabei)") << endl;
out << QObject::tr(":: It looks like you don't have an Akabei keyring yet.") << endl;
......@@ -348,7 +363,7 @@ int main(int argc, char **argv)
exit(-1);
}
QStringList args = QCoreApplication::arguments();
if (args.size() <= 1) {
printHelp();
......
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