nextcloud-desktop/src/mirall/folder.cpp

67 lines
1.3 KiB
C++
Raw Normal View History

2011-02-17 02:21:45 +03:00
#include <QAction>
#include <QDebug>
#include <QDesktopServices>
#include <QIcon>
#include <QMutexLocker>
#include <QUrl>
#include "mirall/constants.h"
#include "mirall/folder.h"
#include "mirall/folderwatcher.h"
namespace Mirall {
Folder::Folder(const QString &path, QObject *parent)
: QObject(parent),
_path(path)
{
_openAction = new QAction(QIcon(FOLDER_ICON), path, this);
_openAction->setIconVisibleInMenu(true);
_openAction->setIcon(QIcon(FOLDER_ICON));
QObject::connect(_openAction, SIGNAL(triggered(bool)), SLOT(slotOpenFolder()));
2011-02-17 02:21:45 +03:00
_watcher = new Mirall::FolderWatcher(path, this);
QObject::connect(_watcher, SIGNAL(folderChanged(const QStringList &)),
SLOT(slotChanged(const QStringList &)));
2011-02-17 02:21:45 +03:00
}
QAction * Folder::openAction() const
2011-02-17 02:21:45 +03:00
{
return _openAction;
2011-02-17 02:21:45 +03:00
}
Folder::~Folder()
{
}
QString Folder::path() const
{
return _path;
}
void Folder::slotChanged(const QStringList &pathList)
2011-02-17 02:21:45 +03:00
{
qDebug() << "Changed >> " << pathList;
2011-02-17 02:21:45 +03:00
}
void Folder::slotOpenFolder()
{
QDesktopServices::openUrl(QUrl(_path));
}
void Folder::slotSyncStarted()
{
_openAction->setIcon(QIcon(FOLDER_SYNC_ICON));
}
void Folder::slotSyncFinished()
{
_openAction->setIcon(QIcon(FOLDER_ICON));
}
2011-02-17 02:21:45 +03:00
} // namespace Mirall
#include "folder.moc"