Merge branch '0704ukss' into 'ukss-dev'

Add a Mid struct and its corresponding conversion in order to avoid include...

See merge request kylin-desktop/ukui-search!343
This commit is contained in:
PengfeiZhang 2022-07-04 09:58:05 +00:00
commit 7d8d557435
4 changed files with 34 additions and 22 deletions

View File

@ -2,8 +2,6 @@
#define APPDBCOMMON_H
#include <QDir>
#include <QMetaType>
#include <QDBusArgument>
namespace UkuiSearch {
@ -12,6 +10,7 @@ namespace UkuiSearch {
struct AppInfoResult
{
public:
QString desktopPath;
QString iconName;
QString appLocalName;
@ -23,27 +22,7 @@ struct AppInfoResult
int lock;
AppInfoResult() : top(0), favorite(0), launchTimes(0), lock(0) {}
friend QDBusArgument &operator << (QDBusArgument &argument, const AppInfoResult &infoResult)
{
argument.beginStructure();
argument << infoResult.desktopPath << infoResult.iconName << infoResult.appLocalName << infoResult.firstLetter
<< infoResult.category << infoResult.top << infoResult.favorite << infoResult.launchTimes << infoResult.lock;
argument.endStructure();
return argument;
}
friend const QDBusArgument &operator >> (const QDBusArgument &argument, AppInfoResult &infoResult)
{
argument.beginStructure();
argument >> infoResult.desktopPath >> infoResult.iconName >> infoResult.appLocalName >> infoResult.firstLetter
>> infoResult.category >> infoResult.top >> infoResult.favorite >> infoResult.launchTimes >> infoResult.lock;
argument.endStructure();
return argument;
}
};
}
Q_DECLARE_METATYPE(UkuiSearch::AppInfoResult)

View File

@ -0,0 +1,31 @@
#ifndef APPINFODBUSARGUMENT_H
#define APPINFODBUSARGUMENT_H
#include <QDBusArgument>
#include "app-db-common.h"
namespace UkuiSearch {
QDBusArgument &operator << (QDBusArgument &argument, const AppInfoResult &infoResult)
{
argument.beginStructure();
argument << infoResult.desktopPath << infoResult.iconName << infoResult.appLocalName << infoResult.firstLetter
<< infoResult.category << infoResult.top << infoResult.favorite << infoResult.launchTimes << infoResult.lock;
argument.endStructure();
return argument;
}
const QDBusArgument &operator >> (const QDBusArgument &argument, AppInfoResult &infoResult)
{
argument.beginStructure();
argument >> infoResult.desktopPath >> infoResult.iconName >> infoResult.appLocalName >> infoResult.firstLetter
>> infoResult.category >> infoResult.top >> infoResult.favorite >> infoResult.launchTimes >> infoResult.lock;
argument.endStructure();
return argument;
}
}
#endif // APPINFODBUSARGUMENT_H

View File

@ -51,6 +51,7 @@ SOURCES += \
HEADERS += \
app-db-common.h \
app-info-dbus-argument.h \
common.h \
file-utils.h \
global-settings.h \

View File

@ -1,6 +1,7 @@
#include "ukui-search-app-data-service.h"
#include "app-db-manager.h"
#include "signal-transformer.h"
#include "app-info-dbus-argument.h"
#include <QDBusConnection>
#include <QDBusMetaType>