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
7c84942f
Commit
7c84942f
authored
Apr 03, 2011
by
Lukas Appelhans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-Qu works
parent
a73e3378
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
queryoperation.cpp
queryoperation.cpp
+28
-0
queryoperation.h
queryoperation.h
+1
-0
No files found.
queryoperation.cpp
View file @
7c84942f
...
...
@@ -87,6 +87,8 @@ void QueryOperation::start(QList<APM::Operation> operations, QStringList args)
showLocalQuery
(
Akabei
::
Backend
::
instance
()
->
localDatabase
()
->
queryPackages
(
query
));
}
else
if
(
operations
.
contains
(
APM
::
ShowNotRequired
))
{
showNotRequired
();
}
else
if
(
operations
.
contains
(
APM
::
ShowUpgradeable
))
{
showUpgradeable
();
}
}
...
...
@@ -255,3 +257,29 @@ void QueryOperation::showNotRequired()
out
<<
pkg
->
name
()
<<
' '
<<
pkg
->
version
().
toByteArray
().
data
()
<<
endl
;
out
.
flush
();
}
void
QueryOperation
::
showUpgradeable
()
{
//FIXME: Maybe don't even check for the highest version... redundant?
QTextStream
out
(
stdout
);
QList
<
Akabei
::
Package
*>
packages
=
Akabei
::
Backend
::
instance
()
->
localDatabase
()
->
packages
();
QMap
<
QString
,
Akabei
::
Package
*>
upgradeable
;
foreach
(
Akabei
::
Package
*
pkg
,
packages
)
{
foreach
(
Akabei
::
Database
*
db
,
Akabei
::
Backend
::
instance
()
->
databases
())
{
Akabei
::
Package
::
List
list
=
db
->
queryPackages
(
"SELECT * FROM packages WHERE Name LIKE
\"
"
+
pkg
->
name
()
+
"
\"
"
);
if
(
!
list
.
isEmpty
())
{
foreach
(
Akabei
::
Package
*
p
,
list
)
{
if
(
p
->
version
()
>
pkg
->
version
()
&&
p
->
name
()
==
pkg
->
name
())
{
if
(
upgradeable
[
p
->
name
()]
&&
upgradeable
[
p
->
name
()]
->
version
()
>
p
->
version
())
continue
;
upgradeable
[
p
->
name
()]
=
p
;
}
}
}
}
}
foreach
(
Akabei
::
Package
*
pkg
,
upgradeable
.
values
())
out
<<
pkg
->
name
()
<<
' '
<<
pkg
->
version
().
toByteArray
().
data
()
<<
endl
;
out
.
flush
();
}
queryoperation.h
View file @
7c84942f
...
...
@@ -36,6 +36,7 @@ private slots:
void
showOwner
(
const
QString
&
query
);
void
showLocalQuery
(
QList
<
Akabei
::
Package
*>
);
void
showNotRequired
();
void
showUpgradeable
();
};
#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