Work on backups.
This commit is contained in:
parent
0fbedb384c
commit
91789d8445
@ -120,6 +120,7 @@ class FeedsView : public QTreeView {
|
||||
// Reloads counts for selected feeds.
|
||||
void updateCountsOfSelectedFeeds(bool update_total_too);
|
||||
|
||||
// Reloads counts of recycle bin.
|
||||
void updateCountsOfRecycleBin(bool update_total_too);
|
||||
|
||||
// Reloads counts for all feeds.
|
||||
|
@ -110,7 +110,7 @@ FormAbout::FormAbout(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormAbout)
|
||||
}
|
||||
else {
|
||||
m_ui->m_txtPathsSettingsType->setText(tr("PARTIALLY portable"));
|
||||
m_ui->m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(QDir::homePath() + QDir::separator() + QString(APP_LOW_H_NAME) + QDir::separator() + QString(APP_DB_SQLITE_PATH)));
|
||||
m_ui->m_txtPathsDatabaseRoot->setText(QDir::toNativeSeparators(qApp->homeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME) + QDir::separator() + QString(APP_DB_SQLITE_PATH)));
|
||||
}
|
||||
|
||||
m_ui->m_txtPathsSettingsFile->setText(QDir::toNativeSeparators(qApp->settings()->fileName()));
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QFileDialog>
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
FormBackupDatabaseSettings::FormBackupDatabaseSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormBackupDatabaseSettings) {
|
||||
@ -34,11 +36,12 @@ FormBackupDatabaseSettings::FormBackupDatabaseSettings(QWidget *parent) : QDialo
|
||||
|
||||
connect(m_ui->m_checkBackupDatabase, SIGNAL(toggled(bool)), this, SLOT(checkOkButton()));
|
||||
connect(m_ui->m_checkBackupSettings, SIGNAL(toggled(bool)), this, SLOT(checkOkButton()));
|
||||
connect(m_ui->m_buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(performBackup()));
|
||||
connect(m_ui->m_txtBackupName->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkBackupNames(QString)));
|
||||
connect(m_ui->m_txtBackupName->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkOkButton()));
|
||||
connect(m_ui->m_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder()));
|
||||
|
||||
checkOkButton();
|
||||
|
||||
selectFolder(qApp->documentsFolderPath());
|
||||
m_ui->m_txtBackupName->lineEdit()->setText(QString(APP_LOW_NAME) + "_" + QDateTime::currentDateTime().toString("yyyyMMddHHmm"));
|
||||
}
|
||||
|
||||
@ -46,6 +49,20 @@ FormBackupDatabaseSettings::~FormBackupDatabaseSettings() {
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void FormBackupDatabaseSettings::performBackup() {
|
||||
|
||||
}
|
||||
|
||||
void FormBackupDatabaseSettings::selectFolder(QString path) {
|
||||
if (path.isEmpty()) {
|
||||
path = QFileDialog::getExistingDirectory(this, tr("Select destionation folder"), m_ui->m_lblSelectFolder->label()->text());
|
||||
}
|
||||
|
||||
if (!path.isEmpty()) {
|
||||
m_ui->m_lblSelectFolder->setStatus(WidgetWithStatus::Ok, QDir::toNativeSeparators(path), tr("Good destination folder is specified."));
|
||||
}
|
||||
}
|
||||
|
||||
void FormBackupDatabaseSettings::checkBackupNames(const QString &name) {
|
||||
if (name.simplified().isEmpty()) {
|
||||
m_ui->m_txtBackupName->setStatus(WidgetWithStatus::Error, tr("Backup name cannot be empty."));
|
||||
|
@ -37,6 +37,8 @@ class FormBackupDatabaseSettings : public QDialog {
|
||||
|
||||
|
||||
private slots:
|
||||
void performBackup();
|
||||
void selectFolder(QString path = QString());
|
||||
void checkBackupNames(const QString &name);
|
||||
void checkOkButton();
|
||||
|
||||
|
@ -164,7 +164,7 @@ void FormCategoryDetails::onNoIconSelected() {
|
||||
|
||||
void FormCategoryDetails::onLoadIconFromFile() {
|
||||
QFileDialog dialog(this, tr("Select icon file for the category"),
|
||||
QDir::homePath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||
qApp->homeFolderPath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
dialog.setWindowIcon(qApp->icons()->fromTheme("image-generic"));
|
||||
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
||||
|
@ -178,7 +178,7 @@ void FormFeedDetails::onNoIconSelected() {
|
||||
|
||||
void FormFeedDetails::onLoadIconFromFile() {
|
||||
QFileDialog dialog(this, tr("Select icon file for the feed"),
|
||||
QDir::homePath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||
qApp->homeFolderPath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
dialog.setWindowIcon(qApp->icons()->fromTheme("image-generic"));
|
||||
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
||||
|
@ -105,7 +105,7 @@ void FormImportExport::selectExportFile() {
|
||||
filter += filter_opml20;
|
||||
|
||||
QString selected_file = QFileDialog::getSaveFileName(this, tr("Select file for feeds export"),
|
||||
QDir::homePath(), filter, &selected_filter);
|
||||
qApp->homeFolderPath(), filter, &selected_filter);
|
||||
|
||||
|
||||
|
||||
@ -136,7 +136,8 @@ void FormImportExport::selectImportFile() {
|
||||
// Add more filters here.
|
||||
filter += filter_opml20;
|
||||
|
||||
QString selected_file = QFileDialog::getOpenFileName(this, tr("Select file for feeds import"), QDir::homePath(), filter, &selected_filter);
|
||||
QString selected_file = QFileDialog::getOpenFileName(this, tr("Select file for feeds import"), qApp->homeFolderPath(),
|
||||
filter, &selected_filter);
|
||||
|
||||
if (!selected_file.isEmpty()) {
|
||||
if (selected_filter == filter_opml20) {
|
||||
|
@ -164,7 +164,7 @@ void FormSettings::onSkinSelected(QTreeWidgetItem *current,
|
||||
void FormSettings::selectBrowserExecutable() {
|
||||
QString executable_file = QFileDialog::getOpenFileName(this,
|
||||
tr("Select web browser executable"),
|
||||
QDir::homePath(),
|
||||
qApp->homeFolderPath(),
|
||||
//: File filter for external browser selection dialog.
|
||||
tr("Executables (*.*)"));
|
||||
|
||||
|
@ -129,7 +129,7 @@ void FormUpdate::updateProgress(qint64 bytes_received, qint64 bytes_total) {
|
||||
|
||||
void FormUpdate::saveUpdateFile(const QByteArray &file_contents) {
|
||||
QString url_file = m_updateInfo.m_urls.value(OS_ID).m_fileUrl;;
|
||||
QString temp_directory = qApp->getTempDirectory();
|
||||
QString temp_directory = qApp->tempFolderPath();
|
||||
|
||||
if (!temp_directory.isEmpty()) {
|
||||
QString output_file_name = url_file.mid(url_file.lastIndexOf('/') + 1);
|
||||
|
@ -118,7 +118,7 @@ class Application : public QtSingleApplication {
|
||||
m_mainForm = main_form;
|
||||
}
|
||||
|
||||
inline QString getTempDirectory() {
|
||||
inline QString tempFolderPath() {
|
||||
#if QT_VERSION >= 0x050000
|
||||
QString temp_directory = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
|
||||
#else
|
||||
@ -127,6 +127,24 @@ class Application : public QtSingleApplication {
|
||||
return temp_directory;
|
||||
}
|
||||
|
||||
inline QString documentsFolderPath() {
|
||||
#if QT_VERSION >= 0x050000
|
||||
QString doc_directory = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
#else
|
||||
QString doc_directory = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
|
||||
#endif
|
||||
return doc_directory;
|
||||
}
|
||||
|
||||
inline QString homeFolderPath() {
|
||||
#if QT_VERSION >= 0x050000
|
||||
QString home_path = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
#else
|
||||
QString home_path = QDesktopServices::storageLocation(QDesktopServices::HomeLocation);
|
||||
#endif
|
||||
return home_path;
|
||||
}
|
||||
|
||||
// Access to application tray icon. Always use this in cooperation with
|
||||
// SystemTrayIcon::isSystemTrayActivated().
|
||||
SystemTrayIcon *trayIcon();
|
||||
|
@ -87,7 +87,7 @@ void DatabaseFactory::sqliteAssemblyDatabaseFilePath() {
|
||||
QString(APP_DB_SQLITE_PATH);
|
||||
}
|
||||
else {
|
||||
m_sqliteDatabaseFilePath = QDir::homePath() + QDir::separator() +
|
||||
m_sqliteDatabaseFilePath = qApp->homeFolderPath() + QDir::separator() +
|
||||
QString(APP_LOW_H_NAME) + QDir::separator() +
|
||||
QString(APP_DB_SQLITE_PATH);
|
||||
}
|
||||
|
@ -47,14 +47,13 @@ Settings *Settings::setupSettings(QObject *parent) {
|
||||
|
||||
// If settings file exists in executable file working directory
|
||||
// (in subdirectory APP_CFG_PATH), then use it (portable settings).
|
||||
// Otherwise use settings file stored in homePath();
|
||||
// Otherwise use settings file stored in home path.
|
||||
QString relative_path = QDir::separator() + QString(APP_CFG_PATH) + QDir::separator() + QString(APP_CFG_FILE);
|
||||
QString app_path = qApp->applicationDirPath();
|
||||
QString app_path_file = app_path + relative_path;
|
||||
QString home_path = QDir::homePath() + QDir::separator() + QString(APP_LOW_H_NAME);
|
||||
QString home_path = qApp->homeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME);
|
||||
QString home_path_file = home_path + relative_path;
|
||||
|
||||
|
||||
bool portable_settings_available = QFileInfo(app_path).isWritable();
|
||||
bool non_portable_settings_exist = QFile::exists(home_path_file);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user