ukui-search/libsearch/appdata/app-info-table-private.h

68 lines
2.0 KiB
C++

#ifndef APPINFOTABLEPRIVATE_H
#define APPINFOTABLEPRIVATE_H
#include "app-info-table.h"
#include <QObject>
#include <QDBusInterface>
#include <QSqlDatabase>
namespace UkuiSearch {
class AppInfoTablePrivate : public QObject
{
Q_OBJECT
friend class AppInfoTable;
public:
explicit AppInfoTablePrivate(AppInfoTable *parent = nullptr);
AppInfoTablePrivate(AppInfoTablePrivate &) = delete;
AppInfoTablePrivate &operator =(const AppInfoTablePrivate &) = delete;
//设置应用的置顶和收藏
void setAppFavoritesState(const QString &desktopfp, int num);
void setAppTopState(const QString &desktopfp, int num);
//改变置顶和收藏应用位置
bool changeFavoriteAppPos(const QString &desktopfp, int pos);
bool changeTopAppPos(const QString &desktopfp, int pos);
//搜索接口
bool searchInstallApp(QString &keyWord, QStringList &installAppInfoRes);
bool searchInstallApp(QStringList &keyWord, QStringList &installAppInfoRes);
//数据库错误信息
QString lastError(void) const;
//通过pid查找desktop文件
bool tranPidToDesktopFp(int pid, QString &desktopfp);
//下面的接口都不外放,暂时没啥用
bool setAppLaunchTimes(const QString &desktopfp, size_t num);
bool updateAppLaunchTimes(const QString &desktopfp);
bool setAppLockState(const QString &desktopfp, size_t num);
private:
~AppInfoTablePrivate();
bool initDateBaseConnection();
bool openDataBase();
void closeDataBase();
QDBusInterface *m_signalTransInterface = nullptr;
QDBusInterface *m_appDBInterface = nullptr;
AppInfoTable *q = nullptr;
QSqlDatabase *m_database = nullptr;
QString m_ConnectionName;
public Q_SLOTS:
void sendAppDBItemsUpdate(ApplicationInfoMap results);
void sendAppDBItemsUpdateAll(QStringList desktopFilePaths);
void sendAppDBItemsAdd(QStringList desktopFilePaths);
void sendAppDBItemsDelete(QStringList desktopFilePaths);
};
}
#endif // APPINFOTABLEPRIVATE_H