Port from queryExit to closeEvent, since there's always only one mainwindow.
[kdepim.git] / blogilo / src / mainwindow.h
blob5fd4a139450ae022afa6890deccaf70b69b063a2
1 /*
2 This file is part of Blogilo, A KDE Blogging Client
4 Copyright (C) 2008-2010 Mehrdad Momeny <mehrdad.momeny@gmail.com>
5 Copyright (C) 2008-2010 Golnaz Nilieh <g382nilieh@gmail.com>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of
10 the License or (at your option) version 3 or any later version
11 accepted by the membership of KDE e.V. (or its successor approved
12 by the membership of KDE e.V.), which shall act as a proxy
13 defined in Section 14 of version 3 of the license.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, see http://www.gnu.org/licenses/
25 #ifndef MAINWINDOW_H
26 #define MAINWINDOW_H
28 #include "bilbopost.h"
29 #include "bilboblog.h"
31 #include <kxmlguiwindow.h>
33 #include <QPointer>
35 class KStatusNotifierItem;
36 class QProgressBar;
37 class QToolButton;
38 class Toolbox;
39 class KSelectAction;
40 class PostEntry;
41 class PostsTabWidget;
43 /**
44 Main window of blogilo...
46 @author Mehrdad Momeny <mehrdad.momeny@gmail.com>
47 @author Golnaz Nilieh <g382nilieh@gmail.com>
50 namespace PimCommon {
51 class StorageServiceManager;
54 class MainWindow : public KXmlGuiWindow
56 Q_OBJECT
57 public:
58 MainWindow();
60 ~MainWindow();
62 signals:
63 void mediaFilesUploaded( int count );
64 void settingsChanged();
66 private slots:
67 void slotOpenCurrentBlogInBrowser();
68 void slotSettingsChanged();
69 void slotCreateNewPost();
70 void addBlog();
71 void slotPostTitleChanged( const QString& title );
72 void slotToggleToolboxVisible( bool isVisible );
73 void slotToolboxVisibilityChanged( bool isVisible );
74 void slotActivePostChanged( int tabIndex );
75 void slotNewPostOpened( BilboPost &newPost, int blog_id );
77 void slotPublishPost();
79 /**
80 * Remove widget at position @p pos from main tab wigdet
82 void slotRemovePostEntry( int post );
84 void slotSavePostLocally();
86 void slotError( const QString &errorMessage );
88 /**
89 To open temporary posts and that posts are open at previous quit.
91 void loadTempPosts();
92 void uploadMediaObject();
94 void optionsPreferences();
95 void postManipulationDone( bool isError, const QString &customMessage );
96 void slotBusy( bool isBusy );
97 void slotShowStatusMessage(const QString &message, bool isPermanent);
98 void currentBlogChanged( QAction* );
100 void slotBlogAdded( const BilboBlog &blog );
101 void slotBlogEdited( const BilboBlog &blog );
102 void slotBlogRemoved( int blog_id );
104 void slotDialogDestroyed( QObject *win );
106 void slotCloseTabClicked();
107 void slotRemoveAllExclude(int);
109 void slotUploadFileDone(const QString &serviceName, const QString &filename);
110 void slotUploadFileFailed(const QString &serviceName, const QString &filename);
111 void slotActionFailed(const QString &serviceName, const QString &filename);
113 protected:
114 void keyPressEvent( QKeyEvent * event );
115 void closeEvent( QCloseEvent *event );
117 private:
118 void setCurrentBlog( int blog_id );
119 void setupActions();
120 void setupSystemTray();
121 void writeConfigs();
122 void initStorageService();
123 void setupStatusBar();
125 Create a new post entry,
126 and return pointer to it's widget (Actually return value is a PostEntry instance)
128 QWidget* createPostEntry(int blog_id, const BilboPost& post);
130 Toolbox *toolbox;
131 QDockWidget *toolboxDock;
132 QPointer<PostEntry> activePost;
133 KStatusNotifierItem *systemTray;
134 PostsTabWidget *tabPosts;
136 int previousActivePostIndex;
138 int busyNumber;///If this is 0 so there isn't any progress! otherwise there is! so progressbar will show
139 QProgressBar *progress;
141 KSelectAction *blogs;
142 int &mCurrentBlogId;
143 QToolButton *mCloseTabButton;
144 QToolButton *mNewTabButton;
145 PimCommon::StorageServiceManager *mStorageManager;
147 #endif