30 #include <tdeglobal.h>
31 #include <tdecmdlineargs.h>
32 #include <tdeconfig.h>
34 #include <tdelocale.h>
38 #include <libkcal/calformat.h>
41 #include "korganizer.h"
44 #include "alarmclient.h"
45 #include "koglobals.h"
46 #include "actionmanager.h"
47 #include "importdialog.h"
49 #include "calendarview.h"
50 #include "stdcalendar.h"
53 #include <tdestartupinfo.h>
57 KOrganizerApp::KOrganizerApp() : TDEUniqueApplication()
59 TQString prodId =
"-//K Desktop Environment//NONSGML KOrganizer %1//EN";
60 CalFormat::setApplication(
"KOrganizer", prodId.arg( korgVersion ) );
63 KOrganizerApp::~KOrganizerApp()
67 int KOrganizerApp::newInstance()
69 kdDebug(5850) <<
"KOApp::newInstance()" << endl;
70 static bool first =
true;
71 if ( isRestored() && first ) {
74 KOrg::StdCalendar::self()->load();
75 korg->view()->updateCategories();
76 korg->view()->updateView();
83 TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
85 KOGlobals::self()->alarmClient()->startDaemon();
88 if ( args->count() <= 0 ) {
89 processCalendar( KURL() );
94 if ( args->isSet(
"open" ) ) {
95 for(
int i = 0; i < args->count(); ++i ) {
96 processCalendar( args->url( i ) );
100 processCalendar( KURL() );
103 kdError() <<
"Unable to find default calendar resources view." << endl;
107 if ( args->isSet(
"import" ) ) {
108 for(
int i = 0; i < args->count(); ++i ) {
111 }
else if ( args->isSet(
"merge" ) ) {
112 for(
int i = 0; i < args->count(); ++i ) {
116 for(
int i = 0; i < args->count(); ++i ) {
122 kdDebug(5850) <<
"KOApp::newInstance() done" << endl;
128 void KOrganizerApp::processCalendar(
const KURL &url )
132 bool hasDocument = !url.isEmpty();
133 korg =
new KOrganizer(
"KOrganizer MainWindow" );
134 korg->init( hasDocument );
137 kdDebug(5850) <<
"KOrganizerApp::processCalendar(): '" << url.url()
143 KOrg::StdCalendar::self()->load();
144 korg->view()->updateCategories();
145 korg->view()->updateView();
152 #if defined TQ_WS_X11 && ! defined K_WS_TQTONLY
153 TDEStartupInfo::setNewStartupId( korg->
topLevelWidget(), startupId() );
bool mergeURL(const TQString &url)
Open calendar file from URL.
static KOrg::MainWindow * findInstance(const KURL &url)
Is there a instance with this URL?
bool addResource(const KURL &mUrl)
Add a new resource.
interface for korganizer main window
virtual bool openURL(const KURL &url, bool merge=false)=0
Load calendar file from URL.
virtual ActionManager * actionManager()=0
Return ActionManager of this main window.
virtual TQWidget * topLevelWidget()=0
Return widget whcih represents this main window.
This is the main class for KOrganizer.