krop's commit fixes my problem in a better way, reverting
[kdepim.git] / korganizer / korganizer.h
blobdd085eb0e293beb530814b4800c13c63d5045d61
1 /*
2 This file is part of KOrganizer.
4 Copyright (c) 1997, 1998, 1999 Preston Brown <preston.brown@yale.edu>
5 Fester Zigterman <F.J.F.ZigtermanRustenburg@student.utwente.nl>
6 Ian Dawes <iadawes@globalserve.net>
7 Laszlo Boloni <boloni@cs.purdue.edu>
9 Copyright (c) 2000-2003 Cornelius Schumacher <schumacher@kde.org>
10 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License along
23 with this program; if not, write to the Free Software Foundation, Inc.,
24 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 As a special exception, permission is given to link this program
27 with any edition of Qt, and distribute the resulting executable,
28 without including the source code for Qt in the source distribution.
30 #ifndef KORGANIZER_H
31 #define KORGANIZER_H
33 #include <kurl.h>
35 #include <korganizer/mainwindow.h>
36 #include <korganizer/part.h>
37 #include <kparts/mainwindow.h>
39 class ActionManager;
40 class CalendarView;
42 namespace KCal { class CalendarResources; }
44 using namespace KCal;
46 // Workaround for moc workaround for visual c++ 6.0 sucking
47 typedef KOrg::MainWindow KOrgMainWindow;
48 typedef KParts::MainWindow KPartsMainWindow;
50 /**
51 This is the main class for KOrganizer. It extends the KDE KMainWindow.
52 it provides the main view that the user sees upon startup, as well as
53 menus, buttons, etc. etc.
55 @short constructs a new main window for korganizer
56 @author Preston Brown
58 class KOrganizer : public KPartsMainWindow, public KOrgMainWindow
60 Q_OBJECT
61 public:
62 KOrganizer();
63 virtual ~KOrganizer();
65 void init( bool hasDocument );
67 KOrg::CalendarViewBase *view() const;
68 ActionManager *actionManager() { return mActionManager; }
69 KActionCollection *getActionCollection() const { return actionCollection(); }
71 /**
72 Open calendar file from URL. Merge into current calendar, if \a merge is
73 true.
74 @param url The URL to open
75 @param merge true if the incidences in URL should be imported into the
76 current calendar (default resource or calendar file),
77 false if the URL should be added as a new resource.
78 @return true on success, false if an error occurred
80 bool openURL( const KUrl &url, bool merge = false );
81 /** Save calendar file to URL of current calendar */
82 bool saveURL();
83 /** Save calendar file to URL */
84 bool saveAsURL( const KUrl & kurl );
85 /** Get current URL */
86 KUrl getCurrentURL() const;
88 virtual KXMLGUIFactory *mainGuiFactory() { return factory(); }
89 virtual KXMLGUIClient *mainGuiClient() { return this; }
90 virtual QWidget *topLevelWidget() { return this; }
92 public slots:
93 /** show status message */
94 void showStatusMessage( const QString & );
96 protected slots:
98 /** using the KConfig associated with the kapp variable, read in the
99 * settings from the config file.
101 void readSettings();
103 /** write current state to config file. */
104 void writeSettings();
106 void statusBarPressed( int id );
108 /** Sets title of window according to filename and modification state */
109 void setTitle();
111 void newMainWindow( const KUrl & );
113 void slotEditKeys();
115 protected:
116 void initActions();
117 // void initViews();
119 /** supplied so that close events close calendar properly.*/
120 bool queryClose();
121 bool queryExit();
123 /* Session management */
124 void saveProperties( KConfigGroup & );
125 void readProperties( const KConfigGroup & );
127 private:
128 CalendarView *mCalendarView; // Main view widget
129 KOrg::Part::List mParts; // List of parts loaded
131 // status bar ids
132 enum {
133 ID_HISTORY,
134 ID_GENERAL,
135 ID_ACTIVE,
136 ID_MESSAGES_IN,
137 ID_MESSAGES_OUT
139 ActionManager *mActionManager;
142 #endif