Work on exporting settings/db.
This commit is contained in:
parent
d6cc4ff3ab
commit
0fbedb384c
@ -353,6 +353,7 @@ set(APP_SOURCES
|
||||
src/gui/messagessearchlineedit.cpp
|
||||
src/gui/formimportexport.cpp
|
||||
src/gui/styleditemdelegatewithoutfocus.cpp
|
||||
src/gui/formbackupdatabasesettings.cpp
|
||||
|
||||
# DYNAMIC-SHORTCUTS sources.
|
||||
src/dynamic-shortcuts/shortcutcatcher.cpp
|
||||
@ -438,6 +439,7 @@ set(APP_HEADERS
|
||||
src/gui/toolbareditor.h
|
||||
src/gui/messagessearchlineedit.h
|
||||
src/gui/formimportexport.h
|
||||
src/gui/formbackupdatabasesettings.h
|
||||
|
||||
# DYNAMIC-SHORTCUTS headers.
|
||||
src/dynamic-shortcuts/dynamicshortcutswidget.h
|
||||
@ -483,6 +485,7 @@ set(APP_FORMS
|
||||
src/gui/formfeeddetails.ui
|
||||
src/gui/toolbareditor.ui
|
||||
src/gui/formimportexport.ui
|
||||
src/gui/formbackupdatabasesettings.ui
|
||||
)
|
||||
|
||||
# APP translations.
|
||||
|
63
src/gui/formbackupdatabasesettings.cpp
Normal file
63
src/gui/formbackupdatabasesettings.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
// This file is part of RSS Guard.
|
||||
//
|
||||
// Copyright (C) 2011-2014 by Martin Rotter <rotter.martinos@gmail.com>
|
||||
//
|
||||
// RSS Guard is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// RSS Guard is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "gui/formbackupdatabasesettings.h"
|
||||
|
||||
#include "miscellaneous/application.h"
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
|
||||
|
||||
FormBackupDatabaseSettings::FormBackupDatabaseSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::FormBackupDatabaseSettings) {
|
||||
m_ui->setupUi(this);
|
||||
m_ui->m_txtBackupName->lineEdit()->setPlaceholderText(tr("Common name for backup files"));
|
||||
|
||||
setWindowIcon(qApp->icons()->fromTheme("document-export"));
|
||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
||||
|
||||
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_txtBackupName->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkBackupNames(QString)));
|
||||
connect(m_ui->m_txtBackupName->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkOkButton()));
|
||||
|
||||
checkOkButton();
|
||||
|
||||
m_ui->m_txtBackupName->lineEdit()->setText(QString(APP_LOW_NAME) + "_" + QDateTime::currentDateTime().toString("yyyyMMddHHmm"));
|
||||
}
|
||||
|
||||
FormBackupDatabaseSettings::~FormBackupDatabaseSettings() {
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void FormBackupDatabaseSettings::checkBackupNames(const QString &name) {
|
||||
if (name.simplified().isEmpty()) {
|
||||
m_ui->m_txtBackupName->setStatus(WidgetWithStatus::Error, tr("Backup name cannot be empty."));
|
||||
}
|
||||
else {
|
||||
m_ui->m_txtBackupName->setStatus(WidgetWithStatus::Ok, tr("Backup name looks okay."));
|
||||
}
|
||||
}
|
||||
|
||||
void FormBackupDatabaseSettings::checkOkButton() {
|
||||
m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setDisabled(m_ui->m_txtBackupName->lineEdit()->text().simplified().isEmpty() ||
|
||||
m_ui->m_lblSelectFolder->label()->text().simplified().isEmpty() ||
|
||||
(!m_ui->m_checkBackupDatabase->isChecked() &&
|
||||
!m_ui->m_checkBackupSettings->isChecked()));
|
||||
}
|
47
src/gui/formbackupdatabasesettings.h
Normal file
47
src/gui/formbackupdatabasesettings.h
Normal file
@ -0,0 +1,47 @@
|
||||
// This file is part of RSS Guard.
|
||||
//
|
||||
// Copyright (C) 2011-2014 by Martin Rotter <rotter.martinos@gmail.com>
|
||||
//
|
||||
// RSS Guard is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// RSS Guard is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with RSS Guard. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef FORMBACKUPDATABASECONFIG_H
|
||||
#define FORMBACKUPDATABASECONFIG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "ui_formbackupdatabasesettings.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class FormBackupDatabaseSettings;
|
||||
}
|
||||
|
||||
class FormBackupDatabaseSettings : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Constructors and destructors
|
||||
explicit FormBackupDatabaseSettings(QWidget *parent = 0);
|
||||
virtual ~FormBackupDatabaseSettings();
|
||||
|
||||
|
||||
private slots:
|
||||
void checkBackupNames(const QString &name);
|
||||
void checkOkButton();
|
||||
|
||||
private:
|
||||
Ui::FormBackupDatabaseSettings *m_ui;
|
||||
};
|
||||
|
||||
#endif // FORMBACKUPDATABASECONFIG_H
|
176
src/gui/formbackupdatabasesettings.ui
Normal file
176
src/gui/formbackupdatabasesettings.ui
Normal file
@ -0,0 +1,176 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FormBackupDatabaseSettings</class>
|
||||
<widget class="QDialog" name="FormBackupDatabaseSettings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Backup database/settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="m_groupFile">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="m_btnSelectFolder">
|
||||
<property name="text">
|
||||
<string>&Select folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="LabelWithStatus" name="m_lblSelectFolder" native="true">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="m_groupFeeds">
|
||||
<property name="title">
|
||||
<string>Backup properties</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Items to backup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="m_checkBackupDatabase">
|
||||
<property name="text">
|
||||
<string>Database</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="m_checkBackupSettings">
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Backup name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="LineEditWithStatus" name="m_txtBackupName" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Operation results</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="LabelWithStatus" name="m_lblResult" native="true">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LabelWithStatus</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>labelwithstatus.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LineEditWithStatus</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>lineeditwithstatus.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>m_buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>FormBackupDatabaseSettings</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>199</x>
|
||||
<y>283</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>199</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>FormBackupDatabaseSettings</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>199</x>
|
||||
<y>283</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>199</x>
|
||||
<y>149</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -35,6 +35,7 @@
|
||||
#include "gui/feedmessageviewer.h"
|
||||
#include "gui/formupdate.h"
|
||||
#include "gui/formimportexport.h"
|
||||
#include "gui/formbackupdatabasesettings.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QSessionManager>
|
||||
@ -334,6 +335,8 @@ void FormMain::createConnections() {
|
||||
// Menu "File" connections.
|
||||
connect(m_ui->m_actionExportFeeds, SIGNAL(triggered()), this, SLOT(exportFeeds()));
|
||||
connect(m_ui->m_actionImportFeeds, SIGNAL(triggered()), this, SLOT(importFeeds()));
|
||||
connect(m_ui->m_actionBackupDatabaseSettings, SIGNAL(triggered()), this, SLOT(backupDatabaseSettings()));
|
||||
connect(m_ui->m_actionRestoreDatabaseSettings, SIGNAL(triggered()), this, SLOT(restoreDatabaseSettings()));
|
||||
connect(m_ui->m_actionRestart, SIGNAL(triggered()), qApp, SLOT(restart()));
|
||||
connect(m_ui->m_actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||
|
||||
@ -354,26 +357,16 @@ void FormMain::createConnections() {
|
||||
connect(m_ui->m_actionDisplayWiki, SIGNAL(triggered()), this, SLOT(showWiki()));
|
||||
|
||||
// Menu "Web browser" connections.
|
||||
connect(m_ui->m_tabWidget, SIGNAL(currentChanged(int)),
|
||||
this, SLOT(loadWebBrowserMenu(int)));
|
||||
connect(m_ui->m_actionCloseCurrentTab, SIGNAL(triggered()),
|
||||
m_ui->m_tabWidget, SLOT(closeCurrentTab()));
|
||||
connect(m_ui->m_actionAddBrowser, SIGNAL(triggered()),
|
||||
m_ui->m_tabWidget, SLOT(addEmptyBrowser()));
|
||||
connect(m_ui->m_actionCloseAllTabs, SIGNAL(triggered()),
|
||||
m_ui->m_tabWidget, SLOT(closeAllTabsExceptCurrent()));
|
||||
connect(WebFactory::instance(), SIGNAL(imagesLoadingSwitched(bool)),
|
||||
m_ui->m_actionWebAutoloadImages, SLOT(setChecked(bool)));
|
||||
connect(WebFactory::instance(), SIGNAL(javascriptSwitched(bool)),
|
||||
m_ui->m_actionWebEnableJavascript, SLOT(setChecked(bool)));
|
||||
connect(WebFactory::instance(), SIGNAL(pluginsSwitched(bool)),
|
||||
m_ui->m_actionWebEnableExternalPlugins, SLOT(setChecked(bool)));
|
||||
connect(m_ui->m_actionWebAutoloadImages, SIGNAL(toggled(bool)),
|
||||
WebFactory::instance(), SLOT(switchImages(bool)));
|
||||
connect(m_ui->m_actionWebEnableExternalPlugins, SIGNAL(toggled(bool)),
|
||||
WebFactory::instance(), SLOT(switchPlugins(bool)));
|
||||
connect(m_ui->m_actionWebEnableJavascript, SIGNAL(toggled(bool)),
|
||||
WebFactory::instance(), SLOT(switchJavascript(bool)));
|
||||
connect(m_ui->m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(loadWebBrowserMenu(int)));
|
||||
connect(m_ui->m_actionCloseCurrentTab, SIGNAL(triggered()), m_ui->m_tabWidget, SLOT(closeCurrentTab()));
|
||||
connect(m_ui->m_actionAddBrowser, SIGNAL(triggered()), m_ui->m_tabWidget, SLOT(addEmptyBrowser()));
|
||||
connect(m_ui->m_actionCloseAllTabs, SIGNAL(triggered()), m_ui->m_tabWidget, SLOT(closeAllTabsExceptCurrent()));
|
||||
connect(WebFactory::instance(), SIGNAL(imagesLoadingSwitched(bool)), m_ui->m_actionWebAutoloadImages, SLOT(setChecked(bool)));
|
||||
connect(WebFactory::instance(), SIGNAL(javascriptSwitched(bool)), m_ui->m_actionWebEnableJavascript, SLOT(setChecked(bool)));
|
||||
connect(WebFactory::instance(), SIGNAL(pluginsSwitched(bool)), m_ui->m_actionWebEnableExternalPlugins, SLOT(setChecked(bool)));
|
||||
connect(m_ui->m_actionWebAutoloadImages, SIGNAL(toggled(bool)), WebFactory::instance(), SLOT(switchImages(bool)));
|
||||
connect(m_ui->m_actionWebEnableExternalPlugins, SIGNAL(toggled(bool)), WebFactory::instance(), SLOT(switchPlugins(bool)));
|
||||
connect(m_ui->m_actionWebEnableJavascript, SIGNAL(toggled(bool)), WebFactory::instance(), SLOT(switchJavascript(bool)));
|
||||
}
|
||||
|
||||
void FormMain::loadWebBrowserMenu(int index) {
|
||||
@ -405,6 +398,16 @@ void FormMain::importFeeds() {
|
||||
delete form.data();
|
||||
}
|
||||
|
||||
void FormMain::backupDatabaseSettings() {
|
||||
QPointer<FormBackupDatabaseSettings> form = new FormBackupDatabaseSettings(this);
|
||||
form.data()->exec();
|
||||
delete form.data();
|
||||
}
|
||||
|
||||
void FormMain::restoreDatabaseSettings() {
|
||||
|
||||
}
|
||||
|
||||
void FormMain::changeEvent(QEvent *event) {
|
||||
switch (event->type()) {
|
||||
case QEvent::WindowStateChange: {
|
||||
|
@ -97,6 +97,8 @@ class FormMain : public QMainWindow {
|
||||
// Displays various dialogs.
|
||||
void exportFeeds();
|
||||
void importFeeds();
|
||||
void backupDatabaseSettings();
|
||||
void restoreDatabaseSettings();
|
||||
void showSettings();
|
||||
void showAbout();
|
||||
void showUpdates();
|
||||
|
@ -124,7 +124,7 @@ QSqlDatabase DatabaseFactory::sqliteInitializeInMemoryDatabase() {
|
||||
|
||||
if (!file_init.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
// Database initialization file not opened. HUGE problem.
|
||||
qFatal("In-memory SQLite database initialization file '%s' from directory '%s' was not found. In-memory database is uninitialized.",
|
||||
qFatal("In-memory SQLite database initialization file '%s' from folder '%s' was not found. In-memory database is uninitialized.",
|
||||
APP_DB_SQLITE_INIT,
|
||||
qPrintable(APP_MISC_PATH));
|
||||
}
|
||||
@ -188,7 +188,7 @@ QSqlDatabase DatabaseFactory::sqliteInitializeFileBasedDatabase(const QString &c
|
||||
if (!db_path.exists()) {
|
||||
if (!db_path.mkpath(db_path.absolutePath())) {
|
||||
// Failure when create database file path.
|
||||
qFatal("Directory '%s' for SQLite database file '%s' was NOT created."
|
||||
qFatal("Folder '%s' for SQLite database file '%s' was NOT created."
|
||||
"This is HUGE problem.",
|
||||
qPrintable(db_path.absolutePath()),
|
||||
qPrintable(db_file.symLinkTarget()));
|
||||
@ -228,7 +228,7 @@ QSqlDatabase DatabaseFactory::sqliteInitializeFileBasedDatabase(const QString &c
|
||||
|
||||
if (!file_init.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
// Database initialization file not opened. HUGE problem.
|
||||
qFatal("SQLite database initialization file '%s' from directory '%s' was not found. File-based database is uninitialized.",
|
||||
qFatal("SQLite database initialization file '%s' from folder '%s' was not found. File-based database is uninitialized.",
|
||||
APP_DB_SQLITE_INIT,
|
||||
qPrintable(APP_MISC_PATH));
|
||||
}
|
||||
@ -413,7 +413,7 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString &connection_
|
||||
|
||||
if (!file_init.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
// Database initialization file not opened. HUGE problem.
|
||||
qFatal("MySQL database initialization file '%s' from directory '%s' was not found. File-based database is uninitialized.",
|
||||
qFatal("MySQL database initialization file '%s' from folder '%s' was not found. File-based database is uninitialized.",
|
||||
APP_DB_MYSQL_INIT,
|
||||
qPrintable(APP_MISC_PATH));
|
||||
}
|
||||
|
@ -53,9 +53,8 @@ class IconFactory : public QObject {
|
||||
|
||||
if (!m_cachedIcons.contains(name)) {
|
||||
// Icon is not cached yet.
|
||||
m_cachedIcons.insert(name, QIcon(APP_THEME_PATH + QDir::separator() +
|
||||
m_currentIconTheme + QDir::separator() +
|
||||
name + APP_THEME_SUFFIX));
|
||||
m_cachedIcons.insert(name,
|
||||
QIcon(APP_THEME_PATH + QDir::separator() + m_currentIconTheme + QDir::separator() + name + APP_THEME_SUFFIX));
|
||||
}
|
||||
|
||||
return m_cachedIcons.value(name);
|
||||
|
@ -25,7 +25,7 @@
|
||||
IOFactory::IOFactory() {
|
||||
}
|
||||
|
||||
bool IOFactory::removeDirectory(const QString& directory_name,
|
||||
bool IOFactory::removeFolder(const QString& directory_name,
|
||||
const QStringList& exception_file_list,
|
||||
const QStringList& exception_folder_list) {
|
||||
bool result = true;
|
||||
@ -37,7 +37,7 @@ bool IOFactory::removeDirectory(const QString& directory_name,
|
||||
QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst)) {
|
||||
if (info.isDir()) {
|
||||
if (!exception_folder_list.contains(info.fileName())) {
|
||||
result &= removeDirectory(info.absoluteFilePath(), exception_file_list, exception_folder_list);
|
||||
result &= removeFolder(info.absoluteFilePath(), exception_file_list, exception_folder_list);
|
||||
}
|
||||
}
|
||||
else if (!exception_file_list.contains(info.fileName())) {
|
||||
@ -59,7 +59,7 @@ bool IOFactory::removeDirectory(const QString& directory_name,
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IOFactory::copyDirectory(QString source, QString destination) {
|
||||
bool IOFactory::copyFolder(QString source, QString destination) {
|
||||
QDir dir_source(source);
|
||||
|
||||
if (!dir_source.exists()) {
|
||||
@ -75,7 +75,7 @@ bool IOFactory::copyDirectory(QString source, QString destination) {
|
||||
foreach (QString d, dir_source.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
|
||||
QString dst_path = destination + QDir::separator() + d;
|
||||
dir_source.mkpath(dst_path);
|
||||
copyDirectory(source + QDir::separator() + d, dst_path);
|
||||
copyFolder(source + QDir::separator() + d, dst_path);
|
||||
}
|
||||
|
||||
foreach (QString f, dir_source.entryList(QDir::Files)) {
|
||||
|
@ -28,12 +28,12 @@ class IOFactory {
|
||||
public:
|
||||
// Copy whole directory recursively.
|
||||
// Destination path is created if it does not exist.
|
||||
static bool copyDirectory(QString source, QString destination);
|
||||
static bool copyFolder(QString source, QString destination);
|
||||
|
||||
// Removes directory recursively and skips given folders/files.
|
||||
static bool removeDirectory(const QString &directory_name,
|
||||
const QStringList &exception_file_list = QStringList(),
|
||||
const QStringList &exception_folder_list = QStringList());
|
||||
static bool removeFolder(const QString &directory_name,
|
||||
const QStringList &exception_file_list = QStringList(),
|
||||
const QStringList &exception_folder_list = QStringList());
|
||||
};
|
||||
|
||||
#endif // IOFACTORY_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user