File indexing completed on 2024-04-28 05:42:02

0001 /***************************************************************************
0002  *   Copyright (C) 2008 by Rajko Albrecht  ral@alwins-world.de             *
0003  *   https://kde.org/applications/development/org.kde.kdesvn               *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0019  ***************************************************************************/
0020 #ifndef MAINTREEWIDGET_H
0021 #define MAINTREEWIDGET_H
0022 
0023 #include "frontendtypes.h"
0024 #include "itemdisplay.h"
0025 #include "ui_treeWidget.h"
0026 
0027 #include "svnqt/client.h"
0028 #include "svnqt/status.h"
0029 
0030 #include <kservice.h>
0031 
0032 class KActionCollection;
0033 class MainTreeWidgetData;
0034 class SvnItemModelNode;
0035 class KJob;
0036 
0037 class MainTreeWidget : public QWidget, public Ui::mainTreeWidget, public ItemDisplay
0038 {
0039     Q_OBJECT
0040 public:
0041     explicit MainTreeWidget(KActionCollection *aCollection, QWidget *parent = nullptr, Qt::WindowFlags f = {});
0042     ~MainTreeWidget() override;
0043 
0044     QWidget *realWidget() override;
0045     SvnItem *Selected() const override;
0046     SvnItemList SelectionList() const override;
0047     svn::Revision baseRevision() const override;
0048     bool openUrl(const QUrl &url, bool noReinit = false) override;
0049     SvnItem *SelectedOrMain() const override;
0050 
0051     SvnItem *DirSelected() const;
0052     QModelIndex SelectedIndex() const;
0053     QModelIndex DirSelectedIndex() const;
0054     SvnItemModelNode *SelectedNode() const;
0055     SvnItemModelNode *DirSelectedNode() const;
0056     SvnItemList DirSelectionList() const;
0057     SvnItem *DirSelectedOrMain() const;
0058     void refreshItem(SvnItemModelNode *node);
0059 
0060     void clear();
0061     KActionCollection *filesActions();
0062 
0063 Q_SIGNALS:
0064     void sigLogMessage(const QString &);
0065     void sigExtraStatusMessage(const QString &);
0066     void changeCaption(const QString &);
0067     void sigShowPopup(const QString &, QWidget **);
0068     void sigUrlOpened(bool);
0069     void sigSwitchUrl(const QUrl &);
0070     void sigUrlChanged(const QUrl &);
0071     void sigProplist(const svn::PathPropertiesMapListPtr &, bool, bool, const QString &);
0072     void sigListError();
0073     void sigCacheStatus(qlonglong, qlonglong);
0074 
0075 public Q_SLOTS:
0076     void closeMe();
0077     void refreshCurrentTree();
0078     void slotSettingsChanged();
0079     void slotSelectionChanged(const QItemSelection &, const QItemSelection &);
0080     void slotNotifyMessage(const QString &);
0081     void slotMkBaseDirs();
0082     void slotMkdir();
0083     void refreshCurrent(SvnItem *);
0084     void slotReinitItem(SvnItem *);
0085     void stopLogCache();
0086     void slotChangeProperties(const svn::PropertiesMap &, const QStringList &, const QString &);
0087 
0088 protected Q_SLOTS:
0089     void slotCacheDataChanged();
0090     void slotItemActivated(const QModelIndex &);
0091     void slotItemExpanded(const QModelIndex &);
0092     void slotItemsInserted(const QModelIndex &);
0093     void slotRefreshItem(const QString &path);
0094     void _propListTimeout();
0095 
0096     void slotCheckUpdates();
0097     void slotCheckModified();
0098     void readSupportData();
0099     void slotClientException(const QString &);
0100 
0101     void slotIgnore();
0102     void slotLeftRecAddIgnore();
0103     void slotRightRecAddIgnore();
0104     void slotMakeLog() const;
0105     void slotMakeLogNoFollow() const;
0106     void slotDirMakeLogNoFollow() const;
0107     void slotMakeTree();
0108     void slotMakePartTree();
0109     void slotSelectBrowsingRevision();
0110     void slotLock();
0111     void slotUnlock();
0112     void slotDisplayLastDiff();
0113     void slotSimpleHeadDiff();
0114     void slotSimpleBaseDiff();
0115     void slotDirSimpleBaseDiff();
0116     void slotDiffRevisions();
0117     void slotDiffPathes();
0118     void slotInfo();
0119     void slotBlame();
0120     void slotRangeBlame();
0121     void slotDisplayProperties();
0122     void slotCat();
0123     void slotRevisionCat();
0124     void slotResolved();
0125     void slotTryResolve();
0126     void slotDelete();
0127     void slotLeftDelete();
0128     void slotRename();
0129     void slotCopy();
0130     void slotCleanupAction();
0131     void slotMergeRevisions();
0132     void slotMerge();
0133     void slotRelocate();
0134     void slotImportIntoCurrent(bool);
0135     void slotImportDirsIntoCurrent();
0136     void slotImportIntoDir(const QString &source, const QUrl &_targetUri, bool dirs);
0137     void slotChangeToRepository();
0138     void slotCheckNewItems();
0139 
0140     void slotCommit();
0141     void slotDirCommit();
0142     void slotDirUpdate();
0143     void slotDirRecProperty();
0144 
0145     void slotDirSelectionChanged(const QItemSelection &_item, const QItemSelection &);
0146     void checkSyncTreeModel();
0147 
0148     void _openUrl(const QUrl &);
0149     void enableActions();
0150     void slotUnfoldTree();
0151     void slotFoldTree();
0152     void slotOpenWith();
0153 
0154     void slotContextMenu(const QPoint &);
0155     void slotDirContextMenu(const QPoint &);
0156     void slotCopyFinished(KJob *job);
0157     void slotUpdateLogCache();
0158 
0159     void slotUrlDropped(const QList<QUrl> &, Qt::DropAction, const QModelIndex &, bool);
0160     void slotRepositorySettings();
0161 
0162     void slotRightProperties();
0163     void slotLeftProperties();
0164 
0165     void resizeAllColumns();
0166 
0167 protected:
0168     void keyPressEvent(QKeyEvent *) override;
0169     void setupActions();
0170     bool uniqueTypeSelected();
0171     KService::List offersList(SvnItem *item, bool execOnly = false) const;
0172     int selectionCount() const;
0173     int DirselectionCount() const;
0174     void dispProperties(bool);
0175     void copy_move(bool move);
0176     void itemActivated(const QModelIndex &index, bool keypress = false);
0177 
0178     void internalDrop(const QList<QUrl> &_lst, Qt::DropAction action, const QModelIndex &index);
0179     void execContextMenu(const SvnItemList &);
0180     void simpleWcDiff(SvnItem *which, const svn::Revision &, const svn::Revision &);
0181     void doLog(bool, bool) const;
0182 
0183     void checkUseNavigation(bool startup = false);
0184     void makeDelete(const SvnItemList &lst);
0185 
0186     void recAddIgnore(SvnItem *which);
0187 
0188 private:
0189     MainTreeWidgetData *m_Data;
0190     void enableAction(const QString &, bool);
0191 
0192     QAction *add_action(const QString &actionname, const QString &text, const QKeySequence &sequ, const QIcon &, QObject *, const char *slot);
0193 };
0194 
0195 #endif