Commit d997241a authored by Dario Freddi's avatar Dario Freddi

Improve package and add group support

Signed-off-by: default avatarDario Freddi <drf@kde.org>
parent a202a15c
......@@ -7,6 +7,7 @@ include_directories(
set(AKABEI_CORE_SRCS
akabeibackend.cpp
akabeidatabase.cpp
akabeigroup.cpp
akabeioperation.cpp
akabeioperationrunner.cpp
akabeipackage.cpp
......
/* This file is part of the Chakra project
Copyright (C) 2010 Dario Freddi <drf@chakra-project.org>
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 "akabeigroup_p.h"
#include "akabeidatabase.h"
namespace Akabei
{
Group::Group(Database* db, int id, const QString& name)
: d_ptr(new GroupPrivate(db, id, name))
{
}
Group::~Group()
{
delete d_ptr;
}
Database* Group::database()
{
Q_D(Group);
return d->db;
}
int Group::databaseId() const
{
Q_D(const Group);
return d->id;
}
QString Group::description() const
{
Q_D(const Group);
return d->desc;
}
QString Group::name() const
{
Q_D(const Group);
return d->name;
}
QString Group::iconName() const
{
Q_D(const Group);
return d->icon;
}
QList< Akabei::Package* > Group::packages()
{
Q_D(Group);
return d->db->query("SELECT * FROM packages WHERE Groups LIKE \"%;" + d->name + ";%\"");
}
QList< Package* > Group::search(const QString& token)
{
Q_D(Group);
return d->db->query("SELECT * FROM packages WHERE Groups LIKE \"%;" + d->name + ";%\" AND "
"(Name LIKE \"%" + token + "%\" OR Description LIKE \"%" + token + "%\")");
}
}
/* This file is part of the Chakra project
Copyright (C) 2010 Dario Freddi <drf@chakra-project.org>
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 AKABEI_AKABEIGROUP_H
#define AKABEI_AKABEIGROUP_H
#include <QtCore/QObject>
#include "akabeicore_global.h"
namespace Akabei {
class Database;
class Package;
class GroupPrivate;
class AKABEICORESHARED_EXPORT Group
{
Q_DISABLE_COPY(Group)
Q_DECLARE_PRIVATE(Group)
public:
Group(Database *db, int id, const QString &name);
virtual ~Group();
int databaseId() const;
Database *database();
QString name() const;
QString description() const;
QString iconName() const;
QList<Package*> packages();
QList<Package*> search(const QString &token);
private:
GroupPrivate * const d_ptr;
};
}
#endif // AKABEI_AKABEIGROUP_H
/* This file is part of the Chakra project
Copyright (C) 2010 Dario Freddi <drf@chakra-project.org>
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 "akabeigroup.h"
namespace Akabei
{
class GroupPrivate
{
public:
GroupPrivate(Database *d, int i, const QString &n) : db(d), id(i), name(n) {}
virtual ~GroupPrivate() {}
Database *db;
int id;
QString name;
QString desc;
QString icon;
};
}
\ No newline at end of file
......@@ -28,4 +28,122 @@ QString Package::name() const
return d->name;
}
QString Package::arch() const
{
Q_D(const Package);
return d->arch;
}
QDateTime Package::buildDate() const
{
Q_D(const Package);
return d->buildDate;
}
Package::List Package::computeDependsOn()
{
}
Package::List Package::computeRequiredBy()
{
}
Database* Package::database()
{
Q_D(Package);
return d->database;
}
int Package::databaseId() const
{
Q_D(const Package);
return d->databaseId;
}
QString Package::description() const
{
Q_D(const Package);
return d->desc;
}
QString Package::filename() const
{
Q_D(const Package);
return d->filename;
}
QStringList Package::files() const
{
Q_D(const Package);
return d->files;
}
QList< Group* > Package::groups() const
{
Q_D(const Package);
return d->groups;
}
bool Package::hasScriptlet() const
{
}
QStringList Package::hooks() const
{
}
bool Package::isValid() const
{
}
QString Package::md5sum() const
{
}
QStringList Package::mimetypes() const
{
}
QString Package::packager() const
{
}
QString Package::pathToArchive() const
{
}
QStringList Package::providers() const
{
}
qint32 Package::size() const
{
}
QString Package::url() const
{
}
QString Package::version() const
{
}
void Package::setPathToArchive(const QString& path)
{
}
}
......@@ -47,7 +47,7 @@ public:
QString name() const;
QString filename() const;
QString version() const;
QString desc() const;
QString description() const;
QString url() const;
QString packager() const;
QString md5sum() const;
......@@ -60,8 +60,8 @@ public:
List computeDependsOn();
List computeRequiredBy();
QList<Group*> groups();
QStringList providers();
QList<Group*> groups() const;
QStringList providers() const;
Database *database();
bool isValid() const;
......
......@@ -43,6 +43,8 @@ public:
QStringList mimetypes;
QStringList hooks;
QList<Group*> groups;
QString archive;
};
......
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