Source: kalcatel/kalcatel.h
|
|
|
|
/*
* kalcatel.h
*
* main window code
*
* Copyright (c) 2002-2003 by Michal Cihar
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* In addition to GNU GPL this code may be used also in non GPL programs but
* if and only if programmer/distributor of that code receives written
* permission from author of this code.
*
*/
/* $Id: kalcatel.h,v 1.27 2003/05/09 16:52:46 michal Exp $ */
#ifndef KALCATEL_H
#define KALCATEL_H
#ifdef HAVE_CONFIG_H
#include
#endif
// include files for Qt
// include files for KDE
#include
#include
#include
#include
#include
#define STATUSBAR_TEXT 1
#define ID_STATUS_MSG 1
#define ID_DETAIL_MSG 2
// forward declaration of the KAlcatel classes
class QLabel;
class SignalLabel;
class SignalLed;
class KAlcatelDoc;
class KAlcatelView;
class KAlcatelConfigDialog;
class AlcatelMessage;
class AlcatelContact;
class AlcatelCalendar;
class AlcatelTodo;
class AlcatelCall;
class AlcatelCategory;
/**
* The base class for KAlcatel application windows. It sets up the main
* window and reads the config file as well as providing a menubar, toolbar
* and statusbar. An instance of KAlcatelView creates your center view, which is connected
* to the window's Doc object.
* KAlcatelApp reimplements the methods that KMainWindow provides for main window handling and supports
* full session management as well as using KActions.
* @see KMainWindow
* @see KApplication
* @see KConfig
*
* @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
* @version KDevelop version 1.2 code generation
*/
class KAlcatelApp : public KMainWindow
{
Q_OBJECT
friend class KAlcatelView;
public:
/** construtor of KAlcatelApp, calls all init functions to create the application.
*/
KAlcatelApp(QWidget *parent=0, const char *name=0);
~KAlcatelApp();
/** opens a file specified by commandline option
*/
void openDocumentFile(const KURL& url=0);
/** returns a pointer to the current document connected to the KTMainWindow instance and is used by
* the View class to access the document object's methods
*/
KAlcatelDoc *getDocument() const;
/* configuration :*/
QString phone_prefix;
QString mobile_device;
QString mobile_lock;
QString mobile_init;
bool mobile_rtscts;
int mobile_rate;
int mobile_debug;
bool auto_open_last;
KURL last_file;
int mergeData;
int conflictAction;
int contact_url;
bool reread_messages;
bool persistent_modem;
bool auto_modem;
bool saveTodos;
bool loadTodos;
bool saveEvents;
bool loadEvents;
bool saveContacts;
bool loadContacts;
bool saveMessages;
bool loadMessages;
bool saveCalls;
bool loadCalls;
int monitorInterval;
AlcatelContact *solveConflict(AlcatelContact &c1, AlcatelContact &c2);
AlcatelMessage *solveConflict(AlcatelMessage &c1, AlcatelMessage &c2);
AlcatelCalendar *solveConflict(AlcatelCalendar &c1, AlcatelCalendar &c2);
AlcatelTodo *solveConflict(AlcatelTodo &c1, AlcatelTodo &c2);
AlcatelCall *solveConflict(AlcatelCall &c1, AlcatelCall &c2);
AlcatelCategory *solveConflict(AlcatelCategory &c1, AlcatelCategory &c2);
protected:
/** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
* file
*/
void saveOptions();
/** read general Options again and initialize all variables like the recent file list
*/
void readOptions();
/** initializes anything sthat is configured
*/
void initConfig();
/** initializes the KActions of the application
*/
void initActions();
/** sets up the statusbar for the main window by initialzing a statuslabel.
*/
void initStatusBar();
/** initializes the document object of the main window that is connected to the view in initView().
* @see initView();
*/
void initDocument();
/** creates the centerwidget of the KTMainWindow instance and sets it as the view
*/
void initView();
/** queryClose is called by KTMainWindow on each closeEvent of a window. Against the
* default implementation (only returns true), this calles saveModified() on the document object to ask if the document shall
* be saved if Modified; on cancel the closeEvent is rejected.
* @see KTMainWindow#queryClose
* @see KTMainWindow#closeEvent
*/
virtual bool queryClose();
/** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
* Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
* properties.
* @see KTMainWindow#queryExit
* @see KTMainWindow#closeEvent
*/
virtual bool queryExit();
/** saves the window properties for each open window during session end to the session config file, including saving the currently
* opened file by a temporary filename provided by KApplication.
* @see KTMainWindow#saveProperties
*/
virtual void saveProperties(KConfig *_cfg);
/** reads the session config file and restores the application's state including the last opened files and documents by reading the
* temporary files saved by saveProperties()
* @see KTMainWindow#readProperties
*/
virtual void readProperties(KConfig *_cfg);
public slots:
/** reads all data from mobile
*/
void slotFetchAll();
/** reads todo data from mobile
*/
void slotFetchTodo();
/** reads message data from mobile
*/
void slotFetchMessages();
/** reads calendar data from mobile
*/
void slotFetchCalendar();
/** reads call data from mobile
*/
void slotFetchCalls();
/** reads contacts data from SIM
*/
void slotFetchContactsSim();
/** reads contacts data from mobile
*/
void slotFetchContactsMobile();
/** shows mobile information
*/
void slotMobileInfo();
/** clears the document in the actual view to reuse it as the new document
*/
void slotFileNew();
/** open a file and load it into the document
*/
void slotFileOpen();
/** opens a file from the recent files menu
*/
void slotFileOpenRecent(const KURL& url);
/** save a document
*/
void slotFileSave();
/** save a document by a new filename
*/
void slotFileSaveAs();
/** asks for saving if the file is modified, then closes the actual file and window
*/
void slotFileClose();
/** print the actual file
*/
void slotFilePrint();
/** closes all open windows by calling close() on each memberList item until the list is empty, then quits the application.
* If queryClose() returns false because the user canceled the saveModified() dialog, the closing breaks.
*/
void slotFileQuit();
/** put the marked text/object into the clipboard and remove
* it from the document
*/
void slotEditCut();
/** put the marked text/object into the clipboard
*/
void slotEditCopy();
/** paste the clipboard into the document
*/
void slotEditPaste();
/** toggles the toolbar
*/
void slotViewToolBar();
/** toggles the statusbar
*/
void slotViewStatusBar();
/** changes the statusbar contents for the standard label permanently, used to indicate current actions.
* @param text the text that is displayed in the statusbar
*/
void slotStatusMsg(const QString &text, int which, bool clearDetail = true);
/** sets default details status message
*/
void slotDefaultDetailMsg();
/** opens application configuration dialog
*/
void slotPreferencesEdit();
/** saves preferences
*/
void slotPreferencesSave();
/** opens key configuration dialog
*/
void slotConfigureKeys();
/** opens toolbar configuration dialog
*/
void slotPreferencesToolbars();
/** opens message editing dialog
*/
void slotNewMessage();
/** opens todo editing dialog
*/
void slotNewTodo();
/** opens contact editing dialog
*/
void slotNewContact();
/** opens event editing dialog
*/
void slotNewEvent();
/** creates new todo category
*/
void slotNewTodoCategory();
/** creates new contact category
*/
void slotNewContactCategory();
/** connects to modem
*/
bool modemConnect();
/** disconnects from modem
*/
void modemDisconnect();
/** manually disconnects from modem = doesn't check whether we want persistent connection
*/
void slotModemDisconnect();
/** updates battery and signal status
*/
void statusUpdate();
/** toggle connection status (connected/disconnected)
*/
void connectionToggle();
/** commits changes into mobile
*/
void slotMobileCommit();
private:
/** the configuration object of the application */
KConfig *config;
/** view is the main widget which represents your working area. The View
* class should handle all events of the view widget. It is kept empty so
* you can create your view according to your application's needs by
* changing the view class.
*/
KAlcatelView *view;
/** doc represents your actual document and is created only once. It keeps
* information such as filename and does the serialization of your files.
*/
KAlcatelDoc *doc;
/** main status text
*/
QString statusText;
/** detailed status text
*/
QString detailText;
// KAction pointers to enable/disable actions
KAction *fetchAll;
KAction *fetchTodo;
KAction *fetchMessages;
KAction *fetchCalendar;
KAction *fetchCalls;
KAction *fetchContactsSim;
KAction *fetchContactsMobile;
KAction *newMessage;
KAction *newEvent;
KAction *newContact;
KAction *newTodo;
KAction *newContactCategory;
KAction *newTodoCategory;
KAction *mobileInfo;
KAction *mobileCommit;
KAction *mobileManualDisconnect;
KAction *mobileManualConnect;
KAction *fileNew;
KAction *fileOpen;
KRecentFilesAction *fileOpenRecent;
KAction *fileSave;
KAction *fileSaveAs;
KAction *fileClose;
KAction *filePrint;
KAction *fileQuit;
KAction *editCut;
KAction *editCopy;
KAction *editPaste;
KToggleAction *viewToolBar;
KToggleAction *viewStatusBar;
KAction *preferencesSave;
KAction *preferencesEdit;
KAction *preferencesKeyBindings;
KAction *preferencesToolbars;
bool modemConnected;
bool modemLocked;
SignalLabel *signalLabel;
SignalLabel *batteryLabel;
SignalLed *statusLed;
protected:
void timerEvent( QTimerEvent * );
};
#endif // KALCATEL_H
Generated by: michal on quirk.cic on Fri May 9 19:34:14 2003, using kdoc 2.0a54. |