File indexing completed on 2024-04-21 05:42:24

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