• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kalarm

functions.h

Go to the documentation of this file.
00001 /*
00002  *  functions.h  -  miscellaneous functions
00003  *  Program:  kalarm
00004  *  Copyright © 2004-2008 by David Jarvie <djarvie@kde.org>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef FUNCTIONS_H
00022 #define FUNCTIONS_H
00023 
00026 #include <QSize>
00027 #include <QString>
00028 #include <QList>
00029 
00030 #include "alarmevent.h"
00031 #include "editdlg.h"
00032 #include <kfile.h>
00033 #include <kmimetype.h>
00034 
00035 namespace KCal { class Event; }
00036 class QWidget;
00037 class KActionCollection;
00038 class KToggleAction;
00039 class QAction;
00040 class AlarmResource;
00041 class KAEvent;
00042 class MainWindow;
00043 class AlarmText;
00044 class TemplateMenuAction;
00045 
00046 namespace KAlarm
00047 {
00048 
00050 enum FileType { Unknown, TextPlain, TextFormatted, TextApplication, Image };
00054 enum UpdateStatus {
00055     UPDATE_OK,          // update succeeded
00056     UPDATE_KORG_ERR,    // update succeeded, but KOrganizer update failed
00057     UPDATE_ERROR,       // update failed partially
00058     UPDATE_FAILED,      // update failed completely
00059     SAVE_FAILED         // calendar was updated in memory, but save failed
00060 };
00062 enum UpdateError { ERR_ADD, ERR_MODIFY, ERR_DELETE, ERR_REACTIVATE, ERR_TEMPLATE };
00063 
00064 
00066 MainWindow*         displayMainWindowSelected(const QString& eventID = QString());
00067 bool                readConfigWindowSize(const char* window, QSize&, int* splitterWidth = 0);
00068 void                writeConfigWindowSize(const char* window, const QSize&, int splitterWidth = -1);
00069 QRect               desktopWorkArea();
00073 FileType            fileType(const KMimeType::Ptr& mimetype);
00075 int                 Version();
00076 inline int          Version(int major, int minor, int rev)     { return major*10000 + minor*100 + rev; }
00077 int                 getVersionNumber(const QString& version, QString* subVersion = 0);
00079 inline int          currentCalendarVersion()        { return KAEvent::calVersion(); }
00080 inline QString      currentCalendarVersionString()  { return KAEvent::calVersionString(); }
00081 QString             browseFile(const QString& caption, QString& defaultDir, const QString& initialFile = QString(),
00082                                const QString& filter = QString(), KFile::Modes mode = 0, QWidget* parent = 0);
00083 bool                editNewAlarm(const QString& templateName, QWidget* parent = 0);
00084 void                editNewAlarm(EditAlarmDlg::Type, QWidget* parent = 0);
00085 void                editNewAlarm(KAEvent::Action, QWidget* parent = 0, const AlarmText* = 0);
00086 void                editNewAlarm(const KAEvent* preset, QWidget* parent = 0);
00087 bool                editAlarm(const QString& eventID, QWidget* parent = 0);
00088 void                editAlarm(KAEvent*, QWidget* parent = 0);
00089 void                viewAlarm(const KAEvent*, QWidget* parent = 0);
00090 void                editNewTemplate(EditAlarmDlg::Type, QWidget* parent = 0);
00091 void                editNewTemplate(const KAEvent* preset, QWidget* parent = 0);
00092 void                editTemplate(KAEvent*, QWidget* parent = 0);
00094 TemplateMenuAction* createNewFromTemplateAction(const QString& label, KActionCollection*, const QString& name);
00095 KToggleAction*      createAlarmEnableAction(QObject* parent);
00099 KAEvent::List       templateList();
00100 void                outputAlarmWarnings(QWidget* parent, const KAEvent* = 0);
00101 void                refreshAlarms();
00102 void                refreshAlarmsIfQueued();    // must only be called from KAlarmApp::processQueue()
00103 QString             runKMail(bool minimise);
00104 bool                runProgram(const QString& program, QString& dbusService, const QString& dbusWindowPath, QString& errorMessage);
00105 
00106 QStringList         dontShowErrors(const QString& eventId);
00107 bool                dontShowErrors(const QString& eventId, const QString& tag);
00108 void                setDontShowErrors(const QString& eventId, const QStringList& tags = QStringList());
00109 void                setDontShowErrors(const QString& eventId, const QString& tag);
00110 
00111 enum         // 'options' parameter values for addEvent(). May be OR'ed together.
00112 {
00113     USE_EVENT_ID       = 0x01,   // use event ID if it's provided
00114     NO_RESOURCE_PROMPT = 0x02,   // don't prompt for resource
00115     ALLOW_KORG_UPDATE  = 0x04    // allow change to be sent to KOrganizer
00116 };
00117 UpdateStatus        addEvent(KAEvent&, AlarmResource* = 0, QWidget* msgParent = 0, int options = ALLOW_KORG_UPDATE, bool showKOrgErr = true);
00118 UpdateStatus        addEvents(QList<KAEvent>&, QWidget* msgParent = 0, bool allowKOrgUpdate = true, bool showKOrgErr = true);
00119 bool                addArchivedEvent(KAEvent&, AlarmResource* = 0);
00120 UpdateStatus        addTemplate(KAEvent&, AlarmResource* = 0, QWidget* msgParent = 0);
00121 UpdateStatus        modifyEvent(KAEvent& oldEvent, KAEvent& newEvent, QWidget* msgParent = 0, bool showKOrgErr = true);
00122 UpdateStatus        updateEvent(KAEvent&, QWidget* msgParent = 0, bool archiveOnDelete = true);
00123 UpdateStatus        updateTemplate(KAEvent&, QWidget* msgParent = 0);
00124 UpdateStatus        deleteEvent(KAEvent&, bool archive = true, QWidget* msgParent = 0, bool showKOrgErr = true);
00125 UpdateStatus        deleteEvents(KAEvent::List&, bool archive = true, QWidget* msgParent = 0, bool showKOrgErr = true);
00126 UpdateStatus        deleteTemplates(const QStringList& eventIDs, QWidget* msgParent = 0);
00127 inline UpdateStatus deleteTemplate(const QString& eventID, QWidget* msgParent = 0)
00128             { return deleteTemplates(QStringList(eventID), msgParent); }
00129 void                deleteDisplayEvent(const QString& eventID);
00130 UpdateStatus        reactivateEvent(KAEvent&, AlarmResource* = 0, QWidget* msgParent = 0, bool showKOrgErr = true);
00131 UpdateStatus        reactivateEvents(KAEvent::List&, QStringList& ineligibleIDs, AlarmResource* = 0, QWidget* msgParent = 0, bool showKOrgErr = true);
00132 UpdateStatus        enableEvents(KAEvent::List&, bool enable, QWidget* msgParent = 0);
00133 void                purgeArchive(int purgeDays);    // must only be called from KAlarmApp::processQueue()
00134 void                displayUpdateError(QWidget* parent, UpdateStatus, UpdateError, int nAlarms, int nKOrgAlarms = 1, bool showKOrgError = true);
00135 void                displayKOrgUpdateError(QWidget* parent, UpdateError, int nAlarms);
00136 
00137 QString             stripAccel(const QString&);
00138 
00139 bool                convTimeString(const QByteArray& tzString, KDateTime& dateTime, const KDateTime& defaultDt = KDateTime(), bool allowTZ = true);
00140 KDateTime           applyTimeZone(const QString& tzstring, const QDate& date, const QTime& time,
00141                                   bool haveTime, const KDateTime& defaultDt = KDateTime());
00142 bool                isWorkingTime(const KDateTime&);
00143 int                 localeFirstDayOfWeek();
00144 QString             weekDayName(int day, const KLocale*);
00145 
00146 /* Given a standard KDE day number, return the day number in the week for the user's locale.
00147  * Standard day number = 1 (Mon) .. 7 (Sun)
00148  * Locale day number in week = 0 .. 6
00149  */
00150 inline int          weekDay_to_localeDayInWeek(int weekDay)  { return (weekDay + 7 - localeFirstDayOfWeek()) % 7; }
00151 
00152 /* Given a day number in the week for the user's locale, return the standard KDE day number.
00153  * 'index' = 0 .. 6
00154  * Standard day number = 1 (Mon) .. 7 (Sun)
00155  */
00156 inline int          localeDayInWeek_to_weekDay(int index)  { return (index + localeFirstDayOfWeek() - 1) % 7 + 1; }
00157 
00158 } // namespace KAlarm
00159 
00160 bool caseInsensitiveLessThan(const QString& s1, const QString& s2);
00161 
00162 #endif // FUNCTIONS_H

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal