diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
old mode 100755
new mode 100644
diff --git a/COPYING b/COPYING
old mode 100755
new mode 100644
diff --git a/NEWS b/NEWS
old mode 100755
new mode 100644
diff --git a/README.md b/README.md
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Development-Checked.svg b/data/img/mainviewwidget/Development-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Development-Disabled.svg b/data/img/mainviewwidget/Development-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Development-Enabled.svg b/data/img/mainviewwidget/Development-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Development-Normal.svg b/data/img/mainviewwidget/Development-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Education-Checked.svg b/data/img/mainviewwidget/Education-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Education-Disabled.svg b/data/img/mainviewwidget/Education-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Education-Enabled.svg b/data/img/mainviewwidget/Education-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Education-Normal.svg b/data/img/mainviewwidget/Education-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Game-Checked.svg b/data/img/mainviewwidget/Game-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Game-Disabled.svg b/data/img/mainviewwidget/Game-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Game-Enabled.svg b/data/img/mainviewwidget/Game-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Game-Normal.svg b/data/img/mainviewwidget/Game-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Image-Checked.svg b/data/img/mainviewwidget/Image-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Image-Disabled.svg b/data/img/mainviewwidget/Image-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Image-Enabled.svg b/data/img/mainviewwidget/Image-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Image-Normal.svg b/data/img/mainviewwidget/Image-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Internet-Checked.svg b/data/img/mainviewwidget/Internet-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Internet-Disabled.svg b/data/img/mainviewwidget/Internet-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Internet-Enabled.svg b/data/img/mainviewwidget/Internet-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Internet-Normal.svg b/data/img/mainviewwidget/Internet-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Mobile-Checked.svg b/data/img/mainviewwidget/Mobile-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Mobile-Disabled.svg b/data/img/mainviewwidget/Mobile-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Mobile-Enabled.svg b/data/img/mainviewwidget/Mobile-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Mobile-Normal.svg b/data/img/mainviewwidget/Mobile-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Office-Checked.svg b/data/img/mainviewwidget/Office-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Office-Disabled.svg b/data/img/mainviewwidget/Office-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Office-Enabled.svg b/data/img/mainviewwidget/Office-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Office-Normal.svg b/data/img/mainviewwidget/Office-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Others-Checked.svg b/data/img/mainviewwidget/Others-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Others-Disabled.svg b/data/img/mainviewwidget/Others-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Others-Enabled.svg b/data/img/mainviewwidget/Others-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Others-Normal.svg b/data/img/mainviewwidget/Others-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Social-Checked.svg b/data/img/mainviewwidget/Social-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Social-Disabled.svg b/data/img/mainviewwidget/Social-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Social-Enabled.svg b/data/img/mainviewwidget/Social-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Social-Normal.svg b/data/img/mainviewwidget/Social-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/System-Checked.svg b/data/img/mainviewwidget/System-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/System-Disabled.svg b/data/img/mainviewwidget/System-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/System-Enabled.svg b/data/img/mainviewwidget/System-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/System-Normal.svg b/data/img/mainviewwidget/System-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Video-Checked.svg b/data/img/mainviewwidget/Video-Checked.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Video-Disabled.svg b/data/img/mainviewwidget/Video-Disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Video-Enabled.svg b/data/img/mainviewwidget/Video-Enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/Video-Normal.svg b/data/img/mainviewwidget/Video-Normal.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/attributeaction.svg b/data/img/mainviewwidget/attributeaction.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/downarrow-pressed.svg b/data/img/mainviewwidget/downarrow-pressed.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/downarrow.svg b/data/img/mainviewwidget/downarrow.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/fixed.svg b/data/img/mainviewwidget/fixed.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/leftarrow-hover.svg b/data/img/mainviewwidget/leftarrow-hover.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/leftarrow.svg b/data/img/mainviewwidget/leftarrow.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/lock-fs.svg b/data/img/mainviewwidget/lock-fs.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/lock.svg b/data/img/mainviewwidget/lock.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/recent-disabled.svg b/data/img/mainviewwidget/recent-disabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/recent-enabled.svg b/data/img/mainviewwidget/recent-enabled.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/recent-gray.svg b/data/img/mainviewwidget/recent-gray.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/recent.svg b/data/img/mainviewwidget/recent.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/rightarrow-hover.svg b/data/img/mainviewwidget/rightarrow-hover.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/rightarrow.svg b/data/img/mainviewwidget/rightarrow.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/search.svg b/data/img/mainviewwidget/search.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/unfixed.svg b/data/img/mainviewwidget/unfixed.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/uninstall.svg b/data/img/mainviewwidget/uninstall.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/uparrow-pressed.svg b/data/img/mainviewwidget/uparrow-pressed.svg
old mode 100755
new mode 100644
diff --git a/data/img/mainviewwidget/uparrow.svg b/data/img/mainviewwidget/uparrow.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/commonuse.svg b/data/img/sidebarwidget/commonuse.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/computer.svg b/data/img/sidebarwidget/computer.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/control.svg b/data/img/sidebarwidget/control.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/default.svg b/data/img/sidebarwidget/default.svg
deleted file mode 100755
index 7b506cb..0000000
--- a/data/img/sidebarwidget/default.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/data/img/sidebarwidget/fixed.svg b/data/img/sidebarwidget/fixed.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/fullusericon.png b/data/img/sidebarwidget/fullusericon.png
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/function.svg b/data/img/sidebarwidget/function.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/letter.svg b/data/img/sidebarwidget/letter.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/lock.svg b/data/img/sidebarwidget/lock.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/max.svg b/data/img/sidebarwidget/max.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/min.svg b/data/img/sidebarwidget/min.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/personal.svg b/data/img/sidebarwidget/personal.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/rightarrow.svg b/data/img/sidebarwidget/rightarrow.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/setting.svg b/data/img/sidebarwidget/setting.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/shutdown.svg b/data/img/sidebarwidget/shutdown.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/trash.svg b/data/img/sidebarwidget/trash.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/unfixed.svg b/data/img/sidebarwidget/unfixed.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/usericon-darkcolor.svg b/data/img/sidebarwidget/usericon-darkcolor.svg
old mode 100755
new mode 100644
diff --git a/data/img/sidebarwidget/usericon-lightcolor.svg b/data/img/sidebarwidget/usericon-lightcolor.svg
old mode 100755
new mode 100644
diff --git a/main.cpp b/main.cpp
old mode 100755
new mode 100644
diff --git a/man/ukui-menu.1 b/man/ukui-menu.1
old mode 100755
new mode 100644
diff --git a/res.qrc b/res.qrc
old mode 100755
new mode 100644
index c09c00d..fc6c8ee
--- a/res.qrc
+++ b/res.qrc
@@ -83,6 +83,5 @@
data/img/mainviewwidget/Mobile-Normal.svg
src/SearchResultWidget/pinyinWithTone.txt
src/SearchResultWidget/pinyinWithoutTone.txt
- data/img/sidebarwidget/default.svg
diff --git a/src/CommonUseWidget/commonusewidget.cpp b/src/CommonUseWidget/commonusewidget.cpp
old mode 100755
new mode 100644
diff --git a/src/CommonUseWidget/commonusewidget.h b/src/CommonUseWidget/commonusewidget.h
old mode 100755
new mode 100644
diff --git a/src/CommonUseWidget/fullcommonusewidget.cpp b/src/CommonUseWidget/fullcommonusewidget.cpp
old mode 100755
new mode 100644
diff --git a/src/CommonUseWidget/fullcommonusewidget.h b/src/CommonUseWidget/fullcommonusewidget.h
old mode 100755
new mode 100644
diff --git a/src/DBus/dbus-adaptor.cpp b/src/DBus/dbus-adaptor.cpp
old mode 100755
new mode 100644
diff --git a/src/DBus/dbus-adaptor.h b/src/DBus/dbus-adaptor.h
old mode 100755
new mode 100644
diff --git a/src/DBus/dbus.cpp b/src/DBus/dbus.cpp
old mode 100755
new mode 100644
diff --git a/src/DBus/dbus.h b/src/DBus/dbus.h
old mode 100755
new mode 100644
diff --git a/src/DBus/org.ukui.menu.xml b/src/DBus/org.ukui.menu.xml
old mode 100755
new mode 100644
diff --git a/src/FunctionWidget/fullfunctionwidget.cpp b/src/FunctionWidget/fullfunctionwidget.cpp
old mode 100755
new mode 100644
diff --git a/src/FunctionWidget/fullfunctionwidget.h b/src/FunctionWidget/fullfunctionwidget.h
old mode 100755
new mode 100644
diff --git a/src/FunctionWidget/functionbuttonwidget.cpp b/src/FunctionWidget/functionbuttonwidget.cpp
old mode 100755
new mode 100644
diff --git a/src/FunctionWidget/functionbuttonwidget.h b/src/FunctionWidget/functionbuttonwidget.h
old mode 100755
new mode 100644
diff --git a/src/FunctionWidget/functionwidget.cpp b/src/FunctionWidget/functionwidget.cpp
old mode 100755
new mode 100644
diff --git a/src/FunctionWidget/functionwidget.h b/src/FunctionWidget/functionwidget.h
old mode 100755
new mode 100644
diff --git a/src/Interface/ukuichineseletter.cpp b/src/Interface/ukuichineseletter.cpp
old mode 100755
new mode 100644
diff --git a/src/Interface/ukuichineseletter.h b/src/Interface/ukuichineseletter.h
old mode 100755
new mode 100644
diff --git a/src/Interface/ukuimenuinterface.cpp b/src/Interface/ukuimenuinterface.cpp
old mode 100755
new mode 100644
index 884ddd0..ae5e94d
--- a/src/Interface/ukuimenuinterface.cpp
+++ b/src/Interface/ukuimenuinterface.cpp
@@ -32,98 +32,91 @@ UkuiMenuInterface::UkuiMenuInterface()
{
}
-QVector UkuiMenuInterface::appInfoVector = QVector();
-QVector UkuiMenuInterface::desktopfpVector = QVector();
-QVector UkuiMenuInterface::alphabeticVector = QVector();
-QVector UkuiMenuInterface::functionalVector = QVector();
-QVector UkuiMenuInterface::allAppVector = QVector();
-QStringList UkuiMenuInterface::androidDesktopfnList = QStringList();
+QVector UkuiMenuInterface::appInfoVector=QVector();
+QVector UkuiMenuInterface::desktopfpVector=QVector();
+QVector UkuiMenuInterface::alphabeticVector=QVector();
+QVector UkuiMenuInterface::functionalVector=QVector();
+QVector UkuiMenuInterface::allAppVector=QVector();
+QStringList UkuiMenuInterface::androidDesktopfnList=QStringList();
UkuiMenuInterface::~UkuiMenuInterface()
{
}
//文件递归查询
-void UkuiMenuInterface::recursiveSearchFile(const QString &_filePath)
+void UkuiMenuInterface::recursiveSearchFile(const QString& _filePath)
{
QDir dir(_filePath);
-
if (!dir.exists()) {
return;
}
- dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+ dir.setFilter(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot);
dir.setSorting(QDir::DirsFirst);
QFileInfoList list = dir.entryInfoList();
list.removeAll(QFileInfo("/usr/share/applications/screensavers"));
-
- if (list.size() < 1) {
+ if(list.size()< 1 ) {
return;
}
-
- int i = 0;
+ int i=0;
//递归算法的核心部分
- do {
+ do{
QFileInfo fileInfo = list.at(i);
//如果是文件夹,递归
bool isDir = fileInfo.isDir();
-
- if (isDir) {
+ if(isDir) {
recursiveSearchFile(fileInfo.filePath());
- } else {
+ }
+ else{
//过滤后缀不是.desktop的文件
- QString filePathStr = fileInfo.filePath();
-
- if (!filePathStr.endsWith(".desktop")) {
+ QString filePathStr=fileInfo.filePath();
+ if(!filePathStr.endsWith(".desktop"))
+ {
i++;
continue;
}
- QByteArray fpbyte = filePathStr.toLocal8Bit();
- char *filepath = fpbyte.data();
-
- if (0 != access(filepath, R_OK)) { //判断文件是否可读
+ QByteArray fpbyte=filePathStr.toLocal8Bit();
+ char* filepath=fpbyte.data();
+ if(0!=access(filepath,R_OK))//判断文件是否可读
+ {
i++;
continue;
}
- keyfile = g_key_file_new();
-
- if (!g_key_file_load_from_file(keyfile, filepath, flags, error)) {
+ keyfile=g_key_file_new();
+ if(!g_key_file_load_from_file(keyfile,filepath,flags,error))
return;
- }
- char *ret_0 = g_key_file_get_locale_string(keyfile, "Desktop Entry", "Categories", nullptr, nullptr);
-
- if (ret_0 != nullptr) {
+ char* ret_0 = g_key_file_get_locale_string(keyfile,"Desktop Entry","Categories", nullptr, nullptr);
+ if(ret_0 != nullptr)
+ {
QString str = QString::fromLocal8Bit(ret_0);
-
- if (str.contains("Android")) {
+ if(str.contains("Android"))
+ {
g_key_file_free(keyfile);
i++;
continue;
}
}
-
- char *ret_1 = g_key_file_get_locale_string(keyfile, "Desktop Entry", "NoDisplay", nullptr, nullptr);
-
- if (ret_1 != nullptr) {
- QString str = QString::fromLocal8Bit(ret_1);
-
- if (str.contains("true")) {
+ char* ret_1=g_key_file_get_locale_string(keyfile,"Desktop Entry","NoDisplay", nullptr, nullptr);
+ if(ret_1!=nullptr)
+ {
+ QString str=QString::fromLocal8Bit(ret_1);
+ if(str.contains("true"))
+ {
g_key_file_free(keyfile);
i++;
continue;
}
}
-
- char *ret_2 = g_key_file_get_locale_string(keyfile, "Desktop Entry", "NotShowIn", nullptr, nullptr);
-
- if (ret_2 != nullptr) {
- QString str = QString::fromLocal8Bit(ret_2);
-
- if (str.contains("UKUI")) {
+ char* ret_2=g_key_file_get_locale_string(keyfile,"Desktop Entry","NotShowIn", nullptr, nullptr);
+ if(ret_2!=nullptr)
+ {
+ QString str=QString::fromLocal8Bit(ret_2);
+ if(str.contains("UKUI"))
+ {
g_key_file_free(keyfile);
i++;
continue;
@@ -131,12 +124,12 @@ void UkuiMenuInterface::recursiveSearchFile(const QString &_filePath)
}
//过滤LXQt、KDE
- char *ret = g_key_file_get_locale_string(keyfile, "Desktop Entry", "OnlyShowIn", nullptr, nullptr);
-
- if (ret != nullptr) {
- QString str = QString::fromLocal8Bit(ret);
-
- if (str.contains("LXQt") || str.contains("KDE")) {
+ char* ret=g_key_file_get_locale_string(keyfile,"Desktop Entry","OnlyShowIn", nullptr, nullptr);
+ if(ret!=nullptr)
+ {
+ QString str=QString::fromLocal8Bit(ret);
+ if(str.contains("LXQt") || str.contains("KDE"))
+ {
g_key_file_free(keyfile);
i++;
continue;
@@ -146,61 +139,68 @@ void UkuiMenuInterface::recursiveSearchFile(const QString &_filePath)
g_key_file_free(keyfile);
filePathList.append(filePathStr);
}
-
i++;
- } while (i < list.size());
+
+ } while(i < list.size());
}
//获取系统desktop文件路径
QStringList UkuiMenuInterface::getDesktopFilePath()
{
filePathList.clear();
- QString jsonPath = QDir::homePath() + "/.config/ukui-menu-security-config.json";
+
+ QString jsonPath=QDir::homePath()+"/.config/ukui-menu-security-config.json";
QFile file(jsonPath);
-
- if (file.exists()) {
+ if(file.exists())
+ {
file.open(QIODevice::ReadOnly);
- QByteArray readBy = file.readAll();
+ QByteArray readBy=file.readAll();
QJsonParseError error;
- QJsonDocument readDoc = QJsonDocument::fromJson(readBy, &error);
-
- if (!readDoc.isNull() && error.error == QJsonParseError::NoError) {
- QJsonObject obj = readDoc.object().value("ukui-menu").toObject();
-
- if (obj.value("mode").toString() == "whitelist") {
- QJsonArray blArray = obj.value("whitelist").toArray();
- QJsonArray enArray = blArray.at(0).toObject().value("entries").toArray();
-
- for (int index = 0; index < enArray.size(); index++) {
- QJsonObject obj = enArray.at(index).toObject();
+ QJsonDocument readDoc=QJsonDocument::fromJson(readBy,&error);
+ if(!readDoc.isNull() && error.error==QJsonParseError::NoError)
+ {
+ QJsonObject obj=readDoc.object().value("ukui-menu").toObject();
+ if(obj.value("mode").toString()=="whitelist")
+ {
+ QJsonArray blArray=obj.value("whitelist").toArray();
+ QJsonArray enArray=blArray.at(0).toObject().value("entries").toArray();
+ for(int index=0;index UkuiMenuInterface::createAppInfoVector()
desktopfpVector.clear();
QVector appInfoVector;
QVector vector;
- vector.append(QStringList() << "Android"); //0安卓
- vector.append(QStringList() << "Network"); //1网络
- vector.append(QStringList() << "Messaging"); //2社交
- vector.append(QStringList() << "Audio" << "Video"); //3影音
- vector.append(QStringList() << "Development"); //4开发
- vector.append(QStringList() << "Graphics"); //5图像
- vector.append(QStringList() << "Game"); //6游戏
- vector.append(QStringList() << "Office" << "Calculator" << "Spreadsheet" << "Presentation" << "WordProcessor" << "TextEditor"); //7办公
- vector.append(QStringList() << "Education"); //8教育
- vector.append(QStringList() << "System" << "Settings" << "Security"); //9系统
- QStringList desktopfpList = getDesktopFilePath();
+ vector.append(QStringList()<<"Android");//0安卓
+ vector.append(QStringList()<<"Network");//1网络
+ vector.append(QStringList()<<"Messaging");//2社交
+ vector.append(QStringList()<<"Audio"<<"Video");//3影音
+ vector.append(QStringList()<<"Development");//4开发
+ vector.append(QStringList()<<"Graphics");//5图像
+ vector.append(QStringList()<<"Game");//6游戏
+ vector.append(QStringList()<<"Office"<<"Calculator"<<"Spreadsheet"<<"Presentation"<<"WordProcessor"<<"TextEditor");//7办公
+ vector.append(QStringList()<<"Education");//8教育
+ vector.append(QStringList()<<"System"<<"Settings"<<"Security");//9系统
- for (int i = 0; i < desktopfpList.count(); i++) {
+ QStringList desktopfpList=getDesktopFilePath();
+
+ for(int i=0;i UkuiMenuInterface::createAppInfoVector()
//获取应用名称
QString UkuiMenuInterface::getAppName(QString desktopfp)
{
- GError **error = nullptr;
- GKeyFileFlags flags = G_KEY_FILE_NONE;
- GKeyFile *keyfile = g_key_file_new();
- QByteArray fpbyte = desktopfp.toLocal8Bit();
- char *filepath = fpbyte.data();
- g_key_file_load_from_file(keyfile, filepath, flags, error);
- char *name = g_key_file_get_locale_string(keyfile, "Desktop Entry", "Name", nullptr, nullptr);
- QString namestr = QString::fromLocal8Bit(name);
+ GError** error=nullptr;
+ GKeyFileFlags flags=G_KEY_FILE_NONE;
+ GKeyFile* keyfile=g_key_file_new ();
+
+ QByteArray fpbyte=desktopfp.toLocal8Bit();
+ char* filepath=fpbyte.data();
+ g_key_file_load_from_file(keyfile,filepath,flags,error);
+
+ char* name=g_key_file_get_locale_string(keyfile,"Desktop Entry","Name", nullptr, nullptr);
+ QString namestr=QString::fromLocal8Bit(name);
+
g_key_file_free(keyfile);
return namestr;
}
@@ -331,41 +339,44 @@ QString UkuiMenuInterface::getAppName(QString desktopfp)
//获取英应用英文名
QString UkuiMenuInterface::getAppEnglishName(QString desktopfp)
{
- GError **error = nullptr;
- GKeyFileFlags flags = G_KEY_FILE_NONE;
- GKeyFile *keyfile = g_key_file_new();
- QByteArray fpbyte = desktopfp.toLocal8Bit();
- char *filepath = fpbyte.data();
- g_key_file_load_from_file(keyfile, filepath, flags, error);
- char *name = g_key_file_get_string(keyfile, "Desktop Entry", "Name", nullptr);
- QString namestr = QString::fromLocal8Bit(name);
+ GError** error=nullptr;
+ GKeyFileFlags flags=G_KEY_FILE_NONE;
+ GKeyFile* keyfile=g_key_file_new ();
+
+ QByteArray fpbyte=desktopfp.toLocal8Bit();
+ char* filepath=fpbyte.data();
+ g_key_file_load_from_file(keyfile,filepath,flags,error);
+ char* name=g_key_file_get_string(keyfile,"Desktop Entry","Name", nullptr);
+ QString namestr=QString::fromLocal8Bit(name);
return namestr;
}
//获取应用分类
QString UkuiMenuInterface::getAppCategories(QString desktopfp)
{
- GError **error = nullptr;
- GKeyFileFlags flags = G_KEY_FILE_NONE;
- GKeyFile *keyfile = g_key_file_new();
- QByteArray fpbyte = desktopfp.toLocal8Bit();
- char *filepath = fpbyte.data();
- g_key_file_load_from_file(keyfile, filepath, flags, error);
- char *category = g_key_file_get_locale_string(keyfile, "Desktop Entry", "Categories", nullptr, nullptr);
+ GError** error=nullptr;
+ GKeyFileFlags flags=G_KEY_FILE_NONE;
+ GKeyFile* keyfile=g_key_file_new ();
+
+ QByteArray fpbyte=desktopfp.toLocal8Bit();
+ char* filepath=fpbyte.data();
+ g_key_file_load_from_file(keyfile,filepath,flags,error);
+ char* category=g_key_file_get_locale_string(keyfile,"Desktop Entry","Categories", nullptr, nullptr);
g_key_file_free(keyfile);
return QString::fromLocal8Bit(category);
}
//获取应用图标
QString UkuiMenuInterface::getAppIcon(QString desktopfp)
-{
- GError **error = nullptr;
- GKeyFileFlags flags = G_KEY_FILE_NONE;
- GKeyFile *keyfile = g_key_file_new();
- QByteArray fpbyte = desktopfp.toLocal8Bit();
- char *filepath = fpbyte.data();
- g_key_file_load_from_file(keyfile, filepath, flags, error);
- char *icon = g_key_file_get_locale_string(keyfile, "Desktop Entry", "Icon", nullptr, nullptr);
+{
+ GError** error=nullptr;
+ GKeyFileFlags flags=G_KEY_FILE_NONE;
+ GKeyFile* keyfile=g_key_file_new ();
+
+ QByteArray fpbyte=desktopfp.toLocal8Bit();
+ char* filepath=fpbyte.data();
+ g_key_file_load_from_file(keyfile,filepath,flags,error);
+ char* icon=g_key_file_get_locale_string(keyfile,"Desktop Entry","Icon", nullptr, nullptr);
g_key_file_free(keyfile);
return QString::fromLocal8Bit(icon);
}
@@ -373,13 +384,14 @@ QString UkuiMenuInterface::getAppIcon(QString desktopfp)
//获取应用命令
QString UkuiMenuInterface::getAppExec(QString desktopfp)
{
- GError **error = nullptr;
- GKeyFileFlags flags = G_KEY_FILE_NONE;
- GKeyFile *keyfile = g_key_file_new();
- QByteArray fpbyte = desktopfp.toLocal8Bit();
- char *filepath = fpbyte.data();
- g_key_file_load_from_file(keyfile, filepath, flags, error);
- char *exec = g_key_file_get_locale_string(keyfile, "Desktop Entry", "Exec", nullptr, nullptr);
+ GError** error=nullptr;
+ GKeyFileFlags flags=G_KEY_FILE_NONE;
+ GKeyFile* keyfile=g_key_file_new ();
+
+ QByteArray fpbyte=desktopfp.toLocal8Bit();
+ char* filepath=fpbyte.data();
+ g_key_file_load_from_file(keyfile,filepath,flags,error);
+ char* exec=g_key_file_get_locale_string(keyfile,"Desktop Entry","Exec", nullptr, nullptr);
g_key_file_free(keyfile);
return QString::fromLocal8Bit(exec);
}
@@ -387,27 +399,30 @@ QString UkuiMenuInterface::getAppExec(QString desktopfp)
//获取应用注释
QString UkuiMenuInterface::getAppComment(QString desktopfp)
{
- GError **error = nullptr;
- GKeyFileFlags flags = G_KEY_FILE_NONE;
- GKeyFile *keyfile = g_key_file_new();
- QByteArray fpbyte = desktopfp.toLocal8Bit();
- char *filepath = fpbyte.data();
- g_key_file_load_from_file(keyfile, filepath, flags, error);
- char *comment = g_key_file_get_locale_string(keyfile, "Desktop Entry", "Comment", nullptr, nullptr);
+ GError** error=nullptr;
+ GKeyFileFlags flags=G_KEY_FILE_NONE;
+ GKeyFile* keyfile=g_key_file_new ();
+
+ QByteArray fpbyte=desktopfp.toLocal8Bit();
+ char* filepath=fpbyte.data();
+ g_key_file_load_from_file(keyfile,filepath,flags,error);
+ char* comment=g_key_file_get_locale_string(keyfile,"Desktop Entry","Comment", nullptr, nullptr);
g_key_file_free(keyfile);
return QString::fromLocal8Bit(comment);
+
}
//获取应用类型
QString UkuiMenuInterface::getAppType(QString desktopfp)
{
- GError **error = nullptr;
- GKeyFileFlags flags = G_KEY_FILE_NONE;
- GKeyFile *keyfile = g_key_file_new();
- QByteArray fpbyte = desktopfp.toLocal8Bit();
- char *filepath = fpbyte.data();
- g_key_file_load_from_file(keyfile, filepath, flags, error);
- char *type = g_key_file_get_locale_string(keyfile, "Desktop Entry", "Type", nullptr, nullptr);
+ GError** error=nullptr;
+ GKeyFileFlags flags=G_KEY_FILE_NONE;
+ GKeyFile* keyfile=g_key_file_new ();
+
+ QByteArray fpbyte=desktopfp.toLocal8Bit();
+ char* filepath=fpbyte.data();
+ g_key_file_load_from_file(keyfile,filepath,flags,error);
+ char* type=g_key_file_get_locale_string(keyfile,"Desktop Entry","Type", nullptr, nullptr);
g_key_file_free(keyfile);
return QString::fromLocal8Bit(type);
}
@@ -415,21 +430,16 @@ QString UkuiMenuInterface::getAppType(QString desktopfp)
bool UkuiMenuInterface::cmpApp(QStringList &arg_1, QStringList &arg_2)
{
QLocale local;
- QString language = local.languageToString(local.language());
-
- if (QString::compare(language, "Chinese") == 0) {
- local = QLocale(QLocale::Chinese);
- } else {
- local = QLocale(QLocale::English);
- }
-
+ QString language=local.languageToString(local.language());
+ if(QString::compare(language,"Chinese")==0)
+ local=QLocale(QLocale::Chinese);
+ else
+ local=QLocale(QLocale::English);
QCollator collator(local);
-
- if (collator.compare(arg_1.at(1), arg_2.at(1)) < 0) {
+ if(collator.compare(arg_1.at(1),arg_2.at(1))<0)
return true;
- } else {
+ else
return false;
- }
}
QVector UkuiMenuInterface::getAllClassification()
@@ -440,26 +450,20 @@ QVector UkuiMenuInterface::getAllClassification()
allAppVector.clear();
commonVector.clear();
appVector.clear();
- commonVector = getCommonUseApp();
- int index = 0;
-
- Q_FOREACH (QString desktopfp, desktopfpVector) {
- if (!commonVector.contains(desktopfp)) {
+ commonVector=getCommonUseApp();
+ int index=0;
+ Q_FOREACH(QString desktopfp, desktopfpVector)
+ {
+ if(!commonVector.contains(desktopfp))
appVector.append(appInfoVector.at(index));
- }
-
index++;
}
-
- qSort(appVector.begin(), appVector.end(), cmpApp);
-
- Q_FOREACH (QString desktopfp, commonVector) {
+ qSort(appVector.begin(),appVector.end(),cmpApp);
+ Q_FOREACH(QString desktopfp, commonVector)
allAppVector.append(desktopfp);
- }
- for (int index = 0; index < appVector.size(); index++) {
+ for(int index=0;index UkuiMenuInterface::getCommonUseApp()
// {
// timeOutKeys.append(dateTimeKeys.at(i));
// }
+
// }
// setting->endGroup();
// for(int i=0;i UkuiMenuInterface::getCommonUseApp()
// setting->sync();
// setting->endGroup();
// }
+
// setting->beginGroup("lockapplication");
// QStringList lockdesktopfnList=setting->allKeys();
// for(int i=0;i UkuiMenuInterface::getCommonUseApp()
// QString tmp=lockdesktopfnList.at(j);
// lockdesktopfnList.replace(j,lockdesktopfnList.at(j+1));
// lockdesktopfnList.replace(j+1,tmp);
+
// }
// }
// setting->endGroup();
@@ -519,9 +526,11 @@ QVector UkuiMenuInterface::getCommonUseApp()
// QString tmp=desktopfnList.at(j);
// desktopfnList.replace(j,desktopfnList.at(j+1));
// desktopfnList.replace(j+1,tmp);
+
// }
// }
// setting->endGroup();
+
// QVector data;
// Q_FOREACH(QString desktopfn,lockdesktopfnList)
// {
@@ -547,41 +556,31 @@ QVector UkuiMenuInterface::getCommonUseApp()
// continue;
// data.append(desktopfp);
// }
+
QVector data;
-
- Q_FOREACH (QString desktopfn, getLockAppList()) {
+ Q_FOREACH(QString desktopfn, getLockAppList())
+ {
QString desktopfp;
-
- if (androidDesktopfnList.contains(desktopfn)) {
- desktopfp = QString(QDir::homePath() + "/.local/share/applications/" + desktopfn);
- } else {
- desktopfp = QString("/usr/share/applications/" + desktopfn);
- }
-
+ if(androidDesktopfnList.contains(desktopfn))
+ desktopfp=QString(QDir::homePath()+"/.local/share/applications/"+desktopfn);
+ else
+ desktopfp=QString("/usr/share/applications/"+desktopfn);
QFileInfo fileInfo(desktopfp);
-
- if (!fileInfo.isFile() || !desktopfpVector.contains(desktopfp)) {
+ if(!fileInfo.isFile() || !desktopfpVector.contains(desktopfp))
continue;
- }
-
data.append(desktopfp);
}
- Q_FOREACH (QString desktopfn, getUnlockAllList()) {
+ Q_FOREACH(QString desktopfn, getUnlockAllList())
+ {
QString desktopfp;
-
- if (androidDesktopfnList.contains(desktopfn)) {
- desktopfp = QString(QDir::homePath() + "/.local/share/applications/" + desktopfn);
- } else {
- desktopfp = QString("/usr/share/applications/" + desktopfn);
- }
-
+ if(androidDesktopfnList.contains(desktopfn))
+ desktopfp=QString(QDir::homePath()+"/.local/share/applications/"+desktopfn);
+ else
+ desktopfp=QString("/usr/share/applications/"+desktopfn);
QFileInfo fileInfo(desktopfp);
-
- if (!fileInfo.isFile() || !desktopfpVector.contains(desktopfp)) {
+ if(!fileInfo.isFile() || !desktopfpVector.contains(desktopfp))
continue;
- }
-
data.append(desktopfp);
}
@@ -594,272 +593,215 @@ QVector UkuiMenuInterface::getAlphabeticClassification()
QStringList appnameList;
appnameList.clear();
QVector appVector[27];
- int index = 0;
-
- while (index < appInfoVector.size()) {
- QString appname = appInfoVector.at(index).at(1);
- QString appnamepy = UkuiChineseLetter::getPinyins(appname);
-
- if (!appnamepy.isEmpty()) {
- char c = appnamepy.at(0).toLatin1();
-
+ int index=0;
+ while(index otherVector;
- QVector numberVector;
-
- for (int i = 0; i < appVector[26].count(); i++) {
- QString appname = appVector[26].at(i).at(2);
- QChar c = appname.at(0);
-
- if (c < 48 || (c > 57 && c < 65) || c > 90) {
+ QVector otherVector;
+ QVector numberVector;
+ for(int i=0;i57 && c<65) || c>90)
otherVector.append(appVector[26].at(i));
- } else {
+ else
numberVector.append(appVector[26].at(i));
- }
}
-
- qSort(otherVector.begin(), otherVector.end(), cmpApp);
- qSort(numberVector.begin(), numberVector.end(), cmpApp);
+ qSort(otherVector.begin(),otherVector.end(),cmpApp);
+ qSort(numberVector.begin(),numberVector.end(),cmpApp);
QStringList otherfpList;
otherfpList.clear();
-
- for (int i = 0; i < otherVector.size(); i++) {
+ for(int i=0;i UkuiMenuInterface::getFunctionalClassification()
{
QVector appVector[11];
- int index = 0;
-
- while (index < appInfoVector.size()) {
- int count = appInfoVector.at(index).size() - 5;
-
- for (int i = 0; i < count; i++) {
- int category = appInfoVector.at(index).at(5 + i).toInt();
-
+ int index=0;
+ while(index data;
data.clear();
- for (int i = 0; i < 11; i++) {
+ for(int i=0;i<11;i++)
+ {
QStringList desktopfpList;
desktopfpList.clear();
- qSort(appVector[i].begin(), appVector[i].end(), cmpApp);
-
- for (int j = 0; j < appVector[i].size(); j++) {
+ qSort(appVector[i].begin(),appVector[i].end(),cmpApp);
+ for(int j=0;j androidVector;
androidVector.clear();
- QString path = QDir::homePath() + "/.local/share/applications/";
+ QString path=QDir::homePath()+"/.local/share/applications/";
QDir dir(path);
-
if (!dir.exists()) {
return;
}
- dir.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+ dir.setFilter(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot);
dir.setSorting(QDir::DirsFirst);
QFileInfoList list = dir.entryInfoList();
-
- if (list.size() < 1) {
+ if(list.size()< 1 ) {
return;
}
+ int i=0;
- int i = 0;
- GError **error = nullptr;
- GKeyFileFlags flags = G_KEY_FILE_NONE;
- GKeyFile *keyfile = g_key_file_new();
+ GError** error=nullptr;
+ GKeyFileFlags flags=G_KEY_FILE_NONE;
+ GKeyFile* keyfile=g_key_file_new ();
- do {
+ do{
QFileInfo fileInfo = list.at(i);
-
- if (!fileInfo.isFile()) {
+ if(!fileInfo.isFile())
+ {
i++;
continue;
}
-
//过滤后缀不是.desktop的文件
- QString filePathStr = fileInfo.filePath();
-
- if (!filePathStr.endsWith(".desktop")) {
+ QString filePathStr=fileInfo.filePath();
+ if(!filePathStr.endsWith(".desktop"))
+ {
i++;
continue;
}
- QByteArray fpbyte = filePathStr.toLocal8Bit();
- char *filepath = fpbyte.data();
- g_key_file_load_from_file(keyfile, filepath, flags, error);
+ QByteArray fpbyte=filePathStr.toLocal8Bit();
+ char* filepath=fpbyte.data();
+ g_key_file_load_from_file(keyfile,filepath,flags,error);
// char* ret_1=g_key_file_get_locale_string(keyfile,"Desktop Entry","Categories", nullptr, nullptr);
// if(ret_1!=nullptr)
// {
@@ -919,12 +858,13 @@ void UkuiMenuInterface::getAndroidApp()
// }
// else
// {
- filePathList.append(filePathStr);
- androidDesktopfnList.append(fileInfo.fileName());
+ filePathList.append(filePathStr);
+ androidDesktopfnList.append(fileInfo.fileName());
// }
// }
+
i++;
- } while (i < list.size());
+ }while(i < list.size());
g_key_file_free(keyfile);
}
@@ -932,18 +872,15 @@ void UkuiMenuInterface::getAndroidApp()
QString UkuiMenuInterface::getAppNameInitials(QString desktopfp)
{
QString firstLetters;
- QString appname = getAppName(desktopfp);
- QStringList appnamestr = appname.split(" ");
+ QString appname=getAppName(desktopfp);
+ QStringList appnamestr=appname.split(" ");
QString letters;
-
- Q_FOREACH (QString name, appnamestr) {
+ Q_FOREACH(QString name,appnamestr)
+ {
letters.clear();
- letters = UkuiChineseLetter::getFirstLettersAll(name);
-
- if (letters.isEmpty()) {
- letters = UkuiChineseLetter::getFirstLetter(name);
- }
-
+ letters=UkuiChineseLetter::getFirstLettersAll(name);
+ if(letters.isEmpty())
+ letters=UkuiChineseLetter::getFirstLetter(name);
firstLetters.append(letters);
}
@@ -963,54 +900,53 @@ QString UkuiMenuInterface::getAppNamePinyin(QString appname)
bool UkuiMenuInterface::checkKreApp(QString desktopfp)
{
- GError **error = nullptr;
- GKeyFileFlags flags = G_KEY_FILE_NONE;
- GKeyFile *keyfile = g_key_file_new();
- QByteArray fpbyte = desktopfp.toLocal8Bit();
- char *filepath = fpbyte.data();
- g_key_file_load_from_file(keyfile, filepath, flags, error);
- char *value = g_key_file_get_locale_string(keyfile, "Desktop Entry", "environment", nullptr, nullptr);
+ GError** error=nullptr;
+ GKeyFileFlags flags=G_KEY_FILE_NONE;
+ GKeyFile* keyfile=g_key_file_new ();
+
+ QByteArray fpbyte=desktopfp.toLocal8Bit();
+ char* filepath=fpbyte.data();
+ g_key_file_load_from_file(keyfile,filepath,flags,error);
+
+ char* value=g_key_file_get_locale_string(keyfile,"Desktop Entry","environment", nullptr, nullptr);
g_key_file_free(keyfile);
-
- if (!value) {
+ if(!value)
return false;
- } else if (QString::compare(QString::fromLocal8Bit(value), "kre-environment") == 0) {
+ else if(QString::compare(QString::fromLocal8Bit(value),"kre-environment")==0)
return true;
- }
-
return false;
}
//获取指定类型应用列表
QStringList UkuiMenuInterface::getSpecifiedCategoryAppList(QString categorystr)
{
- QByteArray categorybyte = categorystr.toLocal8Bit();
- char *category = categorybyte.data();
- QStringList desktopfpList = getDesktopFilePath();
+ QByteArray categorybyte=categorystr.toLocal8Bit();
+ char* category=categorybyte.data();
+
+ QStringList desktopfpList=getDesktopFilePath();
QStringList appnameList;
appnameList.clear();
-
- for (int index = 0; index < desktopfpList.count(); index++) {
- QString appcategorystr = getAppCategories(desktopfpList.at(index));
-
- if (!appcategorystr.isEmpty()) {
- QByteArray appcategorybyte = appcategorystr.toLocal8Bit();
- char *appcategory = appcategorybyte.data();
- int len = static_cast(strlen(appcategory) - 6);
-
- for (int i = 0; i < len; i++) {
- if (strncmp(appcategory + i, category, strlen(category)) == 0) {
- QString appname = getAppName(desktopfpList.at(index));
-
- if (QString::compare(appname, "访问提示") == 0) {
- appnameList.append(appname);
- }
-
+ for(int index=0;index(strlen(appcategory)-6);
+ for(int i=0;iapplicationState() & Qt::ApplicationInactive) {
- MainWindow *w = qobject_cast(actWin);
+ if(this->applicationState() & Qt::ApplicationInactive)
+ {
+ MainWindow* w=qobject_cast(actWin);
w->loadMainWindow();
actWin->setWindowState(actWin->windowState() & ~Qt::WindowMinimized);
actWin->raise();
actWin->showNormal();
actWin->activateWindow();
- } else {
+
+ }
+ else {
actWin->setWindowState(actWin->windowState() & Qt::WindowMinimized);
actWin->hide();
}
+
}
}
diff --git a/src/QtSingleApplication/qtsingleapplication.h b/src/QtSingleApplication/qtsingleapplication.h
old mode 100755
new mode 100644
diff --git a/src/QtSingleApplication/qtsingleapplication.pri b/src/QtSingleApplication/qtsingleapplication.pri
old mode 100755
new mode 100644
diff --git a/src/QtSingleApplication/qtsinglecoreapplication.cpp b/src/QtSingleApplication/qtsinglecoreapplication.cpp
old mode 100755
new mode 100644
diff --git a/src/QtSingleApplication/qtsinglecoreapplication.h b/src/QtSingleApplication/qtsinglecoreapplication.h
old mode 100755
new mode 100644
diff --git a/src/QtSingleApplication/qtsinglecoreapplication.pri b/src/QtSingleApplication/qtsinglecoreapplication.pri
old mode 100755
new mode 100644
diff --git a/src/RightClickMenu/menubox.cpp b/src/RightClickMenu/menubox.cpp
old mode 100755
new mode 100644
diff --git a/src/RightClickMenu/menubox.h b/src/RightClickMenu/menubox.h
old mode 100755
new mode 100644
diff --git a/src/RightClickMenu/rightclickmenu.cpp b/src/RightClickMenu/rightclickmenu.cpp
old mode 100755
new mode 100644
index 290eae6..e7da0f9
--- a/src/RightClickMenu/rightclickmenu.cpp
+++ b/src/RightClickMenu/rightclickmenu.cpp
@@ -47,7 +47,6 @@ RightClickMenu::RightClickMenu(QWidget *parent):
m_whiteList.append("org.gnome.FileRoller.desktop");
m_whiteList.append("mate-terminal.desktop");
m_whiteList.append("hwaudioui.desktop");
- m_whiteList.append("kylin-sogouIme-configtool.desktop");
}
m_ukuiMenuInterface = new UkuiMenuInterface;
diff --git a/src/RightClickMenu/rightclickmenu.h b/src/RightClickMenu/rightclickmenu.h
old mode 100755
new mode 100644
diff --git a/src/SearchResultWidget/file-utils.cpp b/src/SearchResultWidget/file-utils.cpp
old mode 100755
new mode 100644
diff --git a/src/SearchResultWidget/file-utils.h b/src/SearchResultWidget/file-utils.h
old mode 100755
new mode 100644
diff --git a/src/SearchResultWidget/fullsearchresultwidget.cpp b/src/SearchResultWidget/fullsearchresultwidget.cpp
old mode 100755
new mode 100644
diff --git a/src/SearchResultWidget/fullsearchresultwidget.h b/src/SearchResultWidget/fullsearchresultwidget.h
old mode 100755
new mode 100644
diff --git a/src/SearchResultWidget/pinyinWithTone.txt b/src/SearchResultWidget/pinyinWithTone.txt
old mode 100755
new mode 100644
diff --git a/src/SearchResultWidget/pinyinWithoutTone.txt b/src/SearchResultWidget/pinyinWithoutTone.txt
old mode 100755
new mode 100644
diff --git a/src/SearchResultWidget/searchappthread.cpp b/src/SearchResultWidget/searchappthread.cpp
old mode 100755
new mode 100644
diff --git a/src/SearchResultWidget/searchappthread.h b/src/SearchResultWidget/searchappthread.h
old mode 100755
new mode 100644
diff --git a/src/SearchResultWidget/searchresultwidget.cpp b/src/SearchResultWidget/searchresultwidget.cpp
old mode 100755
new mode 100644
diff --git a/src/SearchResultWidget/searchresultwidget.h b/src/SearchResultWidget/searchresultwidget.h
old mode 100755
new mode 100644
diff --git a/src/SideBarWidget/sidebarwidget.cpp b/src/SideBarWidget/sidebarwidget.cpp
old mode 100755
new mode 100644
index 7cb2b3e..a14ce78
--- a/src/SideBarWidget/sidebarwidget.cpp
+++ b/src/SideBarWidget/sidebarwidget.cpp
@@ -291,7 +291,7 @@ void SideBarWidget::initBtn(QPushButton *btn, QString btnicon, QString text, int
labelicon->setPixmap(pixmap);
} else {
if (!QFile::exists(btnicon)) {
- btnicon = QString(":/data/img/sidebarwidget/default.svg");
+ btnicon = QString("/usr/share/ukui/faces/default.png");
}
labelicon->setObjectName("faceLabel");
@@ -481,7 +481,7 @@ void SideBarWidget::userAccountsChanged()
QString usericon = getUserIcon();
if (!QFile::exists(usericon)) {
- usericon = QString(":/data/img/sidebarwidget/default.svg");
+ usericon = QString("/usr/share/ukui/faces/default.png");
}
QPixmap facePixmap(usericon);
diff --git a/src/SideBarWidget/sidebarwidget.h b/src/SideBarWidget/sidebarwidget.h
old mode 100755
new mode 100644
diff --git a/src/Style/style.cpp b/src/Style/style.cpp
old mode 100755
new mode 100644
diff --git a/src/Style/style.h b/src/Style/style.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/classifybtnscrollarea.cpp b/src/UtilityFunction/classifybtnscrollarea.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/classifybtnscrollarea.h b/src/UtilityFunction/classifybtnscrollarea.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/convertdesktoptowinid.cpp b/src/UtilityFunction/convertdesktoptowinid.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/convertdesktoptowinid.h b/src/UtilityFunction/convertdesktoptowinid.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/fullitemdelegate.cpp b/src/UtilityFunction/fullitemdelegate.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/fullitemdelegate.h b/src/UtilityFunction/fullitemdelegate.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/fulllistview.cpp b/src/UtilityFunction/fulllistview.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/fulllistview.h b/src/UtilityFunction/fulllistview.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/functionclassifybutton.cpp b/src/UtilityFunction/functionclassifybutton.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/functionclassifybutton.h b/src/UtilityFunction/functionclassifybutton.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/itemdelegate.cpp b/src/UtilityFunction/itemdelegate.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/itemdelegate.h b/src/UtilityFunction/itemdelegate.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/letterclassifybutton.cpp b/src/UtilityFunction/letterclassifybutton.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/letterclassifybutton.h b/src/UtilityFunction/letterclassifybutton.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/listview.cpp b/src/UtilityFunction/listview.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/listview.h b/src/UtilityFunction/listview.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/proxystyle.cpp b/src/UtilityFunction/proxystyle.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/proxystyle.h b/src/UtilityFunction/proxystyle.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/scrollarea.cpp b/src/UtilityFunction/scrollarea.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/scrollarea.h b/src/UtilityFunction/scrollarea.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/splitbarframe.cpp b/src/UtilityFunction/splitbarframe.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/splitbarframe.h b/src/UtilityFunction/splitbarframe.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/toolbutton.cpp b/src/UtilityFunction/toolbutton.cpp
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/toolbutton.h b/src/UtilityFunction/toolbutton.h
old mode 100755
new mode 100644
diff --git a/src/UtilityFunction/utility.cpp b/src/UtilityFunction/utility.cpp
old mode 100755
new mode 100644
index 5bb639a..d10fc82
--- a/src/UtilityFunction/utility.cpp
+++ b/src/UtilityFunction/utility.cpp
@@ -38,54 +38,55 @@ const QPixmap loadSvg(const QString &fileName, const int size)
QPixmap pixmap(size, size);
QSvgRenderer renderer(fileName);
pixmap.fill(Qt::transparent);
+
QPainter painter;
painter.begin(&pixmap);
renderer.render(&painter);
painter.end();
+
return pixmap;
}
QPixmap drawSymbolicColoredPixmap(const QPixmap &source)
{
- QColor gray(128, 128, 128);
- QColor standard(31, 32, 34);
+ QColor gray(128,128,128);
+ QColor standard (31,32,34);
QImage img = source.toImage();
-
for (int x = 0; x < img.width(); x++) {
for (int y = 0; y < img.height(); y++) {
auto color = img.pixelColor(x, y);
-
if (color.alpha() > 0) {
- if (qAbs(color.red() - gray.red()) < 20 && qAbs(color.green() - gray.green()) < 20 && qAbs(color.blue() - gray.blue()) < 20) {
+ if (qAbs(color.red()-gray.red())<20 && qAbs(color.green()-gray.green())<20 && qAbs(color.blue()-gray.blue())<20) {
color.setRed(255);
color.setGreen(255);
color.setBlue(255);
img.setPixelColor(x, y, color);
- } else if (qAbs(color.red() - standard.red()) < 20 && qAbs(color.green() - standard.green()) < 20 && qAbs(color.blue() - standard.blue()) < 20) {
+ }
+ else if(qAbs(color.red()-standard.red())<20 && qAbs(color.green()-standard.green())<20 && qAbs(color.blue()-standard.blue())<20)
+ {
color.setRed(255);
color.setGreen(255);
color.setBlue(255);
img.setPixelColor(x, y, color);
- } else {
+ }
+ else
+ {
img.setPixelColor(x, y, color);
}
}
}
}
-
return QPixmap::fromImage(img);
}
QPixmap drawSymbolicBlackColoredPixmap(const QPixmap &source)
{
QImage img = source.toImage();
-
for (int x = 0; x < img.width(); x++) {
for (int y = 0; y < img.height(); y++) {
auto color = img.pixelColor(x, y);
-
if (color.alpha() > 0) {
- if (qAbs(color.red()) >= 200 && qAbs(color.green()) >= 200 && qAbs(color.blue()) >= 200) {
+ if (qAbs(color.red())>=200 && qAbs(color.green())>=200 && qAbs(color.blue())>=200) {
color.setRed(56);
color.setGreen(56);
color.setBlue(56);
@@ -94,7 +95,6 @@ QPixmap drawSymbolicBlackColoredPixmap(const QPixmap &source)
}
}
}
-
return QPixmap::fromImage(img);
}
@@ -107,15 +107,17 @@ QRect getScreenAvailableGeometry()
DBUS_PATH,
DBUS_INTERFACE,
QDBusConnection::sessionBus());
- QDBusReply reply = iface.call("GetPrimaryScreenAvailableGeometry");
+ QDBusReply reply=iface.call("GetPrimaryScreenAvailableGeometry");
+ if(iface.isValid() && reply.isValid())
+ {
+ list=reply.value();
+ rect = QRect(list.at(0).toInt(),list.at(1).toInt(),list.at(2).toInt(),list.at(3).toInt());
- if (iface.isValid() && reply.isValid()) {
- list = reply.value();
- rect = QRect(list.at(0).toInt(), list.at(1).toInt(), list.at(2).toInt(), list.at(3).toInt());
- } else {
+ }
+ else
+ {
rect = qApp->primaryScreen()->availableGeometry();
}
-
return rect;
}
@@ -127,73 +129,68 @@ QVariantList getScreenGeometry()
DBUS_PATH,
DBUS_INTERFACE,
QDBusConnection::sessionBus());
- QDBusReply reply = iface.call("GetPrimaryScreenPhysicalGeometry");
-
- if (iface.isValid() && reply.isValid()) {
- list = reply.value();
- } else {
- QRect rect = QApplication::desktop()->screenGeometry(0);
+ QDBusReply reply=iface.call("GetPrimaryScreenPhysicalGeometry");
+ if(iface.isValid() && reply.isValid())
+ {
+ list=reply.value();
+ }
+ else
+ {
+ QRect rect=QApplication::desktop()->screenGeometry(0);
list.append(QString::number(rect.x()));
list.append(QString::number(rect.y()));
list.append(QString::number(rect.width()));
list.append(QString::number(rect.height()));
- int position = 0;
- int panelSize = 0;
-
- if (QGSettings::isSchemaInstalled(QString("org.ukui.panel.settings").toLocal8Bit())) {
- QGSettings *gsetting = new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
-
- if (gsetting->keys().contains(QString("panelposition"))) {
- position = gsetting->get("panelposition").toInt();
- } else {
- position = 0;
- }
-
- if (gsetting->keys().contains(QString("panelsize"))) {
- panelSize = gsetting->get("panelsize").toInt();
- } else {
- panelSize = 46;
- }
+ int position=0;
+ int panelSize=0;
+ if(QGSettings::isSchemaInstalled(QString("org.ukui.panel.settings").toLocal8Bit()))
+ {
+ QGSettings* gsetting=new QGSettings(QString("org.ukui.panel.settings").toLocal8Bit());
+ if(gsetting->keys().contains(QString("panelposition")))
+ position=gsetting->get("panelposition").toInt();
+ else
+ position=0;
+ if(gsetting->keys().contains(QString("panelsize")))
+ panelSize=gsetting->get("panelsize").toInt();
+ else
+ panelSize=46;
delete gsetting;
- } else {
- position = 0;
- panelSize = 46;
}
-
+ else
+ {
+ position=0;
+ panelSize=46;
+ }
list.append(QString::number(panelSize));
list.append(QString::number(position));
}
-
return list;
}
double getTransparency()
{
- double transparency = 0.0;
-
- if (QGSettings::isSchemaInstalled(QString("org.ukui.control-center.personalise").toLocal8Bit())) {
+ double transparency=0.0;
+ if(QGSettings::isSchemaInstalled(QString("org.ukui.control-center.personalise").toLocal8Bit()))
+ {
QGSettings gsetting(QString("org.ukui.control-center.personalise").toLocal8Bit());
-
- if (gsetting.keys().contains(QString("transparency"))) {
- transparency = gsetting.get("transparency").toDouble();
- }
+ if(gsetting.keys().contains(QString("transparency")))
+ transparency=gsetting.get("transparency").toDouble();
}
-
return transparency;
}
void debugLog(QString strMsg)
{
- QString path = QDir::homePath() + "/.config/ukui/ukui-menu.log";
+ QString path=QDir::homePath()+"/.config/ukui/ukui-menu.log";
QFile confFile(path);
-
- if (confFile.open(QIODevice::Text | QIODevice::ReadWrite | QIODevice::Append)) {
- QString text = QString("%1 %2")
- .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"))
- .arg(strMsg);
+ if(confFile.open(QIODevice::Text | QIODevice::ReadWrite | QIODevice::Append))
+ {
+ QString text=QString("%1 %2")
+ .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"))
+ .arg(strMsg);
QTextStream textStream(&confFile);
- textStream << text << endl;
+ textStream< list = file.readLine().split('\x00');
-
- Q_FOREACH (QByteArray array, list) {
- if (array.contains("GIO_LAUNCHED_DESKTOP_FILE=")) {
- ret = QString(array.split('=').at(1));
+ if(file.open(QIODevice::ReadOnly))
+ {
+ QList list=file.readLine().split('\x00');
+ Q_FOREACH(QByteArray array, list)
+ {
+ if(array.contains("GIO_LAUNCHED_DESKTOP_FILE="))
+ {
+ ret=QString(array.split('=').at(1));
break;
}
}
-
file.close();
}
-
return ret;
+
}
void openDataBase(QString connectionName)
@@ -228,14 +225,15 @@ void openDataBase(QString connectionName)
db = QSqlDatabase::addDatabase("QSQLITE", connectionName);
db.setDatabaseName(DATABASENAME);
- if (false == db.open()) {
+ if (false == db.open())
+ {
qDebug() << db.lastError().text();
}
}
void closeDataBase(QString connectionName)
{
- QSqlDatabase db = QSqlDatabase::database("connectionName");
+ QSqlDatabase db=QSqlDatabase::database("connectionName");
db.close();
QSqlDatabase::removeDatabase(connectionName);
}
@@ -247,150 +245,143 @@ void initDatabase()
QSqlDatabase db = QSqlDatabase::database("MainThread");
QSqlQuery sql(db);
sql.exec("select count(*) from sqlite_master where type='table' and name='appInfo'");
-
- if (sql.next()) {
- if (sql.value(0).toInt() == 0) {
- QSettings *setting = new QSettings("/var/lib/ukui-menu/ukui-menu.ini", QSettings::IniFormat);
+ if(sql.next())
+ {
+ if(sql.value(0).toInt()==0)
+ {
+ QSettings* setting=new QSettings("/var/lib/ukui-menu/ukui-menu.ini",QSettings::IniFormat);
setting->beginGroup("application");
QString desktopfp;
-
- Q_FOREACH (QString desktopfn, setting->allKeys()) {
- if (setting->value(desktopfn).toInt() == 1) {
+ Q_FOREACH(QString desktopfn, setting->allKeys())
+ {
+ if(setting->value(desktopfn).toInt()==1)
+ {
desktopfp.clear();
-
- if (UkuiMenuInterface::androidDesktopfnList.contains(desktopfn)) {
- desktopfp = QString(QDir::homePath() + "/.local/share/applications/" + desktopfn);
- } else {
- desktopfp = QString("/usr/share/applications/" + desktopfn);
- }
-
+ if(UkuiMenuInterface::androidDesktopfnList.contains(desktopfn))
+ desktopfp=QString(QDir::homePath()+"/.local/share/applications/"+desktopfn);
+ else
+ desktopfp=QString("/usr/share/applications/"+desktopfn);
QFileInfo info(desktopfp);
-
- if (!info.isFile() || !UkuiMenuInterface::desktopfpVector.contains(desktopfp)) {
+ if(!info.isFile() || !UkuiMenuInterface::desktopfpVector.contains(desktopfp))
continue;
- }
-
desktopfnList.append(desktopfn);
}
}
-
setting->endGroup();
delete setting;
}
}
-
sql.exec("create table if not exists appInfo(desktop char primary key, times int, time int, type int, recent int)");
-
- Q_FOREACH (QString desktopfn, desktopfnList) {
- QDateTime dt = QDateTime::currentDateTime();
- int datetime = dt.toTime_t();
- QString cmd = QString("insert into appInfo values(\"%0\",%1,%2,%3,%4)")
- .arg(desktopfn)
- .arg(0)
- .arg(datetime)
- .arg(1)
- .arg(0);
+ Q_FOREACH(QString desktopfn,desktopfnList)
+ {
+ QDateTime dt=QDateTime::currentDateTime();
+ int datetime=dt.toTime_t();
+ QString cmd=QString("insert into appInfo values(\"%0\",%1,%2,%3,%4)")
+ .arg(desktopfn)
+ .arg(0)
+ .arg(datetime)
+ .arg(1)
+ .arg(0);
sql.exec(cmd);
}
}
bool updateDataBaseTableTimes(QString desktopfn)
{
- bool ret = false;
+ bool ret=false;
QSqlDatabase db = QSqlDatabase::database("MainThread");
QSqlQuery sql(db);
QString cmd;
- cmd = QString("select times from appInfo where desktop=\"%1\"").arg(desktopfn);
-
- if (sql.exec(cmd)) {
- QDateTime dt = QDateTime::currentDateTime();
- int datetime = dt.toTime_t();
-
- if (sql.next()) {
- int times = sql.value(0).toInt() + 1;
- cmd = QString("update appInfo set times=%1, time=%2, recent=%3 where desktop=\"%4\"")
- .arg(times)
- .arg(datetime)
- .arg(0)
- .arg(desktopfn);
- } else {
- cmd = QString("insert into appInfo values(\"%0\",%1,%2,%3,%4)")
- .arg(desktopfn)
- .arg(1)
- .arg(datetime)
- .arg(0)
- .arg(0);
+ cmd=QString("select times from appInfo where desktop=\"%1\"").arg(desktopfn);
+ if(sql.exec(cmd))
+ {
+ QDateTime dt=QDateTime::currentDateTime();
+ int datetime=dt.toTime_t();
+ if(sql.next())
+ {
+ int times=sql.value(0).toInt()+1;
+ cmd=QString("update appInfo set times=%1, time=%2, recent=%3 where desktop=\"%4\"")
+ .arg(times)
+ .arg(datetime)
+ .arg(0)
+ .arg(desktopfn);
}
-
- ret = sql.exec(cmd);
+ else
+ {
+ cmd=QString("insert into appInfo values(\"%0\",%1,%2,%3,%4)")
+ .arg(desktopfn)
+ .arg(1)
+ .arg(datetime)
+ .arg(0)
+ .arg(0);
+ }
+ ret=sql.exec(cmd);
}
-
- qDebug() << "数据库更新应用使用频率成功";
return ret;
}
bool updateDataBaseTableType(QString desktopfn, int type)
{
- bool ret = false;
+ bool ret=false;
QSqlDatabase db = QSqlDatabase::database("MainThread");
QSqlQuery sql(db);
QString cmd;
-
switch (type) {
- case 0: { //解除锁定
- cmd = QString("delete from appInfo where desktop=\"%1\"")
- .arg(desktopfn);
- ret = sql.exec(cmd);
- }
- break;
-
- case 1: { //锁定
- cmd = QString("select type from appInfo where desktop=\"%1\"")
- .arg(desktopfn);
-
- if (sql.exec(cmd)) {
- if (sql.next()) { //更新记录
- cmd = QString("update appInfo set type=%1 where desktop=\"%2\"")
- .arg(type)
- .arg(desktopfn);
- } else { //添加记录
- QDateTime dt = QDateTime::currentDateTime();
- int datetime = dt.toTime_t();
- cmd = QString("insert into appInfo values(\"%0\",%1,%2,%3,%4)")
- .arg(desktopfn)
- .arg(0)
- .arg(datetime)
- .arg(type)
- .arg(0);
- }
-
- ret = sql.exec(cmd);
- }
- }
- break;
-
- default:
- break;
+ case 0://解除锁定
+ {
+ cmd=QString("delete from appInfo where desktop=\"%1\"")
+ .arg(desktopfn);
+ ret=sql.exec(cmd);
+ }
+ break;
+ case 1://锁定
+ {
+ cmd=QString("select type from appInfo where desktop=\"%1\"")
+ .arg(desktopfn);
+ if(sql.exec(cmd))
+ {
+ if(sql.next())//更新记录
+ {
+ cmd=QString("update appInfo set type=%1 where desktop=\"%2\"")
+ .arg(type)
+ .arg(desktopfn);
+ }
+ else//添加记录
+ {
+ QDateTime dt=QDateTime::currentDateTime();
+ int datetime=dt.toTime_t();
+ cmd=QString("insert into appInfo values(\"%0\",%1,%2,%3,%4)")
+ .arg(desktopfn)
+ .arg(0)
+ .arg(datetime)
+ .arg(type)
+ .arg(0);
+ }
+ ret=sql.exec(cmd);
+ }
+ }
+ break;
+ default:
+ break;
}
-
return ret;
}
bool updateDataBaseTableRecent(QString desktopfn)
{
- bool ret = false;
+ bool ret=false;
QSqlDatabase db = QSqlDatabase::database("DirectoryChangedThread");
QSqlQuery sql(db);
QString cmd;
- QDateTime dt = QDateTime::currentDateTime();
- int datetime = dt.toTime_t();
- cmd = QString("insert into appInfo values(\"%0\",%1,%2,%3,%4)")
- .arg(desktopfn)
- .arg(0)
- .arg(datetime)
- .arg(0)
- .arg(1);
- ret = sql.exec(cmd);
+ QDateTime dt=QDateTime::currentDateTime();
+ int datetime=dt.toTime_t();
+ cmd=QString("insert into appInfo values(\"%0\",%1,%2,%3,%4)")
+ .arg(desktopfn)
+ .arg(0)
+ .arg(datetime)
+ .arg(0)
+ .arg(1);
+ ret=sql.exec(cmd);
return ret;
}
@@ -398,21 +389,20 @@ bool checkIfLocked(QString desktopfn)
{
QSqlDatabase db = QSqlDatabase::database("MainThread");
QSqlQuery sql(db);
- QString cmd = QString("select type from appInfo where desktop=\"%1\"")
- .arg(desktopfn);
-
- if (sql.exec(cmd)) {
- if (!sql.next()) {
+ QString cmd=QString("select type from appInfo where desktop=\"%1\"")
+ .arg(desktopfn);
+ if(sql.exec(cmd))
+ {
+ if(!sql.next())
return false;
- } else {
- if (sql.value(0).toInt() == 0) {
+ else
+ {
+ if(sql.value(0).toInt()==0)
return false;
- } else {
+ else
return true;
- }
}
}
-
return false;
}
@@ -420,21 +410,20 @@ bool checkIfRecent(QString desktopfn)
{
QSqlDatabase db = QSqlDatabase::database("MainThread");
QSqlQuery sql(db);
- QString cmd = QString("select recent from appInfo where desktop=\"%1\"")
- .arg(desktopfn);
-
- if (sql.exec(cmd)) {
- if (!sql.next()) {
+ QString cmd=QString("select recent from appInfo where desktop=\"%1\"")
+ .arg(desktopfn);
+ if(sql.exec(cmd))
+ {
+ if(!sql.next())
return false;
- } else {
- if (sql.value(0).toInt() == 0) {
+ else
+ {
+ if(sql.value(0).toInt()==0)
return false;
- } else {
+ else
return true;
- }
}
}
-
return false;
}
@@ -443,14 +432,12 @@ QStringList getLockAppList()
QStringList list;
QSqlDatabase db = QSqlDatabase::database("MainThread");
QSqlQuery sql(db);
- QString cmd = QString("select desktop from appInfo where type=1");
-
- if (sql.exec(cmd)) {
- while (sql.next()) {
+ QString cmd=QString("select desktop from appInfo where type=1");
+ if(sql.exec(cmd))
+ {
+ while(sql.next())
list.append(sql.value(0).toString());
- }
}
-
return list;
}
@@ -459,73 +446,72 @@ QStringList getUnlockAllList()
QStringList list;
QSqlDatabase db = QSqlDatabase::database("MainThread");
QSqlQuery sql(db);
- QString cmd = QString("select desktop from appInfo where type=0 and times>=1 order by times desc");
-
- if (sql.exec(cmd)) {
- while (sql.next()) {
+ QString cmd=QString("select desktop from appInfo where type=0 and times>=1 order by times desc");
+ if(sql.exec(cmd))
+ {
+ while(sql.next())
list.append(sql.value(0).toString());
- }
}
-
return list;
}
void cleanTimeoutApp()
{
QSqlDatabase db = QSqlDatabase::database("MainThread");
- QDateTime dt = QDateTime::currentDateTime();
- int datetime = dt.toTime_t() - 24 * 60 * 60 * 3;
- QString cmd = QString("select desktop from appInfo where time < %1")
- .arg(datetime);
+ QDateTime dt=QDateTime::currentDateTime();
+ int datetime=dt.toTime_t()-24*60*60*3;
+ QString cmd=QString("select desktop from appInfo where time < %1")
+ .arg(datetime);
QStringList list;
QSqlQuery sql(db);
-
- if (sql.exec(cmd)) {
- while (sql.next()) {
- if (!checkIfLocked(sql.value(0).toString())) {
+ if(sql.exec(cmd))
+ {
+ while(sql.next())
+ {
+ if(!checkIfLocked(sql.value(0).toString()))
list.append(sql.value(0).toString());
- }
}
}
-
- Q_FOREACH (QString desktopfn, list) {
- cmd = QString("delete from appInfo where desktop=\"%1\"")
- .arg(desktopfn);
+ Q_FOREACH(QString desktopfn, list)
+ {
+ cmd=QString("delete from appInfo where desktop=\"%1\"")
+ .arg(desktopfn);
sql.exec(cmd);
}
}
bool deleteAppRecord(QString desktopfn)
{
- bool ret = false;
+ bool ret=false;
QSqlDatabase db = QSqlDatabase::database("DirectoryChangedThread");
- QString cmd = QString("delete from appInfo where desktop=\"%1\"")
- .arg(desktopfn);
+ QString cmd=QString("delete from appInfo where desktop=\"%1\"")
+ .arg(desktopfn);
QSqlQuery sql(db);
- ret = sql.exec(cmd);
+ ret=sql.exec(cmd);
return ret;
}
void execApp(QString desktopfp)
{
UkuiMenuInterface interface;
-
- if (interface.checkKreApp(desktopfp)) {
+ if(interface.checkKreApp(desktopfp))
+ {
QProcess::startDetached(interface.getAppExec(desktopfp));
- } else {
+ }
+ else
+ {
QString appName = interface.getAppExec(desktopfp);
- QStringList strList = (appName.replace("\"", "")).split(" ");
-
+ QStringList strList = (appName.replace("\"","")).split(" ");
// for(int i = 1; i < strList.size(); i++)
// {
- if (QString(strList.at(0)) == "kmplayer") {
- QProcess::startDetached(strList.at(0));
- return;
- }
-
+ if(QString(strList.at(0)) == "kmplayer")
+ {
+ QProcess::startDetached(strList.at(0));
+ return;
+ }
// }
- GDesktopAppInfo *desktopAppInfo = g_desktop_app_info_new_from_filename(desktopfp.toLocal8Bit().data());
- g_app_info_launch(G_APP_INFO(desktopAppInfo), nullptr, nullptr, nullptr);
+ GDesktopAppInfo * desktopAppInfo=g_desktop_app_info_new_from_filename(desktopfp.toLocal8Bit().data());
+ g_app_info_launch(G_APP_INFO(desktopAppInfo),nullptr, nullptr, nullptr);
g_object_unref(desktopAppInfo);
}
}
@@ -533,57 +519,54 @@ void execApp(QString desktopfp)
bool checkOsRelease()
{
QFile file("/etc/os-release");
-
- if (file.open(QFile::ReadOnly)) {
- QByteArray line = file.readLine();
+ if(file.open(QFile::ReadOnly))
+ {
+ QByteArray line=file.readLine();
file.close();
-
- if (QString(line).contains("Ubuntu")) {
+ if(QString(line).contains("Ubuntu"))
return true;
- }
}
-
return false;
}
//获取用户图像
QString getUserIcon()
{
- qint64 uid = static_cast(getuid());
+ qint64 uid=static_cast(getuid());
QDBusInterface iface("org.freedesktop.Accounts",
"/org/freedesktop/Accounts",
"org.freedesktop.Accounts",
QDBusConnection::systemBus());
- QDBusReplyobjPath = iface.call("FindUserById", uid);
+ QDBusReplyobjPath=iface.call("FindUserById",uid);
+
QDBusInterface useriface("org.freedesktop.Accounts",
objPath.value().path(),
"org.freedesktop.DBus.Properties",
QDBusConnection::systemBus());
- QDBusReply var = useriface.call("Get", "org.freedesktop.Accounts.User", "IconFile");
- QString iconstr = var.value().toString();
+ QDBusReply var=useriface.call("Get","org.freedesktop.Accounts.User","IconFile");
+ QString iconstr=var.value().toString();
return iconstr;
}
QString getUserName()
{
QString name;
- qint64 uid = static_cast(getuid());
+ qint64 uid=static_cast(getuid());
QDBusInterface iface("org.freedesktop.Accounts",
"/org/freedesktop/Accounts",
"org.freedesktop.Accounts",
QDBusConnection::systemBus());
- QDBusReply objPath = iface.call("FindUserById", uid);
+ QDBusReply objPath=iface.call("FindUserById",uid);
QDBusInterface useriface("org.freedesktop.Accounts",
objPath.value().path(),
"org.freedesktop.DBus.Properties",
QDBusConnection::systemBus());
- QDBusReply var = useriface.call("Get", "org.freedesktop.Accounts.User", "RealName");
- name = var.value().toString();
-
- if (name.isEmpty()) {
- var = useriface.call("Get", "org.freedesktop.Accounts.User", "UserName");
- name = var.value().toString();
+ QDBusReply var=useriface.call("Get","org.freedesktop.Accounts.User","RealName");
+ name=var.value().toString();
+ if(name.isEmpty())
+ {
+ var=useriface.call("Get","org.freedesktop.Accounts.User","UserName");
+ name=var.value().toString();
}
-
return name;
}
diff --git a/src/UtilityFunction/utility.h b/src/UtilityFunction/utility.h
old mode 100755
new mode 100644
diff --git a/translations/ukui-menu_bo.ts b/translations/ukui-menu_bo.ts
old mode 100755
new mode 100644
diff --git a/translations/ukui-menu_tr.ts b/translations/ukui-menu_tr.ts
old mode 100755
new mode 100644
diff --git a/translations/ukui-menu_zh_CN.ts b/translations/ukui-menu_zh_CN.ts
old mode 100755
new mode 100644
diff --git a/ukui-menu.desktop b/ukui-menu.desktop
old mode 100755
new mode 100644
diff --git a/ukui-menu.ini b/ukui-menu.ini
old mode 100755
new mode 100644
diff --git a/ukui-menu.pro b/ukui-menu.pro
old mode 100755
new mode 100644
diff --git a/ukui-menu.pro.user b/ukui-menu.pro.user
new file mode 100644
index 0000000..a5cc0fd
--- /dev/null
+++ b/ukui-menu.pro.user
@@ -0,0 +1,314 @@
+
+
+
+
+
+ EnvironmentId
+ {b9d686e0-ada0-41c1-ad9c-96f1279f7707}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ 桌面
+ 桌面
+ {9d9f9a2c-403b-48c4-83ee-e52b4e889b83}
+ 0
+ 0
+ 0
+
+ /home/ztz/ukui-menu9X0/build-ukui-menu-unknown-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ /home/ztz/ukui-menu9X0/build-ukui-menu-unknown-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+
+ /home/ztz/ukui-menu9X0/build-ukui-menu-unknown-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ dwarf
+
+ cpu-cycles
+
+
+ 250
+
+ -e
+ cpu-cycles
+ --call-graph
+ dwarf,4096
+ -F
+ 250
+
+ -F
+ true
+ 4096
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ kcachegrind
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ Qt4ProjectManager.Qt4RunConfiguration:/home/ztz/ukui-menu9X0/ukui-menu/ukui-menu.pro
+ /home/ztz/ukui-menu9X0/ukui-menu/ukui-menu.pro
+
+ false
+
+ false
+ true
+ true
+ false
+ false
+ true
+
+ /home/ztz/ukui-menu9X0/build-ukui-menu-unknown-Debug
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+