Commit 24519792 authored by Lukas Appelhans's avatar Lukas Appelhans

Basically put all in what was in guzuta

parent bcf0bc6f
project(akabei)
cmake_minimum_required(VERSION 2.6)
find_package(KDE4 REQUIRED)
add_executable(akabei main.cpp)
include (KDE4Defaults)
include (MacroLibrary)
include_directories(${QT_INCLUDES}
${CMAKE_CURRENT_BINARY_DIR}
${KDE4_INCLUDE_DIR})
set(apm_SRCS apm.cpp main.cpp)
#qt4_automoc(${guzuta_SRCS})
kde4_add_executable(akabei ${apm_SRCS})
target_link_libraries(akabei ${KDE4_KDEUI_LIBRARY} akabeiclient)
#include <iostream>
/* This file is part of the Chakra project
int main(int argc, char **argv) {
std::cout << "Hello, world!" << std::endl;
return 0;
Copyright (C) 2011 Lukas Appelhans <l.appelhans@gmx.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include <kcmdlineargs.h>
#include <klocalizedstring.h>
#include <kuniqueapplication.h>
#include <kaboutdata.h>
#include <kdebug.h>
#include "apm.h"
int main(int argc, char** argv)
{
KAboutData aboutData("akabei", 0, ki18n("Akabei"),
QByteArray("0.0.1"),
ki18n("Chakra's CLI package manager"),
KAboutData::License_GPL,
ki18n("(C) 2011 Lukas Appelhans"),
ki18n("<a href=\"mailto:boom1992@chakra-project.org\">boom1992@chakra-project.org</a>"));
aboutData.addAuthor(ki18n("Lukas Appelhans"), ki18n("Maintainer"), "boom1992@chakra-project.org");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("S", ki18n("Sync operation"));
options.add("y", ki18n("Refresh database"));
options.add("u", ki18n("Update system"));
KCmdLineArgs::addCmdLineOptions(options);
// Add options from other components
KUniqueApplication::addCmdLineOptions();
if (!KUniqueApplication::start()) {
fprintf(stderr, "Akabei is already running!\n");
return 0;
}
KUniqueApplication app;
//kError() << "asd";
//kDebug() << "blub";
printf("bla\n");
//fprintf(stdout, "asdsad\n");
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QList<APM::Operation> list;
APM::OperationType type = APM::NoType;
if (args->isSet("S")) {
type = APM::SyncOperation;
if (args->isSet("y"))
list.append(APM::UpdateDatabases);
if (args->isSet("y"))
list.append(APM::UpdateSystem);
}
QStringList rest;
for (int i = 0; i < args->count(); i++)
{
rest << args->arg(i);
}
args->clear(); // Free up some memory
APM apm;
apm.start(type, list, rest);
/* // A binary option (on / off)
if (args->isSet("some-option"))
....
// An option which takes an additional argument
QString anotherOptionArg = args->getOption("another-option");
// Arguments (e.g. files to open)
for(int i = 0; i < args->count(); i++) // Counting start at 0!
{
openFile( args->arg(i));
// Or more convenient:
// openUrl( args->url(i));
}
args->clear(); // Free up some memory.
....
}*/
return app.exec();
}
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