32 #include "korganizer.h"
34 #include "komailclient.h"
35 #include "calendarview.h"
36 #include "koviewmanager.h"
37 #include "kodialogmanager.h"
38 #include "kowindowlist.h"
41 #include "konewstuff.h"
42 #include "actionmanager.h"
43 #include "koglobals.h"
44 #include "alarmclient.h"
45 #include "resourceview.h"
46 #include "korganizerifaceimpl.h"
48 #include <korganizer/part.h>
50 #include <libtdepim/statusbarprogresswidget.h>
51 #include <libtdepim/progressdialog.h>
53 #include <libkcal/calendarlocal.h>
55 #include <libkcal/resourcecalendar.h>
57 #include <tdeglobal.h>
59 #include <kiconloader.h>
60 #include <kstandarddirs.h>
61 #include <tdestdaccel.h>
62 #include <tdefiledialog.h>
63 #include <tdeaction.h>
64 #include <kstdaction.h>
65 #include <kedittoolbar.h>
66 #include <tdetempfile.h>
67 #include <tdeio/netaccess.h>
68 #include <tdemessagebox.h>
69 #include <dcopclient.h>
70 #include <tdeprocess.h>
73 #include <kstdguiitem.h>
74 #include <kstatusbar.h>
85 using namespace KParts;
86 #include "korganizer.moc"
95 setWFlags( getWFlags() | WGroupLeader );
97 kdDebug(5850) <<
"KOrganizer::KOrganizer()" << endl;
98 KOCore::self()->addXMLGUIClient(
this,
this );
101 mCalendarView =
new CalendarView(
this,
"KOrganizer::CalendarView" );
102 setCentralWidget(mCalendarView);
104 mActionManager =
new ActionManager(
this, mCalendarView,
this,
this,
false );
105 (void)
new KOrganizerIfaceImpl( mActionManager,
this,
"IfaceImpl" );
108 KOrganizer::~KOrganizer()
110 delete mActionManager;
112 KOCore::self()->removeXMLGUIClient(
this );
115 void KOrganizer::init(
bool document )
117 kdDebug(5850) <<
"KOrganizer::init() "
118 << ( document ?
"hasDocument" :
"resources" ) << endl;
120 setHasDocument( document );
124 if ( hasDocument() ) {
130 mActionManager->
init();
131 connect( mActionManager, TQ_SIGNAL( actionNew(
const KURL & ) ),
132 TQ_SLOT( newMainWindow(
const KURL & ) ) );
134 mActionManager->loadParts();
139 KStatusBar *bar = statusBar();
141 bar->insertItem(
"", ID_GENERAL, 10 );
142 connect( bar, TQ_SIGNAL( pressed(
int ) ), TQ_SLOT( statusBarPressed(
int ) ) );
144 KPIM::ProgressDialog *progressDialog =
new KPIM::ProgressDialog( bar,
this );
145 progressDialog->hide();
147 KPIM::StatusbarProgressWidget *progressWidget;
148 progressWidget =
new KPIM::StatusbarProgressWidget( progressDialog, bar );
149 progressWidget->show();
151 bar->addWidget( progressWidget, 0,
true );
153 connect( mActionManager->view(), TQ_SIGNAL( statusMessage(
const TQString & ) ),
156 setStandardToolBarMenuEnabled(
true );
159 kdDebug(5850) <<
"KOrganizer::KOrganizer() done" << endl;
162 void KOrganizer::newMainWindow(
const KURL &url )
165 if ( url.isValid() || url.isEmpty() ) {
167 if ( korg->
openURL( url ) || url.isEmpty() ) {
183 TDEConfig *config = KOGlobals::self()->config();
193 kdDebug(5850) <<
"KOrganizer::writeSettings" << endl;
195 TDEConfig *config = KOGlobals::self()->config();
202 void KOrganizer::initActions()
205 setInstance( TDEGlobal::instance() );
207 setXMLFile(
"korganizerui.rc" );
208 setStandardToolBarMenuEnabled(
true );
209 createStandardStatusBarAction();
211 KStdAction::keyBindings(guiFactory(), TQ_SLOT(configureShortcuts()), actionCollection());
212 KStdAction::configureToolbars(
this, TQ_SLOT(configureToolbars() ), actionCollection());
213 KStdAction::quit(
this, TQ_SLOT( close() ), actionCollection() );
214 setAutoSaveSettings();
221 kdDebug(5850) <<
"KOrganizer::queryClose()" << endl;
223 bool close = mActionManager->queryClose();
232 bool KOrganizer::queryExit()
240 void KOrganizer::statusBarPressed(
int )
246 statusBar()->message(message,2000);
251 return mActionManager->
openURL( url, merge );
256 return mActionManager->
saveURL();
261 return mActionManager->
saveAsURL( kurl ) ;
266 return mActionManager->
url();
269 void KOrganizer::saveProperties( TDEConfig *config )
271 return mActionManager->saveProperties( config );
274 void KOrganizer::readProperties( TDEConfig *config )
276 return mActionManager->readProperties( config );
281 return mActionManager->view();
289 if ( !hasDocument() ) {
290 title = i18n(
"Calendar");
292 KURL url = mActionManager->
url();
294 if ( !url.isEmpty() ) {
295 if ( url.isLocalFile() ) title = url.fileName();
296 else title = url.prettyURL();
298 title = i18n(
"New Calendar");
302 title +=
" [" + i18n(
"read-only") +
"]";
308 setCaption( title, !mCalendarView->
isReadOnly() &&
312 bool KOrganizer::isCurrentlyActivePart()
The ActionManager creates all the actions in KOrganizer.
bool saveURL()
Save calendar file to URL of current calendar.
void createCalendarResources()
Create Calendar object based on the resource framework and set it on the view.
void createCalendarLocal()
Create Calendar object based on local file and set it on the view.
void readSettings()
Using the TDEConfig associated with the kapp variable, read in the settings from the config file.
void writeSettings()
Write current state to config file.
void init()
Peform initialization that requires this* to be full constructed.
bool saveAsURL(const KURL &kurl)
Save calendar file to URL.
bool openURL(const KURL &url, bool merge=false)
Open calendar file from URL.
KURL url() const
Get current URL.
This is the main calendar widget.
bool isModified()
query whether or not the calendar is "dirty".
bool isReadOnly()
query if the calendar is read-only.
TQString currentFilterName() const
Returns the name of the current filter.
interface for main calendar view widget
interface for korganizer main window
This is the main class for KOrganizer.
bool queryClose()
supplied so that close events close calendar properly.
bool openURL(const KURL &url, bool merge=false)
Open calendar file from URL.
void writeSettings()
write current state to config file.
KOrganizer(const char *name=0)
Constructs a new main window.
bool saveURL()
Save calendar file to URL of current calendar.
KURL getCurrentURL() const
Get current URL.
void readSettings()
using the TDEConfig associated with the kapp variable, read in the settings from the config file.
void showStatusMessage(const TQString &)
show status message
bool saveAsURL(const KURL &kurl)
Save calendar file to URL.
void setTitle()
Sets title of window according to filename and modification state.