Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Chakra
Akabei
Akabei frontend
Commits
ee4d62a4
Commit
ee4d62a4
authored
Apr 01, 2011
by
Lukas Appelhans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start with -Qi
parent
0779d6e7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
11 deletions
+103
-11
CMakeLists.txt
CMakeLists.txt
+1
-1
apm.cpp
apm.cpp
+6
-0
apm.h
apm.h
+5
-5
main.cpp
main.cpp
+8
-5
queryoperation.cpp
queryoperation.cpp
+50
-0
queryoperation.h
queryoperation.h
+33
-0
No files found.
CMakeLists.txt
View file @
ee4d62a4
...
...
@@ -15,7 +15,7 @@ include_directories(${QT_INCLUDES}
${
AKABEICLIENT_INCLUDE_DIR
}
${
AKABEICORE_INCLUDE_DIR
}
)
set
(
apm_SRCS apm.cpp main.cpp
)
set
(
apm_SRCS apm.cpp
queryoperation.cpp
main.cpp
)
#qt4_automoc(${guzuta_SRCS})
kde4_add_executable
(
akabei
${
apm_SRCS
}
)
target_link_libraries
(
akabei
${
KDE4_KDEUI_LIBRARY
}
${
AKABEICLIENT_LIBRARIES
}
)
apm.cpp
View file @
ee4d62a4
...
...
@@ -9,6 +9,8 @@
*/
#include "apm.h"
#include "queryoperation.h"
#include <akabeiclient/akabeiclientbackend.h>
#include <kdebug.h>
...
...
@@ -42,6 +44,10 @@ void APM::statusChanged(Akabei::Backend::Status status)
void
APM
::
start
()
{
if
(
m_operationType
==
QueryOperationType
)
{
QueryOperation
*
query
=
new
QueryOperation
(
this
);
query
->
start
(
m_operations
,
m_args
);
}
QTextStream
out
(
stdout
);
//out << endl;
out
<<
"blub"
;
...
...
apm.h
View file @
ee4d62a4
...
...
@@ -21,11 +21,11 @@ Q_OBJECT
public:
enum
OperationType
{
NoType
=
0
,
DatabaseOperation
=
1
,
QueryOperation
=
2
,
RemoveOperation
=
3
,
SyncOperation
=
4
,
UpgradeOperation
=
5
DatabaseOperation
Type
=
1
,
QueryOperation
Type
=
2
,
RemoveOperation
Type
=
3
,
SyncOperation
Type
=
4
,
UpgradeOperation
Type
=
5
};
enum
Operation
{
NoOperation
=
0
,
...
...
main.cpp
View file @
ee4d62a4
...
...
@@ -24,6 +24,7 @@ int main(int argc, char** argv)
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
;
...
...
@@ -52,6 +53,8 @@ int main(int argc, char** argv)
options
.
add
(
"u"
,
ki18n
(
"Update system"
));
options
.
add
(
"U"
,
ki18n
(
"Upgrade operation"
));
options
.
add
(
"+[arg1]"
,
ki18n
(
"An optional argument 'arg1'"
));
KCmdLineArgs
::
addCmdLineOptions
(
options
);
...
...
@@ -71,9 +74,9 @@ int main(int argc, char** argv)
APM
::
OperationType
type
=
APM
::
NoType
;
if
(
args
->
isSet
(
"D"
))
{
type
=
APM
::
DatabaseOperation
;
type
=
APM
::
DatabaseOperation
Type
;
}
else
if
(
args
->
isSet
(
"Q"
))
{
type
=
APM
::
QueryOperation
;
type
=
APM
::
QueryOperation
Type
;
if
(
args
->
isSet
(
"c"
))
list
.
append
(
APM
::
ShowChangelog
);
if
(
args
->
isSet
(
"d"
))
...
...
@@ -101,15 +104,15 @@ int main(int argc, char** argv)
if
(
args
->
isSet
(
"q"
))
list
.
append
(
APM
::
ShowLess
);
}
else
if
(
args
->
isSet
(
"R"
))
{
type
=
APM
::
RemoveOperation
;
type
=
APM
::
RemoveOperation
Type
;
}
else
if
(
args
->
isSet
(
"S"
))
{
type
=
APM
::
SyncOperation
;
type
=
APM
::
SyncOperation
Type
;
if
(
args
->
isSet
(
"y"
))
list
.
append
(
APM
::
UpdateDatabases
);
if
(
args
->
isSet
(
"u"
))
list
.
append
(
APM
::
UpdateSystem
);
}
else
if
(
args
->
isSet
(
"U"
))
{
type
=
APM
::
UpgradeOperation
;
type
=
APM
::
UpgradeOperation
Type
;
}
else
{
fprintf
(
stderr
,
"Please select an operation to do!
\n
Call akabei --help for explanation.
\n
"
);
return
app
.
exec
();
...
...
queryoperation.cpp
0 → 100644
View file @
ee4d62a4
/* This file is part of the Chakra project
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 "queryoperation.h"
#include <akabeibackend.h>
#include <klocale.h>
#include <QTextStream>
QueryOperation
::
QueryOperation
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
QueryOperation
::~
QueryOperation
()
{
}
void
QueryOperation
::
start
(
QList
<
APM
::
Operation
>
operations
,
QStringList
args
)
{
if
(
operations
.
contains
(
APM
::
ShowInformation
))
{
if
(
args
.
isEmpty
())
return
;
connect
(
Akabei
::
Backend
::
instance
(),
SIGNAL
(
queryPackagesCompleted
(
QUuid
,
QList
<
Akabei
::
Package
*>
)),
SLOT
(
showInformation
(
QUuid
,
QList
<
Akabei
::
Package
*>
)));
Akabei
::
Backend
::
instance
()
->
searchPackages
(
args
.
first
());
}
}
void
QueryOperation
::
showInformation
(
QUuid
uuid
,
QList
<
Akabei
::
Package
*>
packages
)
{
Q_UNUSED
(
uuid
)
if
(
packages
.
isEmpty
())
return
;
Akabei
::
Package
*
pkg
=
packages
.
first
();
QTextStream
out
(
stdout
);
out
<<
i18n
(
"Name:"
)
<<
pkg
->
name
()
<<
endl
;
out
<<
i18n
(
"Version:"
)
<<
QString
(
pkg
->
version
().
toByteArray
().
data
())
<<
endl
;
out
<<
i18n
(
"URL"
)
<<
pkg
->
url
().
toString
()
<<
endl
;
out
.
flush
();
}
queryoperation.h
0 → 100644
View file @
ee4d62a4
/* This file is part of the Chakra project
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.
*/
#ifndef QUERYOPERATION_H
#define QUERYOPERATION_H
#include <QObject>
#include <QUuid>
#include "apm.h"
#include <akabeipackage.h>
class
QueryOperation
:
public
QObject
{
Q_OBJECT
public:
explicit
QueryOperation
(
QObject
*
parent
=
0
);
virtual
~
QueryOperation
();
void
start
(
QList
<
APM
::
Operation
>
operations
,
QStringList
args
);
private
slots
:
void
showInformation
(
QUuid
uuid
,
QList
<
Akabei
::
Package
*>
packages
);
};
#endif // QUERYOPERATION_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment