-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MacOS]修复MacOS系统下,无法正常启动BUG,目前只测试MacOS13.5.1 intel版本。 [历史会话]优化删除会话时,同步删除相应的访问历史。 [SFTP]优化远程文件夹的图标显示。 [SFTP]优化不同系统下的远程文件默认编辑工具。 [RDP]修复Linux系统下的VNC文字复制和粘贴BUG。 [MacOS]Fixed a bug that could not start properly on the MacOS system. Currently, only the MacOS 13.5.1 Intel version is being tested. [Session history]When optimizing the deletion of a session, synchronize the deletion of the corresponding access history. [SFTP] Optimize the icon display of remote folders. [SFTP] Optimize default editing tools for remote files under different systems. [RDP] Fix VNC text copy and paste bugs in Linux systems.
- Loading branch information
Showing
26 changed files
with
1,573 additions
and
922 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,161 +1,78 @@ | ||
/******************************************************************************************* | ||
* | ||
* Copyright (C) 2022 Guangzhou AoYiDuo Network Technology Co.,Ltd. All Rights Reserved. | ||
* | ||
* Contact: http://www.aoyiduo.com | ||
* | ||
* this file is used under the terms of the GPLv3[GNU GENERAL PUBLIC LICENSE v3] | ||
* more information follow the website: https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* | ||
*******************************************************************************************/ | ||
|
||
#include "qwodbbackupdialog.h" | ||
#include "ui_qwodbbackupdialog.h" | ||
#include "qwodbsftpdetaildialog.h" | ||
#include "qwosetting.h" | ||
#include "qkxmessagebox.h" | ||
#include "qwosshconf.h" | ||
#include "qwodbsftpuploadsync.h" | ||
|
||
#include <QStringListModel> | ||
#include <QTimer> | ||
#include <QFileDialog> | ||
#include <QFileInfo> | ||
|
||
QWoDbBackupDialog::QWoDbBackupDialog(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::QWoDbBackupDialog) | ||
{ | ||
Qt::WindowFlags flags = windowFlags(); | ||
setWindowFlags(flags &~Qt::WindowContextHelpButtonHint); | ||
ui->setupUi(this); | ||
setWindowTitle(tr("Database backup")); | ||
ui->backupType->setModel(new QStringListModel(QStringList() << tr("sftp server") << tr("local file"), this)); | ||
QObject::connect(ui->backupType, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged())); | ||
onCurrentIndexChanged(); | ||
QStringList crypts; | ||
crypts.append("AES-CBC-256"); | ||
crypts.append("AES-CTR-256"); | ||
crypts.append("AES-GCM-256"); | ||
crypts.append("DES-CBC"); | ||
crypts.append("DES-ECB"); | ||
crypts.append("DES-OFB64"); | ||
crypts.append("RC4"); | ||
crypts.append("Blowfish"); | ||
ui->cryptType->setModel(new QStringListModel(crypts, this)); | ||
ui->sftpServer->setReadOnly(true); | ||
QObject::connect(ui->btnSftpDetail, SIGNAL(clicked()), this, SLOT(onSftpDetailButtonClicked())); | ||
|
||
QString lastFile = QWoSetting::value("DBBackup/lastLocalFile").toString(); | ||
ui->pathLocal->setText(lastFile); | ||
ui->pathLocal->setReadOnly(true); | ||
|
||
QString cryptType = QWoSetting::value("DBBackup/lastCryptType").toString(); | ||
if(cryptType.isEmpty()) { | ||
ui->cryptType->setCurrentIndex(0); | ||
}else{ | ||
ui->cryptType->setCurrentText(cryptType); | ||
} | ||
QString cryptKey = QWoSetting::value("DBBackup/lastCryptKey").toString(); | ||
ui->cryptKey->setText(cryptKey); | ||
|
||
resetSftpUrl(); | ||
|
||
QObject::connect(ui->btnSave, SIGNAL(clicked()), this, SLOT(onFileSaveClicked())); | ||
QObject::connect(ui->btnBrowser, SIGNAL(clicked()), this, SLOT(onFileBrowserClicked())); | ||
QObject::connect(ui->btnUpload, SIGNAL(clicked()), this, SLOT(onFileUploadClicked())); | ||
} | ||
|
||
QWoDbBackupDialog::~QWoDbBackupDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void QWoDbBackupDialog::onCurrentIndexChanged() | ||
{ | ||
int idx = ui->backupType->currentIndex(); | ||
if(idx == 0) { | ||
// sftp server. | ||
ui->sftpArea->show(); | ||
ui->localArea->hide(); | ||
}else{ | ||
ui->sftpArea->hide(); | ||
ui->localArea->show(); | ||
} | ||
QTimer::singleShot(0, this, SLOT(onAdjustLayout())); | ||
} | ||
|
||
void QWoDbBackupDialog::onAdjustLayout() | ||
{ | ||
adjustSize(); | ||
} | ||
|
||
void QWoDbBackupDialog::onSftpDetailButtonClicked() | ||
{ | ||
QWoDbSftpDetailDialog dlg(this); | ||
if(dlg.exec() == (QDialog::Accepted + 1)) { | ||
resetSftpUrl(); | ||
} | ||
} | ||
|
||
void QWoDbBackupDialog::onFileSaveClicked() | ||
{ | ||
QString lastFile = ui->pathLocal->text(); | ||
if(lastFile.isEmpty()) { | ||
QKxMessageBox::information(this, tr("Parameter error"), tr("the local file should not be empty.")); | ||
return; | ||
} | ||
QWoSetting::setValue("DBBackup/lastLocalFile", lastFile); | ||
if(!QWoSshConf::instance()->backup(lastFile)) { | ||
QKxMessageBox::warning(this, tr("Failure"), tr("failed to backup the database.")); | ||
}else{ | ||
QKxMessageBox::information(this, tr("Success"), tr("success to backup the file.")); | ||
} | ||
} | ||
|
||
void QWoDbBackupDialog::onFileUploadClicked() | ||
{ | ||
QString cryptType = ui->cryptType->currentText(); | ||
QString cryptKey = ui->cryptKey->text(); | ||
if(cryptKey.isEmpty()) { | ||
QKxMessageBox::information(this, tr("Parameter error"), tr("the encryption key should not be empty.")); | ||
return; | ||
} | ||
QWoSetting::setValue("DBBackup/lastCryptType", cryptType); | ||
QWoSetting::setValue("DBBackup/lastCryptKey", cryptKey); | ||
|
||
if(m_sync == nullptr) { | ||
m_sync = new QWoDBSftpUploadSync(this); | ||
QObject::connect(m_sync, SIGNAL(infoArrived(int,int,QString)), this, SLOT(onInfoArrived(int,int,QString))); | ||
} | ||
m_sync->upload(cryptType, cryptKey); | ||
} | ||
|
||
void QWoDbBackupDialog::onFileBrowserClicked() | ||
{ | ||
QString path = ui->pathLocal->text(); | ||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save database file"), path, tr("SQLite (*.db)")); | ||
if(fileName.isEmpty()) { | ||
return; | ||
} | ||
if(!fileName.endsWith(".db")) { | ||
fileName += ".db"; | ||
} | ||
ui->pathLocal->setText(fileName); | ||
} | ||
|
||
void QWoDbBackupDialog::onInfoArrived(int action, int err, const QString &errDesc) | ||
{ | ||
ui->info->setText(errDesc); | ||
} | ||
|
||
void QWoDbBackupDialog::resetSftpUrl() | ||
{ | ||
QVariantMap dm = QWoSetting::value("DBBackup/sftpDetail").toMap(); | ||
QString host = dm.value("host").toString(); | ||
QString name = dm.value("name").toString(); | ||
QString path = dm.value("path", "~/woterm_db_backup").toString(); | ||
QString port = dm.value("port", 22).toString(); | ||
QString url = QString("sftp://%1@%2:%3?port=%4").arg(name, host, path, port); | ||
ui->sftpServer->setText(url); | ||
} | ||
/******************************************************************************************* | ||
* | ||
* Copyright (C) 2023 Guangzhou AoYiDuo Network Technology Co.,Ltd. All Rights Reserved. | ||
* | ||
* Contact: http://www.aoyiduo.com | ||
* | ||
* this file is used under the terms of the GPLv3[GNU GENERAL PUBLIC LICENSE v3] | ||
* more information follow the website: https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* | ||
*******************************************************************************************/ | ||
|
||
#include "qwodbbackupdialog.h" | ||
#include "ui_qwodbbackupdialog.h" | ||
|
||
#include "qkxbuttonassist.h" | ||
|
||
#include "qwosetting.h" | ||
#include "qwosshconf.h" | ||
#include "qkxmessagebox.h" | ||
|
||
#include <QFileDialog> | ||
#include <QDebug> | ||
|
||
QWoDbBackupDialog::QWoDbBackupDialog(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::QWoDbBackupDialog) | ||
{ | ||
ui->setupUi(this); | ||
setWindowTitle(tr("Database backup")); | ||
Qt::WindowFlags flags = windowFlags(); | ||
setWindowFlags(flags &~Qt::WindowContextHelpButtonHint); | ||
setWindowTitle(tr("Database Restore")); | ||
|
||
ui->filePath->setReadOnly(true); | ||
QKxButtonAssist *assist = new QKxButtonAssist("../private/skins/black/folder.png", ui->filePath); | ||
QObject::connect(assist, SIGNAL(clicked(int)), this, SLOT(onAssistButtonClicked(int))); | ||
QObject::connect(ui->btnBackup, SIGNAL(clicked()), this, SLOT(onBackupButtonClicked())); | ||
QObject::connect(ui->btnClose, SIGNAL(clicked()), this, SLOT(close())); | ||
adjustSize(); | ||
} | ||
|
||
QWoDbBackupDialog::~QWoDbBackupDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void QWoDbBackupDialog::onBackupButtonClicked() | ||
{ | ||
QString fileName = ui->filePath->text(); | ||
if(fileName.isEmpty()) { | ||
QKxMessageBox::warning(this, tr("Information"), tr("Input a file path to backup.")); | ||
return; | ||
} | ||
if(!fileName.endsWith(".db")) { | ||
fileName += ".db"; | ||
} | ||
QFileInfo fi(fileName); | ||
QString last = fi.absolutePath(); | ||
QWoSetting::setLastBackupPath(last); | ||
if(!QWoSshConf::instance()->backup(fileName)) { | ||
QKxMessageBox::warning(this, tr("Failure"), tr("failed to backup the session list.")); | ||
return; | ||
} | ||
QKxMessageBox::warning(this, tr("Success"), tr("backup success.")); | ||
} | ||
|
||
void QWoDbBackupDialog::onAssistButtonClicked(int idx) | ||
{ | ||
QString path = QWoSetting::lastBackupPath(); | ||
QString fileName = QFileDialog::getSaveFileName(this, tr("Backup Session Database"), path, "SQLite3 (*.db)"); | ||
if(fileName.isEmpty()) { | ||
return; | ||
} | ||
if(!fileName.endsWith(".db")) { | ||
fileName += ".db"; | ||
} | ||
ui->filePath->setText(QDir::toNativeSeparators(fileName)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,37 @@ | ||
/******************************************************************************************* | ||
* | ||
* Copyright (C) 2022 Guangzhou AoYiDuo Network Technology Co.,Ltd. All Rights Reserved. | ||
* | ||
* Contact: http://www.aoyiduo.com | ||
* | ||
* this file is used under the terms of the GPLv3[GNU GENERAL PUBLIC LICENSE v3] | ||
* more information follow the website: https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* | ||
*******************************************************************************************/ | ||
|
||
#ifndef QWODBBACKUPDIALOG_H | ||
#define QWODBBACKUPDIALOG_H | ||
|
||
#include <QDialog> | ||
#include <QPointer> | ||
|
||
namespace Ui { | ||
class QWoDbBackupDialog; | ||
} | ||
|
||
class QWoDBSftpUploadSync; | ||
class QWoDbBackupDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit QWoDbBackupDialog(QWidget *parent = nullptr); | ||
~QWoDbBackupDialog(); | ||
|
||
private slots: | ||
void onCurrentIndexChanged(); | ||
void onAdjustLayout(); | ||
void onSftpDetailButtonClicked(); | ||
void onFileSaveClicked(); | ||
void onFileUploadClicked(); | ||
void onFileBrowserClicked(); | ||
void onInfoArrived(int action, int err, const QString& errDesc); | ||
private: | ||
void resetSftpUrl(); | ||
private: | ||
Ui::QWoDbBackupDialog *ui; | ||
QPointer<QWoDBSftpUploadSync> m_sync; | ||
}; | ||
|
||
#endif // QWODBBACKUPDIALOG_H | ||
/******************************************************************************************* | ||
* | ||
* Copyright (C) 2023 Guangzhou AoYiDuo Network Technology Co.,Ltd. All Rights Reserved. | ||
* | ||
* Contact: http://www.aoyiduo.com | ||
* | ||
* this file is used under the terms of the GPLv3[GNU GENERAL PUBLIC LICENSE v3] | ||
* more information follow the website: https://www.gnu.org/licenses/gpl-3.0.en.html | ||
* | ||
*******************************************************************************************/ | ||
|
||
|
||
#ifndef QWODBBACKUPDIALOG_H | ||
#define QWODBBACKUPDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
namespace Ui { | ||
class QWoDbBackupDialog; | ||
} | ||
|
||
class QWoDbBackupDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit QWoDbBackupDialog(QWidget *parent = nullptr); | ||
~QWoDbBackupDialog(); | ||
|
||
private slots: | ||
void onBackupButtonClicked(); | ||
void onAssistButtonClicked(int idx); | ||
private: | ||
Ui::QWoDbBackupDialog *ui; | ||
}; | ||
|
||
#endif // QWODBBACKUPDIALOG_H |
Oops, something went wrong.