File indexing completed on 2024-05-12 17:16:13

0001 /***************************************************************************
0002  *   Copyright (C) 2008 by Rajko Albrecht  ral@alwins-world.de             *
0003  *   http://kdesvn.alwins-world.de/                                        *
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 "ui_treeWidget.h"
0024 #include "itemdisplay.h"
0025 #include "frontendtypes.h"
0026 
0027 #include "svnqt/status.h"
0028 #include "svnqt/client.h"
0029 
0030 #include <kservice.h>
0031 #include <krun.h>
0032 
0033 class KActionCollection;
0034 class MainTreeWidgetData;
0035 class SvnItemModelNode;
0036 class KJob;
0037 
0038 class MainTreeWidget: public QWidget, public Ui::mainTreeWidget, public ItemDisplay
0039 {
0040     Q_OBJECT
0041 public:
0042     explicit MainTreeWidget(KActionCollection *aCollection, QWidget *parent = nullptr, Qt::WindowFlags f = nullptr);
0043     ~MainTreeWidget();
0044 
0045     QWidget *realWidget() override;
0046     SvnItem *Selected()const override;
0047     SvnItemList SelectionList()const override;
0048     svn::Revision baseRevision()const override;
0049     bool openUrl(const QUrl &url, bool noReinit = false) override;
0050     SvnItem *SelectedOrMain()const override;
0051 
0052     SvnItem *DirSelected()const;
0053     QModelIndex SelectedIndex()const;
0054     QModelIndex DirSelectedIndex()const;
0055     SvnItemModelNode *SelectedNode()const;
0056     SvnItemModelNode *DirSelectedNode()const;
0057     SvnItemList DirSelectionList()const;
0058     SvnItem *DirSelectedOrMain()const;
0059     void refreshItem(SvnItemModelNode *node);
0060 
0061     void clear();
0062     KActionCollection *filesActions();
0063 
0064 Q_SIGNALS:
0065     void sigLogMessage(const QString &);
0066     void sigExtraStatusMessage(const QString &);
0067     void changeCaption(const QString &);
0068     void sigShowPopup(const QString &, QWidget **);
0069     void sigUrlOpened(bool);
0070     void sigSwitchUrl(const QUrl &);
0071     void sigUrlChanged(const QUrl &);
0072     void sigProplist(const svn::PathPropertiesMapListPtr &, bool, bool, const QString &);
0073     void sigListError();
0074     void sigCacheStatus(qlonglong, qlonglong);
0075 
0076 public Q_SLOTS:
0077     void closeMe();
0078     void refreshCurrentTree();
0079     void slotSettingsChanged();
0080     void slotSelectionChanged(const QItemSelection &, const QItemSelection &);
0081     void slotNotifyMessage(const QString &);
0082     void slotMkBaseDirs();
0083     void slotMkdir();
0084     void refreshCurrent(SvnItem *);
0085     void slotReinitItem(SvnItem *);
0086     void stopLogCache();
0087     void slotChangeProperties(const svn::PropertiesMap &, const QStringList &, const QString &);
0088 
0089 protected Q_SLOTS:
0090     void slotCacheDataChanged();
0091     void slotItemActivated(const QModelIndex &);
0092     void slotItemExpanded(const QModelIndex &);
0093     void slotItemsInserted(const QModelIndex &);
0094     void slotRefreshItem(const QString &path);
0095     void _propListTimeout();
0096 
0097     void slotCheckUpdates();
0098     void slotCheckModified();
0099     void readSupportData();
0100     void slotClientException(const QString &);
0101 
0102     void slotIgnore();
0103     void slotLeftRecAddIgnore();
0104     void slotRightRecAddIgnore();
0105     void slotMakeLog()const;
0106     void slotMakeLogNoFollow()const;
0107     void slotDirMakeLogNoFollow()const;
0108     void slotMakeTree();
0109     void slotMakePartTree();
0110     void slotSelectBrowsingRevision();
0111     void slotLock();
0112     void slotUnlock();
0113     void slotDisplayLastDiff();
0114     void slotSimpleHeadDiff();
0115     void slotSimpleBaseDiff();
0116     void slotDirSimpleBaseDiff();
0117     void slotDiffRevisions();
0118     void slotDiffPathes();
0119     void slotInfo();
0120     void slotBlame();
0121     void slotRangeBlame();
0122     void slotDisplayProperties();
0123     void slotCat();
0124     void slotRevisionCat();
0125     void slotResolved();
0126     void slotTryResolve();
0127     void slotDelete();
0128     void slotLeftDelete();
0129     void slotRename();
0130     void slotCopy();
0131     void slotCleanupAction();
0132     void slotMergeRevisions();
0133     void slotMerge();
0134     void slotRelocate();
0135     void slotImportIntoCurrent(bool);
0136     void slotImportDirsIntoCurrent();
0137     void slotImportIntoDir(const QString &source, const QUrl &_targetUri, bool dirs);
0138     void slotChangeToRepository();
0139     void slotCheckNewItems();
0140 
0141     void slotCommit();
0142     void slotDirCommit();
0143     void slotDirUpdate();
0144     void slotDirRecProperty();
0145 
0146     void slotDirSelectionChanged(const QItemSelection &_item, const QItemSelection &);
0147     void checkSyncTreeModel();
0148 
0149     void _openUrl(const QUrl &);
0150     void enableActions();
0151     void slotUnfoldTree();
0152     void slotFoldTree();
0153     void slotOpenWith();
0154 
0155     void slotContextMenu(const QPoint &);
0156     void slotDirContextMenu(const QPoint &);
0157     void slotCopyFinished(KJob *job);
0158     void slotUpdateLogCache();
0159 
0160     void slotUrlDropped(const QList<QUrl> &, Qt::DropAction, const QModelIndex &, bool);
0161     void slotRepositorySettings();
0162 
0163     void slotRightProperties();
0164     void slotLeftProperties();
0165 
0166     void resizeAllColumns();
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,
0193                         const QString &text,
0194                         const QKeySequence &sequ,
0195                         const QIcon &,
0196                         QObject *,
0197                         const char *slot);
0198 };
0199 
0200 #endif