From c56c4729e32a9c8ba8709493b3ea11cf7cf229d3 Mon Sep 17 00:00:00 2001 From: ulf69 Date: Tue, 10 Aug 2004 16:10:42 +0000 Subject: additional files for external application configuration --- (limited to 'libkdepim/externalapphandler.h') diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h new file mode 100644 index 0000000..3ecf1b1 --- a/dev/null +++ b/libkdepim/externalapphandler.h @@ -0,0 +1,120 @@ +/* + This file is part of libkdepim. + Copyright (c) 2004 Ulf Schenk + + 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 program 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +/* +Enhanced Version of the file for platform independent KDE tools. +Copyright (c) 2004 Ulf Schenk + +$Id$ +*/ + +#ifndef EXTERNALAPPHANDLER_H +#define EXTERNALAPPHANDLER_H + +#include + +class QCopEnvelope; + + +class ExternalAppHandler; + +class DefaultAppItem +{ + public: + DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) + : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) + { } + + DefaultAppItem() + { } + + public: + int _type; + int _id; + QString _label; + QString _channel; + QString _message; + QString _parameters; // a list of parameters in stringrepresentation. Delimiter is ; + QString _message2; + QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; + +}; + +class ExternalAppHandler +{ + public: + virtual ~ExternalAppHandler(); + + static ExternalAppHandler *instance(); + + enum Types { + EMAIL = 0, + PHONE = 1, + SMS = 2, + FAX = 3, + PAGER = 4 + }; + + //calls the emailapplication with a number of attachments that need to be send + bool mailAttachments( const QString& urls ); + + //calls the emailapplication and creates a mail with parameter emails as recipients + bool mailToContacts( const QString& emails ); + + //calls the phoneapplication with the number + bool callByPhone( const QString& phonenumber ); + + //calls the smsapplication with the number + bool callBySMS( const QString& phonenumber ); + + //calls the pagerapplication with the number + bool callByPager( const QString& pagernumber ); + + //calls the faxapplication with the number + bool callByFax( const QString& faxnumber ); + + + //loadConfig clears the cache and checks again if the applications are available or not + void loadConfig(); + + QList getAvailableDefaultItems(Types); + DefaultAppItem* getDefaultItem(Types, int); + + + private: + ExternalAppHandler(); + QList mDefaultItems; + + + void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); + + QString& translateMessage(QString& message, const QString& emails) const; + void passParameter(QCopEnvelope* e, const QString& parameters, const QString& param1) const; + + + static ExternalAppHandler *sInstance; + + +}; + +#endif -- cgit v0.9.0.2