1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2025-04-15 19:15:43 +02:00

add alias to folder

This commit is contained in:
Duncan Mac-Vicar P 2011-04-06 09:52:02 +02:00
parent c16fd94150
commit c19c9859e3
9 changed files with 38 additions and 14 deletions

View File

@ -144,7 +144,8 @@ void Application::setupFolderFromConfigFile(const QString &file) {
if (!backend.isNull()) {
if (backend.toString() == "unison") {
folder = new UnisonFolder(path.toString(),
folder = new UnisonFolder(file,
path.toString(),
settings.value("backend:unison/secondPath").toString(),
this);
}

View File

@ -14,11 +14,12 @@
namespace Mirall {
Folder::Folder(const QString &path, QObject *parent)
Folder::Folder(const QString &alias, const QString &path, QObject *parent)
: QObject(parent),
_path(path),
_pollTimer(new QTimer(this)),
_pollInterval(DEFAULT_POLL_INTERVAL_SEC)
_pollInterval(DEFAULT_POLL_INTERVAL_SEC),
_alias(alias)
{
_openAction = new QAction(QIcon(FOLDER_ICON), path, this);
_openAction->setIconVisibleInMenu(true);
@ -51,6 +52,11 @@ Folder::~Folder()
{
}
QString Folder::alias() const
{
return _alias;
}
QString Folder::path() const
{
return _path;

View File

@ -17,9 +17,14 @@ class Folder : public QObject
Q_OBJECT
public:
Folder(const QString &path, QObject *parent = 0L);
Folder(const QString &alias, const QString &path, QObject *parent = 0L);
virtual ~Folder();
/**
* alias or nickname
*/
QString alias() const;
/**
* local folder path
*/
@ -72,6 +77,7 @@ private:
// poll timer for remote syncs
QTimer *_pollTimer;
int _pollInterval;
QString _alias;
protected slots:

View File

@ -15,6 +15,7 @@ FolderWizardSourcePage::FolderWizardSourcePage()
{
_ui.setupUi(this);
registerField("*sourceFolder", _ui.localFolderLineEdit);
registerField("*alias", _ui.aliasFolderLineEdit);
}
FolderWizardSourcePage::~FolderWizardSourcePage()

View File

@ -4,8 +4,11 @@
namespace Mirall {
GitFolder::GitFolder(const QString &path, const QString &remote, QObject *parent)
: Folder(path, parent)
GitFolder::GitFolder(const QString &alias,
const QString &path,
const QString &remote,
QObject *parent)
: Folder(alias, path, parent)
, _remote(remote)
{
_syncProcess = new QProcess();

View File

@ -16,7 +16,9 @@ public:
* path : Local folder to be keep in sync
* remote: git repo url to sync from/to
*/
GitFolder(const QString &path, const QString &remote, QObject *parent = 0L);
GitFolder(const QString &alias,
const QString &path,
const QString &remote, QObject *parent = 0L);
virtual ~GitFolder();
virtual void startSync();

View File

@ -8,8 +8,11 @@
namespace Mirall {
UnisonFolder::UnisonFolder(const QString &path, const QString &secondPath, QObject *parent)
: Folder(path, parent),
UnisonFolder::UnisonFolder(const QString &alias,
const QString &path,
const QString &secondPath,
QObject *parent)
: Folder(alias, path, parent),
_unison(new QProcess(this)),
_secondPath(secondPath),
_syncCount(0)

View File

@ -15,7 +15,9 @@ class UnisonFolder : public Folder
{
Q_OBJECT
public:
UnisonFolder(const QString &path, const QString &secondPath, QObject *parent = 0L);
UnisonFolder(const QString &alias,
const QString &path,
const QString &secondPath, QObject *parent = 0L);
virtual ~UnisonFolder();
QString secondPath() const;

View File

@ -15,12 +15,10 @@
void TestUnisonFolder::initTestCase()
{
Mirall::INotify::initialize();
}
void TestUnisonFolder::cleanupTestCase()
{
Mirall::INotify::cleanup();
}
void TestUnisonFolder::testSyncFiles()
@ -30,13 +28,15 @@ void TestUnisonFolder::testSyncFiles()
qDebug() << tmp1.path() << tmp2.path();
Mirall::UnisonFolder folder(tmp1.path(), tmp2.path(), this);
Mirall::INotify::initialize();
Mirall::UnisonFolder folder("alias", tmp1.path(), tmp2.path(), this);
// create a directory in the first
QDir(tmp1.path()).mkdir("foo");
QTest::qWait(1000);
QVERIFY(QDir(tmp2.path() + "/foo").exists());
Mirall::INotify::cleanup();
}
QTEST_MAIN(TestUnisonFolder)