mirror of https://gitee.com/openkylin/peony.git
[FIX] 【rc8走查】【文件管理器】打开方式链接文字样式待优化 ,设计要求用KBorderlessButton,并用KY_SDK_QT_WIDGETS控制[LINK]147952
This commit is contained in:
parent
10954f4060
commit
a8d0aba156
|
@ -31,6 +31,11 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <gio/gdesktopappinfo.h>
|
#include <gio/gdesktopappinfo.h>
|
||||||
|
|
||||||
|
#ifdef KY_SDK_QT_WIDGETS
|
||||||
|
#include "kborderlessbutton.h"
|
||||||
|
using namespace kdk;
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace Peony;
|
using namespace Peony;
|
||||||
OpenWithGlobalData *OpenWithPropertiesPage::openWithGlobalData = nullptr;
|
OpenWithGlobalData *OpenWithPropertiesPage::openWithGlobalData = nullptr;
|
||||||
|
|
||||||
|
@ -165,7 +170,12 @@ void OpenWithPropertiesPage::initFloorThree()
|
||||||
floor3->setLayout(layout3);
|
floor3->setLayout(layout3);
|
||||||
floor3->setMaximumHeight(122);
|
floor3->setMaximumHeight(122);
|
||||||
layout3->setContentsMargins(22, 0, 0, 0);
|
layout3->setContentsMargins(22, 0, 0, 0);
|
||||||
|
#ifdef KY_SDK_QT_WIDGETS
|
||||||
|
KBorderlessButton *allOpenLabel = new KBorderlessButton(tr("Choose other application"), floor3);
|
||||||
|
KBorderlessButton *otherOpenLabel = new KBorderlessButton(tr("Go to application center"), floor3);
|
||||||
|
connect(allOpenLabel, &KBorderlessButton::clicked, this, &OpenWithPropertiesPage::chooseOtherApp);
|
||||||
|
connect(otherOpenLabel, &KBorderlessButton::clicked, this, &OpenWithPropertiesPage::openAppCenter);
|
||||||
|
#else
|
||||||
QString str1;
|
QString str1;
|
||||||
str1 = "<a href=\"ukui-software-center\" style=\"color: #3D6BE5;text-underline: none;\">"
|
str1 = "<a href=\"ukui-software-center\" style=\"color: #3D6BE5;text-underline: none;\">"
|
||||||
+ tr("Choose other application")
|
+ tr("Choose other application")
|
||||||
|
@ -173,41 +183,16 @@ void OpenWithPropertiesPage::initFloorThree()
|
||||||
QLabel *allOpenLabel = new QLabel(str1, floor3);
|
QLabel *allOpenLabel = new QLabel(str1, floor3);
|
||||||
allOpenLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
allOpenLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||||
|
|
||||||
connect(allOpenLabel, &QLabel::linkActivated, this, [=]() {
|
|
||||||
AllFileLaunchDialog dialog(m_fileInfo.get()->uri());
|
|
||||||
if (QDialog::Accepted == dialog.exec()) {
|
|
||||||
m_defaultOpenWithWidget->setLaunchAction(FileLaunchManager::getDefaultAction(m_fileInfo->uri()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
layout3->addWidget(allOpenLabel);
|
|
||||||
|
|
||||||
QString str2;
|
QString str2;
|
||||||
str2 = "<a href=\"ukui-software-center\" style=\"color: #3D6BE5;text-underline: none;\">"
|
str2 = "<a href=\"ukui-software-center\" style=\"color: #3D6BE5;text-underline: none;\">"
|
||||||
+ tr("Go to application center")
|
+ tr("Go to application center")
|
||||||
+ "</a>";
|
+ "</a>";
|
||||||
|
|
||||||
QLabel *otherOpenLabel = new QLabel(str2, floor3);
|
QLabel *otherOpenLabel = new QLabel(str2, floor3);
|
||||||
otherOpenLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
otherOpenLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||||
|
connect(allOpenLabel, &QLabel::linkActivated, this, &OpenWithPropertiesPage::chooseOtherApp);
|
||||||
connect(otherOpenLabel, &QLabel::linkActivated, this, [=]() {
|
connect(otherOpenLabel, &QLabel::linkActivated, this, &OpenWithPropertiesPage::openAppCenter);
|
||||||
QtConcurrent::run([=]() {
|
|
||||||
QProcess p;
|
|
||||||
if (COMMERCIAL_VERSION || (GlobalSettings::getInstance()->getProjectName() == V10_SP1_EDU))
|
|
||||||
p.setProgram("kylin-software-center");
|
|
||||||
else
|
|
||||||
p.setProgram("ubuntu-kylin-software-center");
|
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
|
||||||
p.startDetached();
|
|
||||||
#else
|
|
||||||
if (COMMERCIAL_VERSION)
|
|
||||||
p.startDetached("kylin-software-center");
|
|
||||||
else
|
|
||||||
p.startDetached("ubuntu-kylin-software-center");
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
bool isVisible = false;
|
bool isVisible = false;
|
||||||
if(QFileInfo::exists("/usr/bin/kylin-software-center")
|
if(QFileInfo::exists("/usr/bin/kylin-software-center")
|
||||||
|
@ -216,12 +201,43 @@ void OpenWithPropertiesPage::initFloorThree()
|
||||||
}
|
}
|
||||||
|
|
||||||
otherOpenLabel->setVisible(isVisible);
|
otherOpenLabel->setVisible(isVisible);
|
||||||
|
|
||||||
|
layout3->addWidget(allOpenLabel);
|
||||||
layout3->addWidget(otherOpenLabel);
|
layout3->addWidget(otherOpenLabel);
|
||||||
layout3->addStretch(1);
|
layout3->addStretch(1);
|
||||||
|
|
||||||
this->m_layout->addWidget(floor3);
|
this->m_layout->addWidget(floor3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenWithPropertiesPage::chooseOtherApp()
|
||||||
|
{
|
||||||
|
AllFileLaunchDialog dialog(m_fileInfo.get()->uri());
|
||||||
|
if (QDialog::Accepted == dialog.exec()) {
|
||||||
|
m_defaultOpenWithWidget->setLaunchAction(FileLaunchManager::getDefaultAction(m_fileInfo->uri()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenWithPropertiesPage::openAppCenter()
|
||||||
|
{
|
||||||
|
QtConcurrent::run([=]() {
|
||||||
|
QProcess p;
|
||||||
|
if (COMMERCIAL_VERSION)
|
||||||
|
p.setProgram("kylin-software-center");
|
||||||
|
else
|
||||||
|
p.setProgram("ubuntu-kylin-software-center");
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||||
|
p.startDetached();
|
||||||
|
#else
|
||||||
|
if (COMMERCIAL_VERSION)
|
||||||
|
p.startDetached("kylin-software-center");
|
||||||
|
else
|
||||||
|
p.startDetached("ubuntu-kylin-software-center");
|
||||||
|
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
NewFileLaunchDialog::NewFileLaunchDialog(const QString &uri, QWidget *parent) : QDialog(parent)
|
NewFileLaunchDialog::NewFileLaunchDialog(const QString &uri, QWidget *parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
m_launchHashList = new LaunchHashList(uri, this);
|
m_launchHashList = new LaunchHashList(uri, this);
|
||||||
|
|
|
@ -169,6 +169,10 @@ public:
|
||||||
void init();
|
void init();
|
||||||
void saveAllChange() override;
|
void saveAllChange() override;
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void chooseOtherApp();
|
||||||
|
void openAppCenter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVBoxLayout *m_layout = nullptr;
|
QVBoxLayout *m_layout = nullptr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue