This commit is contained in:
pokamest 2021-05-22 16:14:26 +03:00
parent d0c66a693b
commit 97e918ae72
2 changed files with 59 additions and 8 deletions

View file

@ -1445,6 +1445,8 @@ void MainWindow::setupSharePageConnections()
});
connect(ui->pushButton_share_amnezia_copy, &QPushButton::clicked, this, [this](){
if (ui->textEdit_share_amnezia_code->toPlainText().isEmpty()) return;
QGuiApplication::clipboard()->setText(ui->textEdit_share_amnezia_code->toPlainText());
ui->pushButton_share_amnezia_copy->setText(tr("Copied"));
@ -1453,6 +1455,17 @@ void MainWindow::setupSharePageConnections()
});
});
connect(ui->pushButton_share_amnezia_save, &QPushButton::clicked, this, [this](){
if (ui->textEdit_share_amnezia_code->toPlainText().isEmpty()) return;
QString fileName = QFileDialog::getSaveFileName(this, tr("Save AmneziaVPN config"),
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.amnezia");
QSaveFile save(fileName);
save.open(QIODevice::WriteOnly);
save.write(ui->textEdit_share_amnezia_code->toPlainText().toUtf8());
save.commit();
});
connect(ui->pushButton_share_openvpn_copy, &QPushButton::clicked, this, [this](){
QGuiApplication::clipboard()->setText(ui->textEdit_share_openvpn_code->toPlainText());
ui->pushButton_share_openvpn_copy->setText(tr("Copied"));
@ -1548,7 +1561,9 @@ void MainWindow::setupSharePageConnections()
});
connect(ui->pushButton_share_openvpn_save, &QPushButton::clicked, this, [this](){
QString fileName = QFileDialog::getSaveFileName(this, tr("Save OpenVPN config"), QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.ovpn");
QString fileName = QFileDialog::getSaveFileName(this, tr("Save OpenVPN config"),
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.ovpn");
QSaveFile save(fileName);
save.open(QIODevice::WriteOnly);
save.write(ui->textEdit_share_openvpn_code->toPlainText().toUtf8());

View file

@ -291,7 +291,7 @@ QPushButton:hover {
<string notr="true"/>
</property>
<property name="currentIndex">
<number>11</number>
<number>1</number>
</property>
<widget class="QWidget" name="page_start">
<widget class="QLabel" name="label_25">
@ -5391,7 +5391,7 @@ QToolBox::tab:hover {
<number>0</number>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<property name="tabSpacing">
<number>6</number>
@ -5401,8 +5401,8 @@ QToolBox::tab:hover {
<rect>
<x>0</x>
<y>0</y>
<width>360</width>
<height>360</height>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="styleSheet">
@ -5529,8 +5529,8 @@ background: #282932;
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>360</width>
<height>360</height>
</rect>
</property>
<attribute name="label">
@ -5585,7 +5585,7 @@ p, li { white-space: pre-wrap; }
<property name="geometry">
<rect>
<x>10</x>
<y>230</y>
<y>280</y>
<width>341</width>
<height>81</height>
</rect>
@ -5683,6 +5683,42 @@ background: #282932;
<string>Generate config</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_share_amnezia_save">
<property name="geometry">
<rect>
<x>10</x>
<y>230</y>
<width>341</width>
<height>40</height>
</rect>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
font-size: 13pt;
font: &quot;Open Sans Semibold&quot;;
color:rgb(212, 212, 212);
background: #181922;
border-radius: 4px;
font-family: Lato;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 21px;
}
QPushButton:hover {
background: #282932;
}</string>
</property>
<property name="text">
<string>Save file</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="page_share_openvpn">
<property name="geometry">