diff --git a/CMakeLists.txt b/CMakeLists.txt index 774c33c..beb1d97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,57 +1,57 @@ project(dolphin-plugins) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) include(FeatureSummary) set(QT_MIN_VERSION "5.8.0") set(KF5_MIN_VERSION "5.0.0") find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Widgets Network ) find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS XmlGui I18n KIO TextWidgets ) find_package(DolphinVcs) set_package_properties(DolphinVcs PROPERTIES DESCRIPTION "the Dolphin version control plugin library" - URL "http://dolphin.kde.org/" + URL "https://kde.org/applications/system/org.kde.dolphin" TYPE REQUIRED PURPOSE "Provides the version control plugin interface." ) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings) include(ECMMarkNonGuiExecutable) include(ECMOptionalAddSubdirectory) include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) if (EXISTS "${CMAKE_SOURCE_DIR}/.git") add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000) endif() ecm_optional_add_subdirectory(svn) ecm_optional_add_subdirectory(git) ecm_optional_add_subdirectory(bazaar) ecm_optional_add_subdirectory(dropbox) ecm_optional_add_subdirectory(hg) install(FILES org.kde.dolphin-plugins.metainfo.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/bazaar/fileviewbazaarplugin.cpp b/bazaar/fileviewbazaarplugin.cpp index 76bbbb7..0b816cf 100644 --- a/bazaar/fileviewbazaarplugin.cpp +++ b/bazaar/fileviewbazaarplugin.cpp @@ -1,505 +1,505 @@ /*************************************************************************** * Copyright (C) 2009-2010 by Peter Penz * * Copyright (C) 2011 Canonical Ltd. * * By Jonathan Riddell * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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 this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ #include "fileviewbazaarplugin.h" #include #include #include #include #include #include #include #include #include #include K_PLUGIN_FACTORY(FileViewBazaarPluginFactory, registerPlugin();) FileViewBazaarPlugin::FileViewBazaarPlugin(QObject* parent, const QList& args) : KVersionControlPlugin(parent), m_pendingOperation(false), m_versionInfoHash(), m_updateAction(0), m_pullAction(0), m_pushAction(0), m_showLocalChangesAction(0), m_commitAction(0), m_addAction(0), m_removeAction(0), m_logAction(0), m_command(), m_arguments(), m_errorMsg(), m_operationCompletedMsg(), m_contextDir(), m_contextItems(), m_process(), m_tempFile() { Q_UNUSED(args); m_updateAction = new QAction(this); m_updateAction->setIcon(QIcon::fromTheme("go-down")); m_updateAction->setText(i18nc("@item:inmenu", "Bazaar Update")); connect(m_updateAction, SIGNAL(triggered()), this, SLOT(updateFiles())); m_pullAction = new QAction(this); m_pullAction->setIcon(QIcon::fromTheme("go-bottom")); m_pullAction->setText(i18nc("@item:inmenu", "Bazaar Pull")); connect(m_pullAction, SIGNAL(triggered()), this, SLOT(pullFiles())); m_pushAction = new QAction(this); m_pushAction->setIcon(QIcon::fromTheme("go-top")); m_pushAction->setText(i18nc("@item:inmenu", "Bazaar Push")); connect(m_pushAction, SIGNAL(triggered()), this, SLOT(pushFiles())); m_showLocalChangesAction = new QAction(this); m_showLocalChangesAction->setIcon(QIcon::fromTheme("view-split-left-right")); m_showLocalChangesAction->setText(i18nc("@item:inmenu", "Show Local Bazaar Changes")); connect(m_showLocalChangesAction, SIGNAL(triggered()), this, SLOT(showLocalChanges())); m_commitAction = new QAction(this); m_commitAction->setIcon(QIcon::fromTheme("svn-commit")); m_commitAction->setText(i18nc("@item:inmenu", "Bazaar Commit...")); connect(m_commitAction, SIGNAL(triggered()), this, SLOT(commitFiles())); m_addAction = new QAction(this); m_addAction->setIcon(QIcon::fromTheme("list-add")); m_addAction->setText(i18nc("@item:inmenu", "Bazaar Add...")); connect(m_addAction, SIGNAL(triggered()), this, SLOT(addFiles())); m_removeAction = new QAction(this); m_removeAction->setIcon(QIcon::fromTheme("list-remove")); m_removeAction->setText(i18nc("@item:inmenu", "Bazaar Delete")); connect(m_removeAction, SIGNAL(triggered()), this, SLOT(removeFiles())); m_logAction = new QAction(this); m_logAction->setIcon(QIcon::fromTheme("format-list-ordered")); m_logAction->setText(i18nc("@item:inmenu", "Bazaar Log")); connect(m_logAction, SIGNAL(triggered()), this, SLOT(log())); connect(&m_process, QOverload::of(&QProcess::finished), this, &FileViewBazaarPlugin::slotOperationCompleted); connect(&m_process, &QProcess::errorOccurred, this, &FileViewBazaarPlugin::slotOperationError); } FileViewBazaarPlugin::~FileViewBazaarPlugin() { } QString FileViewBazaarPlugin::fileName() const { return QLatin1String(".bzr"); } bool FileViewBazaarPlugin::beginRetrieval(const QString& directory) { Q_ASSERT(directory.endsWith(QLatin1Char('/'))); QString baseDir; QProcess process1; process1.setWorkingDirectory(directory); process1.start(QLatin1String("bzr root")); while (process1.waitForReadyRead()) { char buffer[512]; while (process1.readLine(buffer, sizeof(buffer)) > 0) { baseDir = QString(buffer).trimmed(); } } // if bzr is not installed if (baseDir.isEmpty()) { return false; } // Clear all entries for this directory including the entries // for sub directories QMutableHashIterator it(m_versionInfoHash); while (it.hasNext()) { it.next(); if (it.key().startsWith(directory) || !it.key().startsWith(baseDir)) { it.remove(); } } QProcess process2; process2.setWorkingDirectory(directory); process2.start(QLatin1String("bzr ignored")); while (process2.waitForReadyRead()) { char buffer[512]; while (process2.readLine(buffer, sizeof(buffer)) > 0) { QString line = QString(buffer).trimmed(); QStringList list = line.split(' '); QString file = baseDir + '/' + list[0]; m_versionInfoHash.insert(file, UnversionedVersion); } } QStringList arguments; arguments << QLatin1String("status") << QLatin1String("-S"); arguments << baseDir; QProcess process; process.start(QLatin1String("bzr"), arguments); while (process.waitForReadyRead()) { char buffer[1024]; while (process.readLine(buffer, sizeof(buffer)) > 0) { ItemVersion state = NormalVersion; QString filePath = QString::fromUtf8(buffer); // This could probably do with being more consistent switch (buffer[0]) { case '?': state = UnversionedVersion; break; case ' ': if (buffer[1] == 'M') {state = LocallyModifiedVersion;} break; case '+': state = AddedVersion; break; case '-': state = RemovedVersion; break; case 'C': state = ConflictingVersion; break; default: if (filePath.contains('*')) { state = UpdateRequiredVersion; } break; } // Only values with a different state as 'NormalVersion' // are added to the hash table. If a value is not in the // hash table, it is automatically defined as 'NormalVersion' // (see FileViewBazaarPlugin::versionState()). if (state != NormalVersion) { int pos = 4; const int length = filePath.length() - pos - 1; //conflicts annoyingly have a human readable text before the filename //TODO cover other conflict types - if (filePath.startsWith("C Text conflict")) { + if (filePath.startsWith(QLatin1String("C Text conflict"))) { filePath = filePath.mid(17, length); } filePath = baseDir + '/' + filePath.mid(pos, length); //remove type symbols from directories, links and executables if (filePath.endsWith('/') || filePath.endsWith('@') || filePath.endsWith('*')) { filePath = filePath.left(filePath.length() - 1); } if (!filePath.isEmpty()) { m_versionInfoHash.insert(filePath, state); } } } } if ((process.exitCode() != 0 || process.exitStatus() != QProcess::NormalExit)) { return false; } return true; } void FileViewBazaarPlugin::endRetrieval() { } KVersionControlPlugin::ItemVersion FileViewBazaarPlugin::itemVersion(const KFileItem& item) const { const QString itemUrl = item.localPath(); if (m_versionInfoHash.contains(itemUrl)) { return m_versionInfoHash.value(itemUrl); } if (!item.isDir()) { // files that have not been listed by 'bzr status' or 'bzr ignored' (= m_versionInfoHash) // are under version control per definition return NormalVersion; } // The item is a directory. Check whether an item listed by 'bzr status' (= m_versionInfoHash) // is part of this directory. In this case a local modification should be indicated in the // directory already. const QString itemDir = itemUrl + QDir::separator(); QHash::const_iterator it = m_versionInfoHash.constBegin(); while (it != m_versionInfoHash.constEnd()) { if (it.key().startsWith(itemDir)) { const ItemVersion state = m_versionInfoHash.value(it.key()); if (state == LocallyModifiedVersion) { return LocallyModifiedVersion; } } ++it; } return NormalVersion; } QList FileViewBazaarPlugin::actions(const KFileItemList &items) const { if (items.count() == 1 && items.first().isDir()) { QString directory = items.first().localPath(); if (!directory.endsWith(QLatin1Char('/'))) { directory += QLatin1Char('/'); } if (directory == m_contextDir) { return contextMenuDirectoryActions(directory); } else { return contextMenuFilesActions(items); } } else { return contextMenuFilesActions(items); } } QList FileViewBazaarPlugin::contextMenuFilesActions(const KFileItemList& items) const { Q_ASSERT(!items.isEmpty()); foreach (const KFileItem& item, items) { m_contextItems.append(item); } m_contextDir.clear(); const bool noPendingOperation = !m_pendingOperation; if (noPendingOperation) { // iterate all items and check the version state to know which // actions can be enabled const int itemsCount = items.count(); int versionedCount = 0; int editingCount = 0; foreach (const KFileItem& item, items) { const ItemVersion state = itemVersion(item); if (state != UnversionedVersion) { ++versionedCount; } switch (state) { case LocallyModifiedVersion: case ConflictingVersion: ++editingCount; break; default: break; } } m_commitAction->setEnabled(editingCount > 0); m_addAction->setEnabled(versionedCount == 0); m_removeAction->setEnabled(versionedCount == itemsCount); } else { m_commitAction->setEnabled(false); m_addAction->setEnabled(false); m_removeAction->setEnabled(false); } m_updateAction->setEnabled(noPendingOperation); m_pullAction->setEnabled(noPendingOperation); m_pushAction->setEnabled(noPendingOperation); m_showLocalChangesAction->setEnabled(noPendingOperation); m_logAction->setEnabled(noPendingOperation); QList actions; actions.append(m_updateAction); actions.append(m_pullAction); actions.append(m_pushAction); actions.append(m_commitAction); actions.append(m_addAction); actions.append(m_removeAction); actions.append(m_showLocalChangesAction); actions.append(m_logAction); return actions; } QList FileViewBazaarPlugin::contextMenuDirectoryActions(const QString& directory) const { m_contextDir = directory; m_contextItems.clear(); // Only enable the actions if no commands are // executed currently (see slotOperationCompleted() and // startBazaarCommandProcess()). const bool enabled = !m_pendingOperation; m_updateAction->setEnabled(enabled); m_pullAction->setEnabled(enabled); m_pushAction->setEnabled(enabled); m_commitAction->setEnabled(enabled); m_addAction->setEnabled(enabled); m_showLocalChangesAction->setEnabled(enabled); m_logAction->setEnabled(enabled); QList actions; actions.append(m_updateAction); actions.append(m_pullAction); actions.append(m_pushAction); actions.append(m_commitAction); actions.append(m_addAction); actions.append(m_showLocalChangesAction); actions.append(m_logAction); return actions; } void FileViewBazaarPlugin::updateFiles() { execBazaarCommand("qupdate", QStringList(), i18nc("@info:status", "Updating Bazaar repository..."), i18nc("@info:status", "Update of Bazaar repository failed."), i18nc("@info:status", "Updated Bazaar repository.")); } void FileViewBazaarPlugin::pullFiles() { QStringList arguments = QStringList(); arguments << "-d"; execBazaarCommand("qpull", arguments, i18nc("@info:status", "Pulling Bazaar repository..."), i18nc("@info:status", "Pull of Bazaar repository failed."), i18nc("@info:status", "Pulled Bazaar repository.")); } void FileViewBazaarPlugin::pushFiles() { QStringList arguments = QStringList(); arguments << "-d"; execBazaarCommand("qpush", arguments, i18nc("@info:status", "Pushing Bazaar repository..."), i18nc("@info:status", "Push of Bazaar repository failed."), i18nc("@info:status", "Pushed Bazaar repository.")); } void FileViewBazaarPlugin::showLocalChanges() { execBazaarCommand("qdiff", QStringList(), i18nc("@info:status", "Reviewing Changes..."), i18nc("@info:status", "Review Changes failed."), i18nc("@info:status", "Reviewed Changes.")); } void FileViewBazaarPlugin::commitFiles() { execBazaarCommand("qcommit", QStringList(), i18nc("@info:status", "Committing Bazaar changes..."), i18nc("@info:status", "Commit of Bazaar changes failed."), i18nc("@info:status", "Committed Bazaar changes.")); } void FileViewBazaarPlugin::addFiles() { execBazaarCommand(QLatin1String("qadd"), QStringList(), i18nc("@info:status", "Adding files to Bazaar repository..."), i18nc("@info:status", "Adding of files to Bazaar repository failed."), i18nc("@info:status", "Added files to Bazaar repository.")); } void FileViewBazaarPlugin::removeFiles() { execBazaarCommand(QLatin1String("remove"), QStringList(), i18nc("@info:status", "Removing files from Bazaar repository..."), i18nc("@info:status", "Removing of files from Bazaar repository failed."), i18nc("@info:status", "Removed files from Bazaar repository.")); } void FileViewBazaarPlugin::log() { execBazaarCommand(QLatin1String("qlog"), QStringList(), i18nc("@info:status", "Running Bazaar Log..."), i18nc("@info:status", "Running Bazaar Log failed."), i18nc("@info:status", "Bazaar Log closed.")); } void FileViewBazaarPlugin::slotOperationCompleted(int exitCode, QProcess::ExitStatus exitStatus) { m_pendingOperation = false; if ((exitStatus != QProcess::NormalExit) || (exitCode != 0)) { emit errorMessage(m_errorMsg); } else if (m_contextItems.isEmpty()) { emit operationCompletedMessage(m_operationCompletedMsg); emit itemVersionsChanged(); } else { startBazaarCommandProcess(); } } void FileViewBazaarPlugin::slotOperationError() { // don't do any operation on other items anymore m_contextItems.clear(); m_pendingOperation = false; emit errorMessage(m_errorMsg); } void FileViewBazaarPlugin::execBazaarCommand(const QString& command, const QStringList& arguments, const QString& infoMsg, const QString& errorMsg, const QString& operationCompletedMsg) { emit infoMessage(infoMsg); QProcess process; process.start(QLatin1String("bzr plugins")); bool foundQbzr = false; while (process.waitForReadyRead()) { char buffer[512]; while (process.readLine(buffer, sizeof(buffer)) > 0) { QString output = QString(buffer).trimmed(); - if (output.startsWith("qbzr")) { + if (output.startsWith(QLatin1String("qbzr"))) { foundQbzr = true; break; } } } if (!foundQbzr) { emit infoMessage("Please Install QBzr"); return; } m_command = command; m_arguments = arguments; m_errorMsg = errorMsg; m_operationCompletedMsg = operationCompletedMsg; startBazaarCommandProcess(); } void FileViewBazaarPlugin::startBazaarCommandProcess() { Q_ASSERT(m_process.state() == QProcess::NotRunning); m_pendingOperation = true; const QString program(QLatin1String("bzr")); QStringList arguments; arguments << m_command << m_arguments; if (!m_contextDir.isEmpty()) { arguments << m_contextDir; m_contextDir.clear(); } else { const KFileItem item = m_contextItems.takeLast(); arguments << item.localPath(); // the remaining items of m_contextItems will be executed // after the process has finished (see slotOperationFinished()) } m_process.start(program, arguments); } #include "fileviewbazaarplugin.moc" diff --git a/dropbox/fileviewdropboxplugin.cpp b/dropbox/fileviewdropboxplugin.cpp index ab8bc28..36a0ae1 100644 --- a/dropbox/fileviewdropboxplugin.cpp +++ b/dropbox/fileviewdropboxplugin.cpp @@ -1,231 +1,231 @@ /***************************************************************************** * Copyright (C) 2014 by Emmanuel Pescosta * * Copyright (C) 2012 by Sergei Stolyarov * * Copyright (C) 2010 by Thomas Richard * * Copyright (C) 2009-2010 by Peter Penz * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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 this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ #include "fileviewdropboxplugin.h" #include #include #include #include #include #include #include #include #include #include K_PLUGIN_FACTORY(FileViewDropboxPluginFactory, registerPlugin();) class FileViewDropboxPlugin::Private { public: Private(FileViewDropboxPlugin* parent) : contextFilePaths(), controlSocketPath(), controlSocket(new QLocalSocket(parent)), databaseFileWatcher(new QFileSystemWatcher(parent)), contextActions(new KActionCollection(parent)) { } QStringList contextFilePaths; QString controlSocketPath; QPointer controlSocket; QPointer itemStateSocket; QPointer databaseFileWatcher; QPointer contextActions; }; QMap FileViewDropboxPlugin::m_itemVersions; FileViewDropboxPlugin::FileViewDropboxPlugin(QObject* parent, const QVariantList& args): KVersionControlPlugin(parent), d(new Private(this)) { Q_UNUSED(args); if (m_itemVersions.isEmpty()) { m_itemVersions.insert("up to date", KVersionControlPlugin::NormalVersion); m_itemVersions.insert("syncing", KVersionControlPlugin::UpdateRequiredVersion); m_itemVersions.insert("unsyncable", KVersionControlPlugin::ConflictingVersion); m_itemVersions.insert("unwatched", KVersionControlPlugin::UnversionedVersion); } const QString dropboxDir = QDir::home().path() % QDir::separator() % fileName() % QDir::separator(); d->controlSocketPath = QDir::toNativeSeparators(dropboxDir % QLatin1String("command_socket")); d->controlSocket->connectToServer(d->controlSocketPath); // Find and watch aggregation.dbx file QDir dir(dropboxDir); QStringList nameFilter("instance*"); QStringList instanceDirs = dir.entryList(nameFilter); QString aggregationDB = ""; for (const QString &instance : instanceDirs) { - aggregationDB = dropboxDir + "/" + instance + "/" + "aggregation.dbx"; + aggregationDB = dropboxDir + '/' + instance + '/' + "aggregation.dbx"; if (QFile::exists(aggregationDB)) { d->databaseFileWatcher->addPath(aggregationDB); break; } } connect(d->databaseFileWatcher, SIGNAL(fileChanged(QString)), SIGNAL(itemVersionsChanged())); connect(d->contextActions, SIGNAL(actionTriggered(QAction*)), SLOT(handleContextAction(QAction*))); } FileViewDropboxPlugin::~FileViewDropboxPlugin() { delete d; } QString FileViewDropboxPlugin::fileName() const { return QLatin1String(".dropbox"); } bool FileViewDropboxPlugin::beginRetrieval(const QString& directory) { Q_UNUSED(directory); Q_ASSERT(directory.endsWith(QLatin1Char('/'))); qRegisterMetaType("QAbstractSocket::SocketError"); qRegisterMetaType("QAbstractSocket::SocketState"); d->itemStateSocket = new QLocalSocket; return connectWithDropbox(d->itemStateSocket, LongTimeout); } KVersionControlPlugin::ItemVersion FileViewDropboxPlugin::itemVersion(const KFileItem& item) const { const QStringList reply = sendCommand("icon_overlay_file_status\npath\t", QStringList() << QDir(item.localPath()).canonicalPath(), d->itemStateSocket, WaitForReply, LongTimeout); if(reply.count() < 2) { // file/dir is not served by dropbox return KVersionControlPlugin::UnversionedVersion; } return m_itemVersions.value(reply.at(1), KVersionControlPlugin::UnversionedVersion); } void FileViewDropboxPlugin::endRetrieval() { delete d->itemStateSocket; } QList FileViewDropboxPlugin::actions(const KFileItemList& items) const { Q_ASSERT(!items.isEmpty()); d->contextActions->clear(); d->contextFilePaths.clear(); const KFileItemListProperties properties(items); if (!properties.isLocal()) { // not all files/dirs are local files/dirs return QList(); } foreach (const KFileItem& item, items) { d->contextFilePaths << QDir(item.localPath()).canonicalPath(); } const QStringList reply = sendCommand("icon_overlay_context_options\npaths\t", d->contextFilePaths, d->controlSocket, WaitForReply); if (reply.count() < 2) { // files/dirs are not served by dropbox return QList(); } // analyze item options and dynamically form a menu foreach (const QString& replyLine, reply) { const QStringList options = replyLine.split('~'); if (options.count() > 2) { QAction* action = d->contextActions->addAction(options.at(2)); action->setText(options.at(0)); action->setToolTip(options.at(1)); action->setIcon(QIcon::fromTheme("dropbox")); } } return d->contextActions->actions(); } void FileViewDropboxPlugin::handleContextAction(QAction* action) { sendCommand("icon_overlay_context_action\nverb\t" % action->objectName() % "\npaths\t", d->contextFilePaths, d->controlSocket); } QStringList FileViewDropboxPlugin::sendCommand(const QString& command, const QStringList& paths, const QPointer& socket, SendCommandMode mode, SendCommandTimeout timeout) const { if (!connectWithDropbox(socket, timeout)) { return QStringList(); } static const QString parameterSeperator('\t'); static const QString done("\ndone\n"); static const QString ok("ok\n"); const QString request = command % paths.join(parameterSeperator) % done; socket->readAll(); socket->write(request.toUtf8()); socket->flush(); if (mode == SendCommandOnly) { return QStringList(); } QString reply; while (socket->waitForReadyRead(timeout == ShortTimeout ? 100 : 500)) { reply.append(QString::fromUtf8(socket->readAll())); if (reply.endsWith(done)) { break; } } reply.remove(done); reply.remove(ok); return reply.split(parameterSeperator, QString::SkipEmptyParts); } bool FileViewDropboxPlugin::connectWithDropbox(const QPointer& socket, SendCommandTimeout timeout) const { if (socket->state() != QLocalSocket::ConnectedState) { socket->connectToServer(d->controlSocketPath); if (!socket->waitForConnected(timeout == ShortTimeout ? 100 : 500)) { socket->abort(); return false; } } return true; } #include "fileviewdropboxplugin.moc" diff --git a/dropbox/fileviewdropboxplugin.h b/dropbox/fileviewdropboxplugin.h index 700d05a..00800fb 100644 --- a/dropbox/fileviewdropboxplugin.h +++ b/dropbox/fileviewdropboxplugin.h @@ -1,88 +1,88 @@ /***************************************************************************** * Copyright (C) 2014 by Emmanuel Pescosta * * Copyright (C) 2012 by Sergei Stolyarov * * Copyright (C) 2010 by Thomas Richard * * Copyright (C) 2009-2010 by Peter Penz * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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 this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ #ifndef FILEVIEWDROPBOXPLUGIN_H #define FILEVIEWDROPBOXPLUGIN_H #include #include class QLocalSocket; //The dropbox protocol info can be found in the dropboxd-protocol file -//it can be found here http://dl.dropbox.com/u/4577542/dropbox/dropboxd-protocol.txt +//it can be found here https://build.opensuse.org/package/view_file/home:faco84/dolphin-box-plugin/dropboxd-protocol //Thanks Steffen Schuldenzucker! /** * @brief Dropbox implementation for the KVersionControlPlugin interface. */ class FileViewDropboxPlugin : public KVersionControlPlugin { Q_OBJECT private: enum SendCommandMode { WaitForReply, SendCommandOnly }; enum SendCommandTimeout { ShortTimeout, LongTimeout }; public: FileViewDropboxPlugin(QObject* parent, const QVariantList& args); ~FileViewDropboxPlugin() override; QString fileName() const override; bool beginRetrieval(const QString& directory) override; KVersionControlPlugin::ItemVersion itemVersion(const KFileItem& item) const override; void endRetrieval() override; QList actions(const KFileItemList& items) const override; private slots: void handleContextAction(QAction* action); private: QStringList sendCommand(const QString& command, const QStringList& paths, const QPointer& socket, SendCommandMode mode = SendCommandOnly, SendCommandTimeout timeout = ShortTimeout) const; bool connectWithDropbox(const QPointer& socket, SendCommandTimeout timeout) const; private: class Private; Private* const d; static QMap m_itemVersions; }; #endif // FILEVIEWDROPBOXPLUGIN_H diff --git a/git/checkoutdialog.h b/git/checkoutdialog.h index 2b0a382..ec224c6 100644 --- a/git/checkoutdialog.h +++ b/git/checkoutdialog.h @@ -1,90 +1,90 @@ /****************************************************************************** * Copyright (C) 2010 by Sebastian Doerner * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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 this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************/ #ifndef CHECKOUTDIALOG_H #define CHECKOUTDIALOG_H #include #include #include class QCheckBox; class QComboBox; class QDialogButtonBox; class QGroupBox; class QLineEdit; class QRadioButton; /** * @brief The dialog for checking out Branches or Tags in Git. */ class CheckoutDialog : public QDialog { Q_OBJECT public: - CheckoutDialog(QWidget* parent = 0); + explicit CheckoutDialog(QWidget* parent = 0); /** * Returns the name of the selected tag or branch to be checkout out * @returns The name of the selected tag or branch */ QString checkoutIdentifier() const; /** * @returns True if the user selected a forced checkout, false otherwise. */ bool force() const; /** * @returns The user selected name of the new branch, if a new branch is to be * created, empty String otherwise. */ QString newBranchName() const; private slots: void branchRadioButtonToggled(bool checked); void newBranchCheckBoxStateToggled(int state); /** * Checks whether the values of all relevant widgets are valid. * Enables or disables the OK button and sets tooltips accordingly. */ void setOkButtonState(); void noteUserEditedNewBranchName(); /** * Inserts a default name for the new branch into m_newBranchName unless the user * has already edited the content. * @param baseBranchName The base name to derive the new name of. */ void setDefaultNewBranchName(const QString & baseBranchName); private: inline void setLineEditErrorModeActive(bool active); private: ///@brief true if the user has manually edited the branchName, false otherwise bool m_userEditedNewBranchName; QSet m_branchNames; QPalette m_errorColors; QDialogButtonBox *m_buttonBox; QGroupBox * m_branchSelectGroupBox; QRadioButton * m_branchRadioButton; QComboBox * m_branchComboBox; QComboBox * m_tagComboBox; QCheckBox * m_newBranchCheckBox; QLineEdit * m_newBranchName; QCheckBox * m_forceCheckBox; }; #endif // CHECKOUTDIALOG_H diff --git a/git/pushdialog.h b/git/pushdialog.h index cac428c..dd2971a 100644 --- a/git/pushdialog.h +++ b/git/pushdialog.h @@ -1,52 +1,52 @@ /****************************************************************************** * Copyright (C) 2010 by Sebastian Doerner * * * * This program 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 2 of the License, or * * (at your option) any later version. * * * * This program 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 this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************/ #ifndef PUSHDIALOG_H #define PUSHDIALOG_H #include #include class QCheckBox; class QComboBox; class QDialogButtonBox; class PushDialog : public QDialog { Q_OBJECT public: - PushDialog(QWidget* parent = 0); + explicit PushDialog(QWidget* parent = 0); QString destination() const; QString localBranch() const; QString remoteBranch() const; bool force() const; private slots: void remoteSelectionChanged(const QString& newRemote); void localBranchSelectionChanged(const QString& newLocalBranch); private: QHash m_remoteBranches; QComboBox * m_remoteComboBox; QComboBox * m_localBranchComboBox; QComboBox * m_remoteBranchComboBox; QCheckBox * m_forceCheckBox; QDialogButtonBox * m_buttonBox; }; #endif // PUSHDIALOG_H diff --git a/svn/fileviewsvnpluginsettings.kcfg b/svn/fileviewsvnpluginsettings.kcfg index 43987cb..69e127e 100644 --- a/svn/fileviewsvnpluginsettings.kcfg +++ b/svn/fileviewsvnpluginsettings.kcfg @@ -1,11 +1,13 @@ - - + false