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

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