kexi

kexiblobtableedit.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 Peter Simonsson <psn@linux.se>
00003    Copyright (C) 2004, 2006 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this program; see the file COPYING.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef _KEXIBLOBTABLEEDIT_H_
00022 #define _KEXIBLOBTABLEEDIT_H_
00023 
00024 #include <qcstring.h>
00025 #include <qcache.h>
00026 
00027 #include <kurl.h>
00028 
00029 #include "kexitableedit.h"
00030 #include "kexicelleditorfactory.h"
00031 
00032 class KTempFile;
00033 class KProcess;
00034 class QTextEdit;
00035 
00036 class KexiBlobTableEdit : public KexiTableEdit
00037 {
00038     Q_OBJECT
00039     public:
00040         KexiBlobTableEdit(KexiTableViewColumn &column, QWidget *parent=0);
00041         virtual ~KexiBlobTableEdit();
00042 
00043         bool valueIsNull();
00044         bool valueIsEmpty();
00045 
00046         virtual QVariant value();
00047 
00048         virtual bool cursorAtStart();
00049         virtual bool cursorAtEnd();
00050 
00052         virtual void resize(int w, int h);
00053 
00054         virtual void showFocus( const QRect& r, bool readOnly );
00055 
00056         virtual void hideFocus();
00057 
00059         virtual QSize totalSize() const;
00060 
00061         virtual void paintFocusBorders( QPainter *p, QVariant &, int x, int y, int w, int h );
00062 
00064         virtual bool handleKeyPress( QKeyEvent* ke, bool editorActive );
00065 
00069         virtual bool handleDoubleClick();
00070 
00073         virtual void handleAction(const QString& actionName);
00074 
00078         virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue);
00079 
00080         virtual void setupContents( QPainter *p, bool focused, const QVariant& val, 
00081             QString &txt, int &align, int &x, int &y_offset, int &w, int &h );
00082 
00083     protected slots:
00084         void slotUpdateActionsAvailabilityRequested(bool& valueIsNull, bool& valueIsReadOnly);
00085 
00086         void handleInsertFromFileAction(const KURL& url);
00087         void handleAboutToSaveAsAction(QString& origFilename, QString& fileExtension, bool& dataIsEmpty);
00088         void handleSaveAsAction(const QString& fileName);
00089         void handleCutAction();
00090         void handleCopyAction();
00091         void handlePasteAction();
00092         virtual void clear();
00093         void handleShowPropertiesAction();
00094 
00095     protected:
00097         virtual void setValueInternal(const QVariant& add, bool removeOld);
00098 
00099         //todo QString openWithDlg(const QString& file);
00100         //todo void execute(const QString& app, const QString& file);
00101 
00103         void updateFocus( const QRect& r );
00104 
00105         void signalEditRequested();
00106 
00108         void executeCopyAction(const QByteArray& data);
00109 
00110         virtual bool eventFilter( QObject *o, QEvent *e );
00111 
00112         class Private;
00113         Private *d;
00114 //todo      KTempFile* m_tempFile;
00115 //todo      KProcess* m_proc;
00116 //todo      QTextEdit *m_content;
00117 };
00118 
00119 KEXI_DECLARE_CELLEDITOR_FACTORY_ITEM(KexiBlobEditorFactoryItem)
00120 
00121 
00122 //=======================
00123 //This class is temporarily here:
00124 
00125 
00128 class KexiKIconTableEdit : public KexiTableEdit
00129 {
00130     public:
00131         KexiKIconTableEdit(KexiTableViewColumn &column, QWidget *parent=0);
00132 
00133         virtual ~KexiKIconTableEdit();
00134 
00136         virtual bool valueIsNull();
00137 
00141         virtual bool valueIsEmpty();
00142 
00143         virtual QVariant value();
00144 
00145         virtual bool cursorAtStart();
00146         virtual bool cursorAtEnd();
00147 
00148         virtual void clear();
00149 
00150         virtual void setupContents( QPainter *p, bool focused, const QVariant& val, 
00151             QString &txt, int &align, int &x, int &y_offset, int &w, int &h );
00152 
00155         virtual void handleCopyAction(const QVariant& value, const QVariant& visibleValue);
00156 
00157     protected:
00159         virtual void setValueInternal(const QVariant& add, bool removeOld);
00160 
00161         void showHintButton();
00162         void init();
00163 
00164         class Private;
00165         Private *d;
00166 };
00167 
00168 KEXI_DECLARE_CELLEDITOR_FACTORY_ITEM(KexiKIconTableEditorFactoryItem)
00169 
00170 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys