fix(frontend): Software center will not refresh which is already opened.
Description: 修复软件商店打开后点击安装不会再跳转的bug Log: 修复软件商店打开后点击安装不会再跳转的bug Bug: http://172.17.66.192/biz/bug-view-41150.html
This commit is contained in:
parent
555b471e6f
commit
3519dbe2c2
|
@ -327,7 +327,7 @@ void AppMatch::parseSoftWareCenterReturn(QList<QMap<QString,QString>> list,QMap<
|
|||
appdiscription=list.at(i).value("discription");
|
||||
appicon=list.at(i).value("icon");
|
||||
name.app_name = appname;
|
||||
pkgname.isEmpty() ? softwarereturn.insert(name,applist<<""<<appicon<<appdiscription) : softwarereturn.insert(name,applist<<""<<appicon<<pkgname<<appdiscription);
|
||||
pkgname.isEmpty() ? softwarereturn.insert(name,applist<<""<<appicon<<""<<appdiscription) : softwarereturn.insert(name,applist<<""<<appicon<<pkgname<<appdiscription);
|
||||
applist.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <QApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
#include <QDBusMetaType>
|
||||
#include "config-file.h"
|
||||
|
||||
SearchDetailView::SearchDetailView(QWidget *parent) : QWidget(parent)
|
||||
|
@ -178,6 +179,7 @@ void SearchDetailView::setAppWidget(const QString &appname, const QString &path,
|
|||
m_type = SearchListView::ResType::App;
|
||||
m_path = path;
|
||||
m_name = appname.contains("/") ? appname.left(appname.indexOf("/")) : appname;
|
||||
m_pkgname = appname.contains("/") ? appname.mid(appname.indexOf("/") + 1) : appname;
|
||||
m_isEmpty = false;
|
||||
clearLayout();
|
||||
m_iconLabel->show();
|
||||
|
@ -377,7 +379,7 @@ void SearchDetailView::execActions(const int& type, const int& option, const QSt
|
|||
break;
|
||||
}
|
||||
case OptionView::Options::Install: {
|
||||
installAppAction(m_name); //未安装应用点击此选项,不使用路径作为参数,而是使用软件名
|
||||
installAppAction(m_pkgname); //未安装应用点击此选项,不使用路径作为参数,而是使用软件名
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
@ -588,11 +590,22 @@ bool SearchDetailView::copyPathAction(const QString& path) {
|
|||
*/
|
||||
bool SearchDetailView::installAppAction(const QString & name)
|
||||
{
|
||||
//打开软件商店下载此软件
|
||||
QProcess process;
|
||||
QString app_name = name.contains("/") ? name.mid(name.indexOf("/") + 1) : name;
|
||||
bool res = process.startDetached(QString("kylin-software-center -find %1").arg(app_name));
|
||||
return res;
|
||||
QDBusInterface * interface = new QDBusInterface( "com.kylin.softwarecenter",
|
||||
"/com/kylin/softwarecenter",
|
||||
"com.kylin.utiliface",
|
||||
QDBusConnection::sessionBus() );
|
||||
|
||||
if (interface->isValid()) {
|
||||
//软件商店已打开,直接跳转
|
||||
interface->call("show_search_result",name);
|
||||
bool reply = QDBusReply<bool>(interface->call(QString("show_search_result"), name));
|
||||
return reply;
|
||||
} else {
|
||||
//软件商店未打开,打开软件商店下载此软件
|
||||
qDebug()<<"软件商店未打开,打开软件商店下载此软件"<<name;
|
||||
QProcess process;
|
||||
return process.startDetached(QString("kylin-software-center -find %1").arg(name));
|
||||
}
|
||||
}
|
||||
|
||||
void SearchDetailView::paintEvent(QPaintEvent *event) {
|
||||
|
|
|
@ -67,6 +67,7 @@ private:
|
|||
int m_type = 0;
|
||||
QString m_path = 0;
|
||||
QString m_name = 0; //目前只有未安装应用在打开软件商店时需要此参数
|
||||
QString m_pkgname = 0; //目前只有未安装应用在打开软件商店时需要此参数
|
||||
|
||||
void initUI();
|
||||
QLabel * m_iconLabel = nullptr;
|
||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -159,8 +159,14 @@ int main(int argc, char *argv[])
|
|||
qInstallMessageHandler(messageOutput);
|
||||
qRegisterMetaType<QPair<QString,QStringList>>("QPair<QString,QStringList>");
|
||||
qRegisterMetaType<Document>("Document");
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
#endif
|
||||
|
||||
QtSingleApplication app("ukui-search", argc, argv);
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
|
|
|
@ -49,7 +49,7 @@ void SearchAppThread::run()
|
|||
uninstalled_iter.next();
|
||||
QString name;
|
||||
//当返回列表的value中含包名时,将名称按“应用名/包名”的格式存储
|
||||
if (uninstalled_iter.value().length() > 2) {
|
||||
if (!uninstalled_iter.value().at(2).isEmpty() && uninstalled_iter.value().at(2) != "") {
|
||||
name = uninstalled_iter.key().app_name + "/" + uninstalled_iter.value().at(2);
|
||||
} else name = uninstalled_iter.key().app_name;
|
||||
nameList << name;
|
||||
|
|
Loading…
Reference in New Issue