File indexing completed on 2024-04-28 17:00:47

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 
0021 #ifndef KDESVN_H
0022 #define KDESVN_H
0023 
0024 #include "kdesvn-config.h"
0025 
0026 #include <kparts/mainwindow.h>
0027 #include <kparts/readonlypart.h>
0028 #include <KBookmarks/KBookmarkManager>
0029 #include <KBookmarks/KBookmarkMenu>
0030 #include <KBookmarks/KBookmarkActionMenu>
0031 
0032 class KAction;
0033 class KActionMenu;
0034 class KToggleAction;
0035 
0036 /**
0037  * This class serves as the main window for kdesvn.  It handles the
0038  * menus, toolbars, and status bars.
0039  *
0040  * @short Main window class
0041  * @author Rajko Albrecht <ral@alwins-world.de>
0042  * @version $Rev$
0043  */
0044 class kdesvn : public KParts::MainWindow, public KBookmarkOwner
0045 {
0046     Q_OBJECT
0047 public:
0048     /**
0049      * Default Constructor
0050      */
0051     kdesvn();
0052 
0053     /**
0054      * Default Destructor
0055      */
0056     ~kdesvn();
0057 
0058     void openBookmark(const KBookmark &bm, Qt::MouseButtons mb, Qt::KeyboardModifiers km) override;
0059     QUrl currentUrl() const override;
0060     QString currentTitle() const override;
0061     void checkReload();
0062 
0063 protected:
0064     /**
0065      * This function is called when it is time for the app to save its
0066      * properties for session management purposes.
0067      */
0068     void saveProperties(KConfigGroup &) override;
0069 
0070     /**
0071      * This function is called when this app is restored.  The KConfig
0072      * object points to the session management config file that was saved
0073      * with @ref saveProperties
0074      */
0075     void readProperties(const KConfigGroup &) override;
0076     void closeEvent(QCloseEvent *event) override;
0077     void enableClose(bool how);
0078 
0079 public Q_SLOTS:
0080     virtual void slotUrlOpened(bool);
0081     /**
0082      * Use this method to load whatever file/URL you have
0083      */
0084     void load(const QUrl &_url)
0085     {
0086         load(_url, true);
0087     }
0088     void loadRescent(const QUrl &);
0089     void load(const QUrl &, bool);
0090 
0091 private slots:
0092     void fileOpen();
0093     void fileNew();
0094     void fileClose();
0095     void optionsShowStatusbar();
0096     void changeStatusbar(const QString &);
0097     void resetStatusBar();
0098 
0099 private:
0100     void setupAccel();
0101     void setupActions();
0102 
0103     KActionMenu *m_FileMenu;
0104     QString m_bookmarkFile;
0105     KBookmarkManager *m_BookmarkManager;
0106     KBookmarkActionMenu *m_BookmarksActionmenu;
0107     KActionCollection *m_Bookmarkactions;
0108     KBookmarkMenu *m_pBookmarkMenu;
0109     KParts::ReadOnlyPart *m_part;
0110     KToggleAction *m_statusbarAction;
0111 
0112 protected Q_SLOTS:
0113     virtual void optionsConfigureToolbars();
0114     virtual void optionsConfigureKeys();
0115     virtual void applyNewToolbarConfig();
0116     virtual void slotLoadLast(bool);
0117     virtual void slotExtraStatus(const QString &);
0118     virtual void slotResetExtraStatus();
0119 
0120 Q_SIGNALS:
0121     void sigSavestate();
0122 };
0123 
0124 #endif // _KDESVN_H_