File indexing completed on 2024-05-05 05:44:49

0001 /***************************************************************************
0002  *   Copyright (C) 2005-2009 by Rajko Albrecht                             *
0003  *   ral@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 COMMITMSG_IMPL_H
0021 #define COMMITMSG_IMPL_H
0022 
0023 #include "ksvnwidgets/models/commitmodelfwd.h"
0024 #include "ksvnwidgets/ui_commitmessage.h"
0025 #include "svnqt/commititem.h"
0026 
0027 #include <QtContainerFwd>
0028 
0029 class CommitModel;
0030 class CommitFilterModel;
0031 
0032 class Commitmsg_impl : public QWidget, Ui::CommitMessage
0033 {
0034     Q_OBJECT
0035 
0036 protected:
0037     explicit Commitmsg_impl(const svn::CommitItemList &_items, QWidget *parent = nullptr);
0038     explicit Commitmsg_impl(const CommitActionEntries &, const CommitActionEntries &, QWidget *parent = nullptr);
0039 
0040 public:
0041     explicit Commitmsg_impl(QWidget *parent = nullptr);
0042     ~Commitmsg_impl() override;
0043 
0044     QString getMessage() const;
0045     bool isKeeplocks() const;
0046     void initHistory();
0047     void saveHistory(bool canceld);
0048     void keepsLocks(bool);
0049 
0050     static QString getLogmessage(bool *ok, svn::Depth *rec, bool *keep_locks, QWidget *parent = nullptr);
0051     static QString getLogmessage(const svn::CommitItemList &, bool *ok, svn::Depth *rec, bool *keep_locks, QWidget *parent = nullptr);
0052 
0053     static QString getLogmessage(const CommitActionEntries &,
0054                                  const CommitActionEntries &,
0055                                  QObject *callback,
0056                                  CommitActionEntries &,
0057                                  bool *ok,
0058                                  bool *keep_locks,
0059                                  QWidget *parent = nullptr);
0060 
0061     void addItemWidget(QWidget *);
0062 
0063     svn::Depth getDepth() const;
0064 
0065     CommitActionEntries checkedEntries() const;
0066     void hideDepth(bool ahide);
0067 
0068     CommitModelNodePtr currentCommitItem(int column = 0);
0069 
0070 private:
0071     static QString getLogmessageInternal(Commitmsg_impl *ptr, bool *ok, svn::Depth *rec, bool *keep_locks, CommitActionEntries *result, QWidget *parent);
0072 protected Q_SLOTS:
0073     void slotHistoryActivated(int);
0074     void slotUnmarkUnversioned();
0075     void slotDiffSelected();
0076     void slotRevertSelected();
0077     void slotMarkUnversioned();
0078     void hideNewItems(bool hide);
0079     void insertFile();
0080     void slotItemReverted(const QStringList &);
0081     void slotItemDoubleClicked(const QModelIndex &index);
0082     void slotCurrentItemChanged(const QModelIndex &current);
0083     void slotSelectAll();
0084     void slotUnselectAll();
0085 
0086 protected:
0087     static QStringList sLogHistory;
0088     static QString sLastMessage;
0089     static int smax_message_history;
0090     bool m_hidden;
0091 
0092     void hideButtons(bool);
0093     void markUnversioned(bool mark);
0094     void checkSplitterSize();
0095     void setupModel();
0096     void insertFile(const QString &);
0097     void hideKeepsLock(bool);
0098 
0099     CommitModel *m_CurrentModel;
0100     CommitFilterModel *m_SortModel;
0101 
0102 Q_SIGNALS:
0103     void makeDiff(const QString &, const svn::Revision &, const QString &, const svn::Revision &, QWidget *);
0104     void sigRevertItem(const QStringList &);
0105 };
0106 
0107 #endif