UI: ApplicationsPage: Add "Select File" button.

This commit is contained in:
Nodir Temirkhodjaev 2019-05-06 14:29:10 +05:00
parent cff560220a
commit aa7d30bfa6
9 changed files with 47 additions and 12 deletions

View File

@ -22,6 +22,7 @@
<file>images/cross.png</file>
<file>images/cut.png</file>
<file>images/database_save.png</file>
<file>images/folder_explore.png</file>
<file>images/link.png</file>
<file>images/page_copy.png</file>
<file>images/page_paste.png</file>

View File

@ -1,6 +1,7 @@
#include "fortmanager.h"
#include <QApplication>
#include <QFileDialog>
#include <QInputDialog>
#include <QMenu>
#include <QMessageBox>
@ -421,6 +422,13 @@ void FortManager::showInfoBox(const QString &text,
QMessageBox::information(&m_window, title, text);
}
QStringList FortManager::getOpenFileNames(const QString &title)
{
return QFileDialog::getOpenFileNames(
nullptr, title, QString(), QString(),
nullptr, QFileDialog::ReadOnly);
}
bool FortManager::saveOriginConf(const QString &message)
{
if (!saveSettings(m_firewallConf))

View File

@ -79,6 +79,8 @@ public slots:
void showInfoBox(const QString &text,
const QString &title = QString());
QStringList getOpenFileNames(const QString &title = QString());
bool saveOriginConf(const QString &message);
bool saveConf(bool onlyFlags = false);
bool applyConf(bool onlyFlags = false);

Binary file not shown.

View File

@ -50,42 +50,42 @@
<context>
<name>FortManager</name>
<message>
<location filename="../fortmanager.cpp" line="405"/>
<location filename="../fortmanager.cpp" line="406"/>
<source>Password input</source>
<translation>Ввод пароля</translation>
</message>
<message>
<location filename="../fortmanager.cpp" line="405"/>
<location filename="../fortmanager.cpp" line="406"/>
<source>Please enter the password</source>
<translation>Наберите пароль пожалуйста</translation>
</message>
<message>
<location filename="../fortmanager.cpp" line="634"/>
<location filename="../fortmanager.cpp" line="642"/>
<source>Options</source>
<translation>Опции</translation>
</message>
<message>
<location filename="../fortmanager.cpp" line="639"/>
<location filename="../fortmanager.cpp" line="647"/>
<source>Traffic Graph</source>
<translation>График трафика</translation>
</message>
<message>
<location filename="../fortmanager.cpp" line="649"/>
<location filename="../fortmanager.cpp" line="657"/>
<source>Filter Enabled</source>
<translation>Фильтр включен</translation>
</message>
<message>
<location filename="../fortmanager.cpp" line="656"/>
<location filename="../fortmanager.cpp" line="664"/>
<source>Stop Traffic</source>
<translation>Остановить трафик</translation>
</message>
<message>
<location filename="../fortmanager.cpp" line="663"/>
<location filename="../fortmanager.cpp" line="671"/>
<source>Stop Internet Traffic</source>
<translation>Остановить Интернет трафик</translation>
</message>
<message>
<location filename="../fortmanager.cpp" line="691"/>
<location filename="../fortmanager.cpp" line="699"/>
<source>Quit</source>
<translation>Выйти</translation>
</message>
@ -370,17 +370,17 @@
<translation>Перенести выделенные строки в &apos;Блокировать&apos;</translation>
</message>
<message>
<location filename="../qml/pages/apps/AppsColumn.qml" line="120"/>
<location filename="../qml/pages/apps/AppsColumn.qml" line="122"/>
<source>Block</source>
<translation>Блокировать</translation>
</message>
<message>
<location filename="../qml/pages/apps/AppsColumn.qml" line="143"/>
<location filename="../qml/pages/apps/AppsColumn.qml" line="145"/>
<source>Allow</source>
<translation>Разрешить</translation>
</message>
<message>
<location filename="../qml/pages/apps/AppsColumn.qml" line="153"/>
<location filename="../qml/pages/apps/AppsColumn.qml" line="155"/>
<source># All programs in the sub-path:</source>
<translation># Все программы по под-пути:</translation>
</message>
@ -862,9 +862,14 @@
</message>
<message>
<location filename="../qml/pages/addresses/AddressesColumn.qml" line="48"/>
<location filename="../qml/pages/apps/AppsColumn.qml" line="149"/>
<location filename="../qml/pages/apps/AppsColumn.qml" line="151"/>
<source># Examples:</source>
<translation># Примеры:</translation>
</message>
<message>
<location filename="../qml/box/TextArea2SplitBox.qml" line="170"/>
<source>Select File</source>
<translation>Выбрать файл</translation>
</message>
</context>
</TS>

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

View File

@ -15,6 +15,8 @@ T.SplitView {
property string textMoveAllFrom2To1
property string textMoveSelectedFrom2To1
property bool selectFileEnabled
property string settingsPropName
readonly property real handleWidth: 40
@ -160,6 +162,20 @@ T.SplitView {
tipText: textMoveAllFrom2To1
onClicked: moveAllLines(textArea2, textArea1)
}
RoundButtonTipSmall {
visible: selectFileEnabled
icon.source: "qrc:/images/folder_explore.png"
tipText: translationManager.trTrigger
&& qsTranslate("qml", "Select File")
onClicked: {
const area = textArea1.activeFocus ? textArea1 : textArea2;
const filePaths = fortManager.getOpenFileNames();
if (filePaths.length > 0) {
appendText(area, filePaths.join('\n'));
}
}
}
}
}
}

View File

@ -4,6 +4,7 @@ import QtQuick.Controls 2.13
RoundButton {
id: bt
hoverEnabled: true
focusPolicy: Qt.NoFocus
property string tipText

View File

@ -108,6 +108,8 @@ ColumnLayout {
textMoveSelectedFrom2To1: translationManager.trTrigger
&& qsTranslate("qml", "Move Selected Lines to 'Block'")
selectFileEnabled: true
settingsPropName: "windowAppsSplit"
AppsTextColumn {