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

88 lines
2.9 KiB
C
Raw Normal View History

2023-04-11 10:19:35 +08:00
/*
*
* Copyright (C) 2023, KylinSoft Co., Ltd.
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Authors: iaom <zhangpengfei@kylinos.cn>
*/
2022-03-01 17:39:53 +08:00
#ifndef APPINFOTABLEPRIVATE_H
#define APPINFOTABLEPRIVATE_H
#include "app-info-table.h"
2022-03-01 17:39:53 +08:00
#include <QObject>
#include <QDBusInterface>
#include <QSqlDatabase>
2022-03-01 17:39:53 +08:00
namespace UkuiSearch {
2022-03-01 17:39:53 +08:00
class AppInfoTablePrivate : public QObject
{
Q_OBJECT
friend class AppInfoTable;
2022-03-01 17:39:53 +08:00
public:
explicit AppInfoTablePrivate(AppInfoTable *parent = nullptr);
AppInfoTablePrivate(AppInfoTablePrivate &) = delete;
AppInfoTablePrivate &operator =(const AppInfoTablePrivate &) = delete;
//设置应用的置顶和收藏
void setAppFavoritesState(const QString &desktopfp);
void setAppFavoritesState(const QString &desktopfp, uint num);
void setAppTopState(const QString &desktopfp);
void setAppTopState(const QString &desktopfp, uint num);
void setAppLaunchedState(const QString &desktopFilePath, bool launched);
//搜索接口
bool searchInstallApp(QString &keyWord, QStringList &installAppInfoRes);
bool searchInstallApp(QStringList &keyWord, QStringList &installAppInfoRes);
//数据库错误信息
QString lastError() const;
//通过pid查找desktop文件
bool tranPidToDesktopFp(uint pid, QString &desktopfp);
bool tranWinIdToDesktopFilePath(const QVariant &winId, QString &desktopfp);
bool desktopFilePathFromName(const QString &desktopFileName, QString &desktopFilePath);
//下面的接口都不外放,暂时没啥用
2023-03-14 16:06:37 +08:00
bool setAppLaunchTimes(const QString &desktopfp, size_t num);
bool updateAppLaunchTimes(const QString &desktopfp);
bool setAppLockState(const QString &desktopfp, size_t num);
2022-03-01 17:39:53 +08:00
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;
2022-03-01 17:39:53 +08:00
public Q_SLOTS:
void sendAppDBItemsUpdate(UkuiSearch::ApplicationInfoMap results);
void sendAppDBItemsUpdateAll(QStringList desktopFilePaths);
void sendAppDBItemsAdd(QStringList desktopFilePaths);
void sendAppDBItemsDelete(QStringList desktopFilePaths);
2022-03-01 17:39:53 +08:00
};
}
#endif // APPINFOTABLEPRIVATE_H