diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /kmail/interfaces | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/interfaces')
-rw-r--r-- | kmail/interfaces/Makefile.am | 8 | ||||
-rw-r--r-- | kmail/interfaces/bodypart.h | 163 | ||||
-rw-r--r-- | kmail/interfaces/bodypartformatter.h | 95 | ||||
-rw-r--r-- | kmail/interfaces/bodyparturlhandler.h | 105 | ||||
-rw-r--r-- | kmail/interfaces/htmlwriter.h | 120 | ||||
-rw-r--r-- | kmail/interfaces/observable.h | 57 | ||||
-rw-r--r-- | kmail/interfaces/observer.h | 55 | ||||
-rw-r--r-- | kmail/interfaces/rulewidgethandler.h | 81 | ||||
-rw-r--r-- | kmail/interfaces/urlhandler.h | 79 |
9 files changed, 763 insertions, 0 deletions
diff --git a/kmail/interfaces/Makefile.am b/kmail/interfaces/Makefile.am new file mode 100644 index 000000000..df3d32a7f --- /dev/null +++ b/kmail/interfaces/Makefile.am @@ -0,0 +1,8 @@ +kmailincludedir = $(includedir)/kmail/interfaces +kmailinclude_HEADERS = \ + observer.h \ + observable.h \ + htmlwriter.h \ + bodypart.h \ + bodypartformatter.h \ + bodyparturlhandler.h diff --git a/kmail/interfaces/bodypart.h b/kmail/interfaces/bodypart.h new file mode 100644 index 000000000..0a69dd0c5 --- /dev/null +++ b/kmail/interfaces/bodypart.h @@ -0,0 +1,163 @@ +/* -*- mode: C++; c-file-style: "gnu" -*- + bodypart.h + + This file is part of KMail's plugin interface. + Copyright (c) 2004 Marc Mutz <mutz@kde.org>, + Ingo Kloecker <kloecker@kde.org> + + KMail 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. + + KMail 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KMAIL_INTERFACES_BODYPART_H__ +#define __KMAIL_INTERFACES_BODYPART_H__ + +template <typename T> class QMemArray; +typedef QMemArray<char> QByteArray; +class QString; + +namespace KMail { + namespace Interface { + + class Observer; + class Observable; + + /** + @short interface of classes that implement status for BodyPartFormatters. + */ + class BodyPartMemento { + public: + virtual ~BodyPartMemento() {} + + /** If your BodyPartMemento implementation also implements the + KMail::Observer interface, simply implement these as + <code>return this;</code>, else as <code>return + 0;</code>. This is needed to avoid forcing a dependency of + plugins on internal KMail classes. + */ + virtual Observer * asObserver() = 0; + + /** If your BodyPartMemento implementation also implements the + KMail::Observable interface, simply implement these as + <code>return this;</code>, else as <code>return + 0;</code>. This is needed to avoid forcing a dependency of + plugins on internal KMail classes. + */ + virtual Observable * asObservable() = 0; + }; + + /** + @short interface of message body parts. + */ + class BodyPart { + public: + virtual ~BodyPart() {} + + /** + @return a string respresentation of an URL that can be used + to invoke a BodyPartURLHandler for this body part. + */ + virtual QString makeLink( const QString & path ) const = 0; + + /** + @return the decoded (CTE, canonicalisation, and charset + encoding undone) text contained in the body part, or + QString::null, it the body part is not of type "text". + */ + virtual QString asText() const = 0; + + /** + @return the decoded (CTE undone) content of the body part, or + a null array if this body part instance is of type text. + */ + virtual QByteArray asBinary() const = 0; + + /** + @return the value of the content-type header field parameter + with name \a parameter, or QString::null, if that that + parameter is not present in the body's content-type header + field. RFC 2231 encoding is removed first. + + Note that this method will suppress queries to certain + standard parameters (most notably "charset") to keep plugins + decent. + + Note2 that this method preserves the case of the parameter + value returned. So, if the parameter you want to use defines + the value to be case-insensitive (such as the smime-type + parameter), you need to make sure you do the casemap yourself + before comparing to a reference value. + */ + virtual QString contentTypeParameter( const char * parameter ) const = 0; + + /** + @return the content of the content-description header field, + or QString::null if that header is not present in this body + part. RFC 2047 encoding is decoded first. + */ + virtual QString contentDescription() const = 0; + + //virtual int contentDisposition() const = 0; + /** + @return the value of the content-disposition header field + parameter with name \a parameter, or QString::null if that + parameter is not present in the body's content-disposition + header field. RFC 2231 encoding is removed first. + + The notes made for contentTypeParameter() above apply here as + well. + */ + virtual QString contentDispositionParameter( const char * parameter ) const = 0; + + /** + @return whether this part already has it's complete body + fetched e.g. from an IMAP server. + */ + virtual bool hasCompleteBody() const = 0; + + /** + @return the BodyPartMemento set for this part, or null, if + none is set. + */ + virtual BodyPartMemento * memento() const = 0; + + /** + @return register an implementation of the BodyPartMemento + interface as a status object with this part. + */ + virtual void setBodyPartMemento( BodyPartMemento * ) = 0; + + enum Display { None, AsIcon, Inline }; + /** + @return whether this body part should be displayed iconic or inline + */ + virtual Display defaultDisplay() const = 0; + }; + + } // namespace Interface + +} // namespace KMail + +#endif // __KMAIL_INTERFACES_BODYPART_H__ diff --git a/kmail/interfaces/bodypartformatter.h b/kmail/interfaces/bodypartformatter.h new file mode 100644 index 000000000..b31cb26b7 --- /dev/null +++ b/kmail/interfaces/bodypartformatter.h @@ -0,0 +1,95 @@ +/* -*- mode: C++; c-file-style: "gnu" -*- + bodypartformatter.h + + This file is part of KMail's plugin interface. + Copyright (c) 2004 Marc Mutz <mutz@kde.org>, + Ingo Kloecker <kloecker@kde.org> + + KMail 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. + + KMail 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KMAIL_INTERFACE_BODYPARTFORMATTER_H__ +#define __KMAIL_INTERFACE_BODYPARTFORMATTER_H__ + +namespace KMail { + + class HtmlWriter; + + namespace Interface { + + class BodyPart; + class BodyPartURLHandler; + + class BodyPartFormatter { + public: + virtual ~BodyPartFormatter() {} + + /** + @li Ok returned when format() generated some HTML + @li NeedContent returned when format() needs the body of the part + @li AsIcon returned when the part should be shown iconified + @li Failed returned when formatting failed. Currently equivalent to Ok + */ + enum Result { Ok, NeedContent, AsIcon, Failed }; + + /** + Format body part \a part by generating some HTML and writing + that to \a writer. + + @return the result code (see above) + */ + virtual Result format( BodyPart * part, KMail::HtmlWriter * writer ) const = 0; + }; + + /** + @short interface for BodyPartFormatter plugins + + The interface is queried by for types, subtypes, and the + corresponding bodypart formatter, and the result inserted into + the bodypart formatter factory. + + Subtype alone or both type and subtype may be "*", which is + taken as a wildcard, so that e.g. type=text subtype=* matches + any text subtype, but with lesser specificity than a concrete + mimetype such as text/plain. type=* is only allowed when + subtype=*, too. + */ + class BodyPartFormatterPlugin { + public: + virtual ~BodyPartFormatterPlugin() {} + + virtual const BodyPartFormatter * bodyPartFormatter( int idx ) const = 0; + virtual const char * type( int idx ) const = 0; + virtual const char * subtype( int idx ) const = 0; + + virtual const BodyPartURLHandler * urlHandler( int idx ) const = 0; + }; + + } // namespace Interface + +} // namespace KMail + +#endif // __KMAIL_INTERFACE_BODYPARTFORMATTER_H__ diff --git a/kmail/interfaces/bodyparturlhandler.h b/kmail/interfaces/bodyparturlhandler.h new file mode 100644 index 000000000..1fd8b16d9 --- /dev/null +++ b/kmail/interfaces/bodyparturlhandler.h @@ -0,0 +1,105 @@ +/* -*- c++ -*- + interfaces/bodyparturlhandler.h + + This file is part of KMail's plugin interface. + Copyright (c) 2003, 2004 Marc Mutz <mutz@kde.org> + + KMail 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. + + KMail 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KMAIL_INTERFACE_BODYPARTURLHANDLER_H__ +#define __KMAIL_INTERFACE_BODYPARTURLHANDLER_H__ + +class QString; +class QPoint; + +namespace KMail { + class Callback; + + namespace Interface { + + class BodyPart; + + /** + * @short An interface to body part reader link handlers + * @author Marc Mutz <mutz@kde.org> + * + * This interface is a condensed of variant of the more general + * @see URLHandler interface, designed to make bodypart-dependent + * link operations possible without exposing KMail-internal + * classes. + * + * Implementation-wise, these handlers are called as a nested + * Chain Of Responsibilty by an internal implementation of + * URLHandler. + * + * You can create a link whose handling is passed to this handler + * by using BodyPart::makeLink( const QString & path ). \a path is + * what * is passed back to the methods of this interface. + * + * Note that the BodyPart interface does not provide a means of + * learning the content type of the body part passed. This is + * intentional. It is expected that either separate + * BodyPartURLHandlers are created for these purposes or else the + * information encoded into the path parameter by the + * BodyPartFormatter. + */ + class BodyPartURLHandler { + public: + virtual ~BodyPartURLHandler() {} + + /** Called when LMB-clicking on a link in the reader. Should + start processing equivalent to "opening" the link. + + @return true if the click was handled by this handler, false + otherwise. + */ + virtual bool handleClick( BodyPart * part, const QString & path, Callback& c ) const = 0; + + /** Called when RMB-clicking on a link in the reader. Should + show a context menu at the specified point with the + specified widget as parent. + + @return true if the right-click was handled by this handler, + false otherwise. + */ + virtual bool handleContextMenuRequest( BodyPart * part, const QString & path, const QPoint & p ) const = 0; + + /** Called when hovering over a link. + + @return a string to be shown in the status bar while + hovering over this link or QString::null if the link was not + handled by this handler. + */ + virtual QString statusBarMessage( BodyPart * part, const QString & path ) const = 0; + }; + + } // namespace Interface + +} // namespace KMail + +#endif // __KMAIL_INTERFACES_BODYPARTURLHANDLER_H__ + diff --git a/kmail/interfaces/htmlwriter.h b/kmail/interfaces/htmlwriter.h new file mode 100644 index 000000000..3621038b0 --- /dev/null +++ b/kmail/interfaces/htmlwriter.h @@ -0,0 +1,120 @@ +/* -*- c++ -*- + interfaces/htmlwriter.h + + This file is part of KMail's plugin interface. + Copyright (c) 2003 Marc Mutz <mutz@kde.org> + + KMail 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. + + KMail 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KMAIL_INTERFACES_HTMLWRITER_H__ +#define __KMAIL_INTERFACES_HTMLWRITER_H__ + +class QCString; +class QString; + +namespace KMail { + + /** + * @short An interface for HTML sinks. + * @author Marc Mutz <mutz@kde.org> + * + */ + namespace Interface { + class HtmlWriter { + public: + virtual ~HtmlWriter() {} + + /** Signal the begin of stuff to write, and give the CSS definitions */ + virtual void begin( const QString & cssDefinitions ) = 0; + /** Write out a chunk of text. No HTML escaping is performed. */ + virtual void write( const QString & html ) = 0; + /** Signal the end of stuff to write. */ + virtual void end() = 0; + }; + } + + /** + * @short An interface to HTML sinks + * @author Marc Mutz <mutz@kde.org> + * + * @deprecated KMail should be ported to Interface::HtmlWriter. This + * interface exposes internal working models. The queueing + * vs. writing() issues exposed here should be hidden by using two + * different implementations of KHTMLPartHtmlWriter: one for + * queueing, and one for writing. This should be fixed before the + * release, so we an keep the plugin interface stable. + * + * Operate this interface in one and only one of the following two + * modes: + * + * @section Sync Mode + * + * In sync mode, use #begin() to initiate a session, then + * #write() some chunks of HTML code and finally #end() the session. + * + * @section Async Mode + * + * In async mode, use #begin() to initialize a session, then + * #queue() some chunks of HTML code and finally end the + * session by calling #flush(). + * + * Queued HTML code is fed to the html sink using a timer. For this + * to work, control must return to the event loop so timer events + * are delivered. + * + * @section Combined mode + * + * You may combine the two modes in the following way only. Any + * number of #write() calls can precede #queue() calls, + * but once a chunk has been queued, you @em must @em not + * #write() more data, only #queue() it. + * + * Naturally, whenever you queued data in a given session, that + * session must be ended by calling #flush(), not #end(). + */ + class HtmlWriter : public Interface::HtmlWriter { + public: + virtual ~HtmlWriter() {} + + /** Stop all possibly pending processing in order to be able to + call #begin() again. */ + virtual void reset() = 0; + + virtual void queue( const QString & str ) = 0; + /** (Start) flushing internal buffers, if any. */ + virtual void flush() = 0; + + /** + * Embed a part with Content-ID @p contentId, using url @p url. + */ + virtual void embedPart( const QCString & contentId, const QString & url ) = 0; + }; + +} // namespace KMail + +#endif // __KMAIL_INTERFACES_HTMLWRITER_H__ + diff --git a/kmail/interfaces/observable.h b/kmail/interfaces/observable.h new file mode 100644 index 000000000..184ee3189 --- /dev/null +++ b/kmail/interfaces/observable.h @@ -0,0 +1,57 @@ +/* -*- mode: C++; c-file-style: "gnu" -*- + observable.h + + This file is part of KMail's plugin interface. + Copyright (c) 2004 Marc Mutz <mutz@kde.org> + + KMail 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. + + KMail 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KMAIL_INTERFACES_OBSERVABLE_H__ +#define __KMAIL_INTERFACES_OBSERVABLE_H__ + +namespace KMail { + namespace Interface { + + class Observer; + + /** + @short observable interface + */ + class Observable { + public: + virtual ~Observable() {} + + virtual void attach( Observer * obs ) = 0; + virtual void detach( Observer * obs ) = 0; + virtual void notify() = 0; + }; + + } // namespace Interface + +} // namespace KMail + +#endif // __KMAIL_INTERFACES_OBSERVABLE_H__ diff --git a/kmail/interfaces/observer.h b/kmail/interfaces/observer.h new file mode 100644 index 000000000..5f1d9b887 --- /dev/null +++ b/kmail/interfaces/observer.h @@ -0,0 +1,55 @@ +/* -*- mode: C++; c-file-style: "gnu" -*- + observer.h + + This file is part of KMail's plugin interface. + Copyright (c) 2004 Marc Mutz <mutz@kde.org> + + KMail 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. + + KMail 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KMAIL_INTERFACES_OBSERVER_H__ +#define __KMAIL_INTERFACES_OBSERVER_H__ + +namespace KMail { + namespace Interface { + + class Observable; + + /** + @short observer interface + */ + class Observer { + public: + virtual ~Observer() {} + + virtual void update( Observable * obs ) = 0; + }; + + } // namespace Interface + +} // namespace KMail + +#endif // __KMAIL_INTERFACES_OBSERVER_H__ diff --git a/kmail/interfaces/rulewidgethandler.h b/kmail/interfaces/rulewidgethandler.h new file mode 100644 index 000000000..e8fdd802d --- /dev/null +++ b/kmail/interfaces/rulewidgethandler.h @@ -0,0 +1,81 @@ +/* -*- mode: C++; c-file-style: "gnu" -*- + interfaces/rulewidgethandler.h + + This file is part of KMail, the KDE mail client. + Copyright (c) 2004 Ingo Kloecker <kloecker@kde.org> + + KMail 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. + + KMail 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KMAIL_INTERFACES_RULEWIDGETHANDLER_H__ +#define __KMAIL_INTERFACES_RULEWIDGETHANDLER_H__ + +#include "../kmsearchpattern.h" + +class QWidget; +class QWidgetStack; +class QCString; +class QString; +class QObject; + +namespace KMail { + /** + * @short An interface to filter/search rule widget handlers + */ + class RuleWidgetHandler { + public: + virtual ~RuleWidgetHandler() {} + + virtual QWidget * createFunctionWidget( int number, + QWidgetStack *functionStack, + const QObject *receiver ) const = 0; + virtual QWidget * createValueWidget( int number, + QWidgetStack *valueStack, + const QObject *receiver ) const = 0; + virtual KMSearchRule::Function function( const QCString & field, + const QWidgetStack *functionStack ) const = 0; + virtual QString value( const QCString & field, + const QWidgetStack *functionStack, + const QWidgetStack *valueStack ) const = 0; + virtual QString prettyValue( const QCString & field, + const QWidgetStack *functionStack, + const QWidgetStack *valueStack ) const = 0; + virtual bool handlesField( const QCString & field ) const = 0; + virtual void reset( QWidgetStack *functionStack, + QWidgetStack *valueStack ) const = 0; + virtual bool setRule( QWidgetStack *functionStack, + QWidgetStack *valueStack, + const KMSearchRule *rule ) const = 0; + virtual bool update( const QCString & field, + QWidgetStack *functionStack, + QWidgetStack *valueStack ) const = 0; + + }; + +} // namespace KMail + +#endif // __KMAIL_INTERFACES_RULEWIDGETHANDLER_H__ + diff --git a/kmail/interfaces/urlhandler.h b/kmail/interfaces/urlhandler.h new file mode 100644 index 000000000..808f3196f --- /dev/null +++ b/kmail/interfaces/urlhandler.h @@ -0,0 +1,79 @@ +/* -*- c++ -*- + interfaces/urlhandler.h + + This file is part of KMail, the KDE mail client. + Copyright (c) 2003 Marc Mutz <mutz@kde.org> + + KMail is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + KMail 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KMAIL_INTERFACES_URLHANDLER_H__ +#define __KMAIL_INTERFACES_URLHANDLER_H__ + +class KURL; + +class QString; +class QPoint; +class KMReaderWin; + +namespace KMail { + /** + * @short An interface to reader link handlers + * @author Marc Mutz <mutz@kde.org> + * + * The KMReaderWin parameters are temporary until such time as + * the Memento-store is in place. + */ + class URLHandler { + public: + virtual ~URLHandler() {} + + /** Called when LMB-clicking on a link in the reader. Should start + processing equivalent to "opening" the link. + + @return true if the click was handled by this URLHandler, + false otherwise. + */ + virtual bool handleClick( const KURL & url, KMReaderWin * w ) const = 0; + /** Called when RMB-clicking on a link in the reader. Should show + a context menu at the specified point with the specified + widget as parent. + + @return true if the right-click was handled by this + URLHandler, false otherwise. + */ + virtual bool handleContextMenuRequest( const KURL & url, const QPoint & p, KMReaderWin * w ) const = 0; + /** Called when hovering over a link. + + @return a string to be shown in the status bar while hovering + over this link. + */ + virtual QString statusBarMessage( const KURL & url, KMReaderWin * w ) const = 0; + }; + +} // namespace KMail + +#endif // __KMAIL_INTERFACES_URLHANDLER_H__ + |