diff --git a/src/kdesvn.cpp b/src/kdesvn.cpp index 1a91e30d..54ee8cb0 100644 --- a/src/kdesvn.cpp +++ b/src/kdesvn.cpp @@ -1,446 +1,447 @@ /*************************************************************************** * Copyright (C) 2005-2009 by Rajko Albrecht * * ral@alwins-world.de * * * * 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 "kdesvn.h" #include "urldlg.h" #include "kdesvn_part.h" #include "helpers/ktranslateurl.h" #include "helpers/kdesvn_debug.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef TESTING_RC #include #endif kdesvn::kdesvn() : KParts::MainWindow(), KBookmarkOwner() { setAttribute(Qt::WA_DeleteOnClose); m_part = nullptr; #ifdef TESTING_RC setXMLFile(TESTING_RC); qCDebug(KDESVN_LOG) << "Using test rc file in " << TESTING_RC << endl; // I hate this crashhandler in development KCrash::setCrashHandler(0); #else setXMLFile(QStringLiteral("kdesvnui.rc")); #endif setStandardToolBarMenuEnabled(true); // then, setup our actions setupActions(); // and a status bar statusBar()->show(); QDir bookmarkDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); if (!bookmarkDir.exists()) { bookmarkDir.mkpath(bookmarkDir.absolutePath()); } m_bookmarkFile = bookmarkDir.absolutePath()+ QLatin1String("/bookmarks.xml"); m_BookmarkManager = KBookmarkManager::managerForExternalFile(m_bookmarkFile); m_BookmarksActionmenu = new KBookmarkActionMenu(m_BookmarkManager->root(), i18n("&Bookmarks"), this); actionCollection()->addAction(QStringLiteral("bookmarks"), m_BookmarksActionmenu); m_Bookmarkactions = new KActionCollection(static_cast(this)); m_pBookmarkMenu = new KBookmarkMenu(m_BookmarkManager, this, m_BookmarksActionmenu->menu(), m_Bookmarkactions); m_pBookmarkMenu->setParent(this); // clear when kdesvn window gets destroyed #ifdef EXTRA_KDE_LIBPATH QCoreApplication::addLibraryPath(QString::fromLocal8Bit(EXTRA_KDE_LIBPATH)) #endif // this routine will find and load our Part. it finds the Part by // name which is a bad idea usually.. but it's alright in this // case since our Part is made for this Shell KPluginLoader loader(QStringLiteral("kdesvnpart")); KPluginFactory *factory = loader.factory(); if (factory) { m_part = factory->create(this); if (m_part) { // tell the KParts::MainWindow that this is indeed the main widget setCentralWidget(m_part->widget()); connect(this, SIGNAL(sigSavestate()), m_part->widget(), SLOT(slotSavestate())); connect(m_part->widget(), SIGNAL(sigExtraStatusMessage(QString)), this, SLOT(slotExtraStatus(QString))); + connect(m_part->widget(), SIGNAL(sigUrlOpened(bool)), this, SLOT(slotUrlOpened(bool))); QAction *tmpAction; tmpAction = actionCollection()->addAction(QStringLiteral("subversion_create_repo"), m_part->widget(), SLOT(slotCreateRepo())); tmpAction->setText(i18n("Create and open new repository")); tmpAction->setToolTip(i18n("Create and opens a new local Subversion repository")); tmpAction = actionCollection()->addAction(QStringLiteral("subversion_dump_repo"), m_part->widget(), SLOT(slotDumpRepo())); tmpAction->setText(i18n("Dump repository to file")); tmpAction->setToolTip(i18n("Dump a Subversion repository to a file")); tmpAction = actionCollection()->addAction(QStringLiteral("subversion_hotcopy_repo"), m_part->widget(), SLOT(slotHotcopy())); tmpAction->setText(i18n("Hotcopy a repository")); tmpAction->setToolTip(i18n("Hotcopy a Subversion repository to a new folder")); tmpAction = actionCollection()->addAction(QStringLiteral("subversion_load_repo"), m_part->widget(), SLOT(slotLoaddump())); tmpAction->setText(i18n("Load dump into repository")); tmpAction->setToolTip(i18n("Load a dump file into a repository.")); tmpAction = actionCollection()->addAction(QStringLiteral("kdesvn_ssh_add"), m_part, SLOT(slotSshAdd())); tmpAction->setText(i18n("Add ssh identities to ssh-agent")); tmpAction->setToolTip(i18n("Force add ssh-identities to ssh-agent for future use.")); tmpAction = actionCollection()->addAction(QStringLiteral("help_about_kdesvnpart"), m_part, SLOT(showAboutApplication())); tmpAction->setText(i18n("Info about kdesvn part")); tmpAction->setToolTip(i18n("Shows info about the kdesvn plugin and not the standalone application.")); tmpAction = actionCollection()->addAction(QStringLiteral("db_show_status"), m_part, SLOT(showDbStatus())); tmpAction->setText(i18n("Show database content")); tmpAction->setToolTip(i18n("Show the content of log cache database")); // and integrate the part's GUI with the shells createGUI(m_part); } else { KMessageBox::error(this, i18n("Could not load the part:\n%1", loader.errorString())); qApp->quit(); return; } } else { // if we couldn't find our Part, we exit since the Shell by // itself can't do anything useful KMessageBox::error(this, i18n("Could not find our part:\n%1", loader.errorString())); qApp->quit(); // we return here, cause kapp->quit() only means "exit the // next time we enter the event loop... return; } setAutoSaveSettings(); } kdesvn::~kdesvn() { } void kdesvn::loadRescent(const QUrl &url) { load(url, true); } void kdesvn::load(const QUrl &url, bool addRescent) { QTimer::singleShot(100, this, &kdesvn::slotResetExtraStatus); if (m_part) { bool ret = m_part->openUrl(url); KRecentFilesAction *rac = nullptr; if (addRescent) { QAction *ac = actionCollection()->action(QStringLiteral("file_open_recent")); if (ac) { rac = (KRecentFilesAction *)ac; } } if (!ret) { changeStatusbar(i18n("Could not open URL %1", url.toString())); if (rac) { rac->removeUrl(url); } } else { resetStatusBar(); if (rac) { rac->addUrl(url); } } if (rac) { KConfigGroup cg(KSharedConfig::openConfig(), "recent_files"); rac->saveEntries(cg); } } } void kdesvn::setupActions() { QAction *ac; KStandardAction::open(this, SLOT(fileOpen()), actionCollection()); KStandardAction::openNew(this, SLOT(fileNew()), actionCollection()); ac = KStandardAction::close(this, SLOT(fileClose()), actionCollection()); // ac->setEnabled(getMemberList()->count()>1); ac->setEnabled(memberList().count() > 1); KStandardAction::quit(this, SLOT(close()), actionCollection()); KRecentFilesAction *rac = KStandardAction::openRecent(this, SLOT(loadRescent(QUrl)), actionCollection()); if (rac) { rac->setMaxItems(8); KConfigGroup cg(KSharedConfig::openConfig(), "recent_files"); rac->loadEntries(cg); rac->setText(i18n("Recent opened URLs")); } KStandardAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection()); KStandardAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection()); m_statusbarAction = KStandardAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection()); KToggleAction *toggletemp; toggletemp = new KToggleAction(i18n("Load last opened URL on start"), this); actionCollection()->addAction(QStringLiteral("toggle_load_last_url"), toggletemp); toggletemp->setToolTip(i18n("Reload last opened URL if no one is given on command line")); KConfigGroup cs(KSharedConfig::openConfig(), "startup"); toggletemp->setChecked(cs.readEntry("load_last_on_start", false)); connect(toggletemp, &QAction::toggled, this, &kdesvn::slotLoadLast); } void kdesvn::optionsShowStatusbar() { // this is all very cut and paste code for showing/hiding the // statusbar statusBar()->setVisible(m_statusbarAction->isChecked()); } void kdesvn::fileClose() { if (m_part) { m_part->closeUrl(); } // if (getMemberList()->count()>1) { if (memberList().count() > 1) { close(); } else { enableClose(false); QTimer::singleShot(100, this, &kdesvn::slotResetExtraStatus); enableClose(false); } } void kdesvn::saveProperties(KConfigGroup &config) { // the 'config' object points to the session managed // config file. anything you write here will be available // later when this app is restored if (!m_part) { return; } if (!m_part->url().isEmpty()) { config.writeEntry("lastURL", m_part->url().toString()); } } void kdesvn::readProperties(const KConfigGroup &config) { // the 'config' object points to the session managed // config file. this function is automatically called whenever // the app is being restored. read in here whatever you wrote // in 'saveProperties' if (!m_part) { return; } const QUrl url(config.readPathEntry("lastURL", QString())); if (url.isValid()) { m_part->openUrl(url); } } void kdesvn::fileNew() { // this slot is called whenever the File->New menu is selected, // the New shortcut is pressed (usually CTRL+N) or the New toolbar // button is clicked // create a new window (new kdesvn)->show(); enableClose(true); } void kdesvn::fileOpen() { QUrl url = UrlDlg::getUrl(this); if (!url.isEmpty()) { load(url, true); } } void kdesvn::changeStatusbar(const QString &text) { statusBar()->showMessage(text); } void kdesvn::resetStatusBar() { statusBar()->showMessage(i18n("Ready"), 4000); } // kde4 port - pv void kdesvn::openBookmark(const KBookmark &bm, Qt::MouseButtons mb, Qt::KeyboardModifiers km) { Q_UNUSED(mb); Q_UNUSED(km); if (!bm.url().isEmpty() && m_part) { load(bm.url(), false); } } QUrl kdesvn::currentUrl() const { if (!m_part) { return QUrl(); } return m_part->url(); } QString kdesvn::currentTitle() const { if (!m_part) { return QString(); } return m_part->url().fileName(); } void kdesvn::enableClose(bool how) { QAction *ac; if ((ac = actionCollection()->action(QStringLiteral("file_close")))) { ac->setEnabled(how); } } /*! \fn kdesvn::slotUrlOpened(bool) */ void kdesvn::slotUrlOpened(bool how) { enableClose(how); } /*! \fn kdesvn::optionsConfigureToolbars() */ void kdesvn::optionsConfigureToolbars() { KConfigGroup cg(KSharedConfig::openConfig(), autoSaveGroup()); saveMainWindowSettings(cg); // use the standard toolbar editor QPointer dlg(new KEditToolBar(factory())); connect(dlg.data(), &KEditToolBar::newToolbarConfig, this, &kdesvn::applyNewToolbarConfig); dlg->exec(); delete dlg; } /*! \fn kdesvn::applyNewToolbarConfig() */ void kdesvn::applyNewToolbarConfig() { KConfigGroup cg(KSharedConfig::openConfig(), autoSaveGroup()); applyMainWindowSettings(cg); } void kdesvn::optionsConfigureKeys() { QPointer kdlg(new KShortcutsDialog(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, m_part->widget())); kdlg->addCollection(actionCollection()); kdlg->addCollection(m_part->actionCollection()); kdlg->configure(true); delete kdlg; } /*! \fn kdesvn::closeEvent() */ void kdesvn::closeEvent(QCloseEvent *ev) { emit sigSavestate(); if (m_part) { KConfigGroup cs(KSharedConfig::openConfig(), "startup"); cs.writeEntry("lastURL", m_part->url().toString(QUrl::FullyEncoded)); cs.sync(); } return KParts::MainWindow::closeEvent(ev); } /*! \fn kdesvn::checkReload() */ void kdesvn::checkReload() { KConfigGroup cs(KSharedConfig::openConfig(), "startup"); if (!cs.readEntry("load_last_on_start", false)) { return; } const QUrl url(cs.readPathEntry("lastURL", QString())); if (url.isValid() && m_part) { load(url, false); } } /*! \fn kdesvn::slotLoadLast(bool) */ void kdesvn::slotLoadLast(bool how) { KConfigGroup cs(KSharedConfig::openConfig(), "startup"); cs.writeEntry("load_last_on_start", how); cs.sync(); } void kdesvn::slotResetExtraStatus() { statusBar()->clearMessage(); } void kdesvn::slotExtraStatus(const QString &message) { statusBar()->clearMessage(); statusBar()->showMessage(message); } diff --git a/src/kdesvnview.cpp b/src/kdesvnview.cpp index e6c08e0f..b55da50e 100644 --- a/src/kdesvnview.cpp +++ b/src/kdesvnview.cpp @@ -1,460 +1,460 @@ /*************************************************************************** * Copyright (C) 2005-2009 by Rajko Albrecht * * ral@alwins-world.de * * * * 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 "kdesvnview.h" #include "svnfrontend/maintreewidget.h" #include "svnfrontend/createrepodlg.h" #include "svnfrontend/dumprepo_impl.h" #include "svnfrontend/hotcopydlg_impl.h" #include "svnfrontend/loaddmpdlg_impl.h" #include "svnfrontend/stopdlg.h" #include "svnfrontend/fronthelpers/propertylist.h" #include "settings/kdesvnsettings.h" #include "svnqt/url.h" #include "svnqt/repository.h" #include "svnqt/version_check.h" #include "svnqt/svnqttypes.h" #include #include #include #include #include #include #include #include #include #include #include kdesvnView::kdesvnView(KActionCollection *aCollection, QWidget *parent, bool full) : QWidget(parent), svn::repository::RepositoryListener() , m_Collection(aCollection) , m_currentUrl() , m_CacheProgressBar(nullptr) , m_ReposCancel(false) { Q_UNUSED(full); setFocusPolicy(Qt::StrongFocus); setupActions(); m_topLayout = new QVBoxLayout(this); m_Splitter = new QSplitter(this); m_Splitter->setOrientation(Qt::Vertical); //m_TreeWidget=new kdesvnfilelist(m_Collection,m_Splitter); m_TreeWidget = new MainTreeWidget(m_Collection, m_Splitter); m_infoSplitter = new QSplitter(m_Splitter); m_infoSplitter->setOrientation(Qt::Horizontal); m_infoSplitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_LogWindow = new QTextBrowser(m_infoSplitter); m_LogWindow->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_LogWindow, &QWidget::customContextMenuRequested, this, &kdesvnView::onCustomLogWindowContextMenuRequested); Propertylist *pl = new Propertylist(m_infoSplitter); pl->setCommitchanges(true); pl->addCallback(m_TreeWidget); connect(m_TreeWidget, &MainTreeWidget::sigProplist, pl, &Propertylist::displayList); connect(m_TreeWidget, &MainTreeWidget::sigProplist, pl, &Propertylist::displayList); m_TreeWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_topLayout->addWidget(m_Splitter); connect(m_TreeWidget, &MainTreeWidget::sigLogMessage, this, &kdesvnView::slotAppendLog); connect(m_TreeWidget, &MainTreeWidget::changeCaption, this, &kdesvnView::slotSetTitle); connect(m_TreeWidget, &MainTreeWidget::sigShowPopup, this, &kdesvnView::slotDispPopup); - connect(m_TreeWidget, SIGNAL(sigUrlOpend(bool)), parent, SLOT(slotUrlOpened(bool))); + connect(m_TreeWidget, &MainTreeWidget::sigUrlOpend, this, &kdesvnView::sigUrlOpend); connect(m_TreeWidget, &MainTreeWidget::sigSwitchUrl, this, &kdesvnView::sigSwitchUrl); connect(m_TreeWidget, &MainTreeWidget::sigUrlChanged, this, &kdesvnView::slotUrlChanged); connect(m_TreeWidget, &MainTreeWidget::sigCacheStatus, this, &kdesvnView::fillCacheStatus); connect(m_TreeWidget, &MainTreeWidget::sigExtraStatusMessage, this, &kdesvnView::sigExtraStatusMessage); connect(this, &kdesvnView::sigMakeBaseDirs, m_TreeWidget, &MainTreeWidget::slotMkBaseDirs); KConfigGroup cs(Kdesvnsettings::self()->config(), "kdesvn-mainlayout"); QByteArray t1 = cs.readEntry("split1", QByteArray()); if (!t1.isEmpty()) { m_Splitter->restoreState(t1); } if (m_infoSplitter) { t1 = cs.readEntry("infosplit", QByteArray()); if (!t1.isEmpty()) { m_infoSplitter->restoreState(t1); } } } void kdesvnView::slotAppendLog(const QString &text) { m_LogWindow->append(text); } kdesvnView::~kdesvnView() { } void kdesvnView::slotSavestate() { KConfigGroup cs(Kdesvnsettings::self()->config(), "kdesvn-mainlayout"); cs.writeEntry("split1", m_Splitter->saveState()); if (m_infoSplitter) { cs.writeEntry("infosplit", m_infoSplitter->saveState()); } } void kdesvnView::slotUrlChanged(const QUrl &url) { m_currentUrl = url; slotSetTitle(url.toString()); emit sigUrlChanged(url); slotOnURL(i18n("Repository opened")); } QUrl kdesvnView::currentUrl() const { return m_currentUrl; } bool kdesvnView::openUrl(const QUrl &url) { /* transform of url must be done in part! otherwise we will run into different troubles! */ m_currentUrl.clear(); QUrl _url(url); bool open = false; if (_url.isLocalFile()) { QString query = _url.query(); _url.setQuery(QString()); QString _f = _url.path(); QFileInfo f(_f); if (!f.isDir()) { m_currentUrl.clear(); return open; } if (query.length() > 1) { _url.setQuery(query); } } else { if (!svn::Url::isValid(url.scheme())) { return open; } } m_LogWindow->clear(); slotSetTitle(url.toString()); if (m_TreeWidget->openUrl(url)) { slotOnURL(i18n("Repository opened")); m_currentUrl = url; open = true; } else { QString t = m_TreeWidget->lastError(); if (t.isEmpty()) { t = i18n("Could not open repository"); } slotOnURL(t); } return open; } void kdesvnView::slotOnURL(const QString &url) { emit signalChangeStatusbar(url); } void kdesvnView::slotSetTitle(const QString &title) { //emit signalChangeCaption(title); emit setWindowCaption(title); } /*! \fn kdesvnView::closeMe() */ void kdesvnView::closeMe() { m_TreeWidget->closeMe(); m_LogWindow->clear(); slotOnURL(i18n("No repository open")); } void kdesvnView::slotDispPopup(const QString &item, QWidget **target) { emit sigShowPopup(item, target); } /*! \fn kdesvnView::refreshCurrentTree() */ void kdesvnView::refreshCurrentTree() { m_TreeWidget->refreshCurrentTree(); } /*! \fn kdesvnView::slotSettingsChanged() */ void kdesvnView::slotSettingsChanged() { m_TreeWidget->slotSettingsChanged(); } /*! \fn kdesvnView::slotCreateRepo() */ void kdesvnView::slotCreateRepo() { QPointer dlg(new CreaterepoDlg(this)); if (dlg->exec() != QDialog::Accepted) { delete dlg; return; } QScopedPointer _rep(new svn::repository::Repository(this)); bool ok = true; closeMe(); try { _rep->CreateOpen(dlg->parameter()); } catch (const svn::ClientException &e) { slotAppendLog(e.msg()); ok = false; } if (!ok) { delete dlg; return; } bool createdirs = dlg->createMain(); // repo is created on a local path const QUrl path = QUrl::fromLocalFile(dlg->targetDir()); delete dlg; openUrl(path); if (createdirs) { emit sigMakeBaseDirs(); } } void kdesvnView::slotHotcopy() { QPointer dlg(new KSvnSimpleOkDialog(QStringLiteral("hotcopy_repo_size"), QApplication::activeModalWidget())); dlg->setWindowTitle(i18nc("@title:window", "Hotcopy a Repository")); dlg->setWithCancelButton(); HotcopyDlg_impl *ptr = new HotcopyDlg_impl(dlg); dlg->addWidget(ptr); if (dlg->exec() != QDialog::Accepted) { delete dlg; return; } bool cleanlogs = ptr->cleanLogs(); QString src = ptr->srcPath(); QString dest = ptr->destPath(); delete dlg; if (src.isEmpty() || dest.isEmpty()) { return; } try { svn::repository::Repository::hotcopy(src, dest, cleanlogs); slotAppendLog(i18n("Hotcopy finished.")); } catch (const svn::ClientException &e) { slotAppendLog(e.msg()); } } void kdesvnView::slotLoaddump() { QPointer dlg(new KSvnSimpleOkDialog(QStringLiteral("loaddump_repo_size"), this)); dlg->setWindowTitle(i18nc("@title:window", "Load a Repository From an svndump")); dlg->setWithCancelButton(); LoadDmpDlg_impl *ptr(new LoadDmpDlg_impl(dlg)); dlg->addWidget(ptr); if (dlg->exec() != QDialog::Accepted) { delete dlg; return; } svn::repository::Repository _rep(this); m_ReposCancel = false; try { _rep.Open(ptr->repository()); } catch (const svn::ClientException &e) { slotAppendLog(e.msg()); return ; } svn::repository::Repository::LOAD_UUID _act; switch (ptr->uuidAction()) { case 1: _act = svn::repository::Repository::UUID_IGNORE_ACTION; break; case 2: _act = svn::repository::Repository::UUID_FORCE_ACTION; break; case 0: default: _act = svn::repository::Repository::UUID_DEFAULT_ACTION; break; } const QUrl _uri = ptr->dumpFile(); QString _input; QTemporaryFile tmpfile; if (_uri.isLocalFile()) { _input = _uri.toLocalFile(); } else { tmpfile.open(); KIO::FileCopyJob *job = KIO::file_copy(_uri, QUrl::fromLocalFile(tmpfile.fileName())); KJobWidgets::setWindow(job, this); if (!job->exec()) { KMessageBox::error(this, job->errorString()); return; } _input = tmpfile.fileName(); } try { StopDlg sdlg(nullptr, this, i18nc("@title:window", "Load Dump"), i18n("Loading a dump into a repository.")); _rep.loaddump(_input, _act, ptr->parentPath(), ptr->usePre(), ptr->usePost(), ptr->validateProps()); slotAppendLog(i18n("Loading dump finished.")); } catch (const svn::ClientException &e) { slotAppendLog(e.msg()); } delete dlg; } void kdesvnView::slotDumpRepo() { QPointer dlg(new KSvnSimpleOkDialog(QStringLiteral("dump_repo_size"), QApplication::activeModalWidget())); dlg->setWindowTitle(i18nc("@title:window", "Dump a Repository")); dlg->setWithCancelButton(); DumpRepo_impl *ptr(new DumpRepo_impl(dlg)); dlg->addWidget(ptr); if (dlg->exec() != QDialog::Accepted) { delete dlg; return; } const QString re = ptr->reposPath(); const QString out = ptr->targetFile(); const bool incr = ptr->incremental(); const bool diffs = ptr->use_deltas(); const int s = ptr->startNumber(); const int e = ptr->endNumber(); delete dlg; m_ReposCancel = false; svn::Revision st = svn::Revision::UNDEFINED; svn::Revision en = svn::Revision::UNDEFINED; if (s > -1) { st = s; } if (e > -1) { en = e; } svn::repository::Repository *_rep(new svn::repository::Repository(this)); try { _rep->Open(re); } catch (const svn::ClientException &e) { slotAppendLog(e.msg()); delete _rep; return; } try { StopDlg sdlg(nullptr, this, i18nc("@title:window", "Dump"), i18n("Dumping a repository")); _rep->dump(out, st, en, incr, diffs); slotAppendLog(i18n("Dump finished.")); } catch (const svn::ClientException &e) { slotAppendLog(e.msg()); } delete _rep; } /*! \fn kdesvnView::setupActions() */ void kdesvnView::setupActions() { } void kdesvnView::sendWarning(const QString &aMsg) { slotAppendLog(aMsg); } void kdesvnView::sendError(const QString &aMsg) { slotAppendLog(aMsg); } bool kdesvnView::isCanceld() { if (!m_ReposCancel) { emit tickProgress(); return false; } return true; } void kdesvnView::setCanceled(bool how) { m_ReposCancel = how; } void kdesvnView::fillCacheStatus(qlonglong current, qlonglong max) { if (current > -1 && max > -1) { if (!m_CacheProgressBar) { m_CacheProgressBar = new QProgressBar(this); m_CacheProgressBar->setRange(0, (int)max); m_topLayout->addWidget(m_CacheProgressBar); m_CacheProgressBar->setFormat(i18n("Inserted %v not cached log entries of %m.")); } if (!m_CacheProgressBar->isVisible()) { m_CacheProgressBar->show(); } m_CacheProgressBar->setValue((int)current); } else { delete m_CacheProgressBar; m_CacheProgressBar = nullptr; } } void kdesvnView::stopCacheThreads() { m_TreeWidget->stopLogCache(); } void kdesvnView::onCustomLogWindowContextMenuRequested(const QPoint &pos) { QPointer menu = m_LogWindow->createStandardContextMenu(); QAction *clearAction = new QAction(tr("Clear"), menu.data()); clearAction->setEnabled(!m_LogWindow->toPlainText().isEmpty()); connect(clearAction, &QAction::triggered, m_LogWindow, &QTextEdit::clear); menu->addAction(clearAction); menu->exec(m_LogWindow->mapToGlobal(pos)); delete menu; } diff --git a/src/kdesvnview.h b/src/kdesvnview.h index da355718..e7dea203 100644 --- a/src/kdesvnview.h +++ b/src/kdesvnview.h @@ -1,142 +1,143 @@ /*************************************************************************** * Copyright (C) 2005-2009 by Rajko Albrecht * * ral@alwins-world.de * * * * 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 KDESVNVIEW_H #define KDESVNVIEW_H #include "svnqt/repositorylistener.h" #include #include #include class QPainter; class KdeSvnDirList; class QVBoxLayout; class QSpacerItem; class QSplitter; class KActionCollection; class QTextBrowser; class QProgressBar; class MainTreeWidget; /** * This is the main view class for kdesvn. Most of the non-menu, * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go * here. * * @short Main view * @author Rajko Albrecht * @version 0.1 */ class kdesvnView : public QWidget, public svn::repository::RepositoryListener { Q_OBJECT public: /** * Default constructor */ kdesvnView(KActionCollection *, QWidget *parent, bool full = false); /** * Destructor */ ~kdesvnView(); /** * Random 'get' function */ QUrl currentUrl() const; /** * Random 'set' function */ virtual bool openUrl(const QUrl &url); /* repositorylistener methods */ void sendWarning(const QString &) override; void sendError(const QString &) override; bool isCanceld() override; virtual void stopCacheThreads(); Q_SIGNALS: /** * Use this signal to change the content of the statusbar */ void signalChangeStatusbar(const QString &); /** * Extra messages for a temporary status bar */ void sigExtraStatusMessage(const QString &); /** * Use this signal to change the content of the caption */ void signalChangeCaption(const QString &); void sigShowPopup(const QString &, QWidget **); void sigSwitchUrl(const QUrl &); void sigUrlChanged(const QUrl &url); + void sigUrlOpend(bool); void setWindowCaption(const QString &); void sigMakeBaseDirs(); /* repositorylistener methods */ void tickProgress(); void waitShow(bool); public Q_SLOTS: virtual void closeMe(); virtual void slotDispPopup(const QString &, QWidget **); virtual void refreshCurrentTree(); virtual void slotSettingsChanged(); virtual void slotCreateRepo(); virtual void slotDumpRepo(); virtual void slotHotcopy(); virtual void slotLoaddump(); /* repositorylistener methods */ virtual void setCanceled(bool); virtual void fillCacheStatus(qlonglong, qlonglong); virtual void slotSavestate(); protected Q_SLOTS: virtual void slotOnURL(const QString &url); virtual void slotSetTitle(const QString &title); virtual void slotAppendLog(const QString &text); void slotUrlChanged(const QUrl &url); void onCustomLogWindowContextMenuRequested(const QPoint &pos); protected: //kdesvnfilelist*m_flist; MainTreeWidget *m_TreeWidget; KActionCollection *m_Collection; QSplitter *m_Splitter, *m_infoSplitter; QUrl m_currentUrl; QTextBrowser *m_LogWindow; QVBoxLayout *m_topLayout; QProgressBar *m_CacheProgressBar; protected: virtual void setupActions(); bool m_ReposCancel; }; #endif // _KDESVNVIEW_H_