summaryrefslogtreecommitdiffstats
path: root/kexi/widget/tableview/kexiblobtableedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/widget/tableview/kexiblobtableedit.cpp')
-rw-r--r--kexi/widget/tableview/kexiblobtableedit.cpp224
1 files changed, 112 insertions, 112 deletions
diff --git a/kexi/widget/tableview/kexiblobtableedit.cpp b/kexi/widget/tableview/kexiblobtableedit.cpp
index db0799a4e..0d19981a1 100644
--- a/kexi/widget/tableview/kexiblobtableedit.cpp
+++ b/kexi/widget/tableview/kexiblobtableedit.cpp
@@ -22,20 +22,20 @@
#include <stdlib.h>
-#include <qdatastream.h>
-#include <qfile.h>
-#include <qpopupmenu.h>
-#include <qtextedit.h>
-#include <qlayout.h>
-#include <qstatusbar.h>
-#include <qlabel.h>
-#include <qpixmap.h>
-#include <qimage.h>
-#include <qpainter.h>
-#include <qtooltip.h>
-#include <qapplication.h>
-#include <qclipboard.h>
-#include <qbuffer.h>
+#include <tqdatastream.h>
+#include <tqfile.h>
+#include <tqpopupmenu.h>
+#include <tqtextedit.h>
+#include <tqlayout.h>
+#include <tqstatusbar.h>
+#include <tqlabel.h>
+#include <tqpixmap.h>
+#include <tqimage.h>
+#include <tqpainter.h>
+#include <tqtooltip.h>
+#include <tqapplication.h>
+#include <tqclipboard.h>
+#include <tqbuffer.h>
#include <kdebug.h>
#include <ktempfile.h>
@@ -70,9 +70,9 @@ public:
{
}
- QByteArray value;
+ TQByteArray value;
KexiDropDownButton *button;
- QSize totalSize;
+ TQSize totalSize;
KexiImageContextMenu *popup;
bool readOnly : 1; //!< cached for slotUpdateActionsAvailabilityRequested()
bool setValueInternalEnabled : 1; //!< used to disable KexiBlobTableEdit::setValueInternal()
@@ -80,17 +80,17 @@ public:
//======================================================
-KexiBlobTableEdit::KexiBlobTableEdit(KexiTableViewColumn &column, QWidget *parent)
- : KexiTableEdit(column, parent)
+KexiBlobTableEdit::KexiBlobTableEdit(KexiTableViewColumn &column, TQWidget *tqparent)
+ : KexiTableEdit(column, tqparent)
, d ( new Private() )
{
setName("KexiBlobTableEdit");
// m_proc = 0;
// m_content = 0;
m_hasFocusableWidget = false;
- d->button = new KexiDropDownButton( parentWidget() /*usually a viewport*/ );
+ d->button = new KexiDropDownButton( tqparentWidget() /*usually a viewport*/ );
d->button->hide();
- QToolTip::add(d->button, i18n("Click to show available actions for this cell"));
+ TQToolTip::add(d->button, i18n("Click to show available actions for this cell"));
d->popup = new KexiImageContextMenu(this);
d->popup->installEventFilter(this);
@@ -101,25 +101,25 @@ KexiBlobTableEdit::KexiBlobTableEdit(KexiTableViewColumn &column, QWidget *paren
d->button->setPopup( d->popup );
//force edit requested to start editing... (this will call slotUpdateActionsAvailabilityRequested())
- //connect(d->popup, SIGNAL(aboutToShow()), this, SIGNAL(editRequested()));
-
- connect(d->popup, SIGNAL(updateActionsAvailabilityRequested(bool&, bool&)),
- this, SLOT(slotUpdateActionsAvailabilityRequested(bool&, bool&)));
-
- connect(d->popup, SIGNAL(insertFromFileRequested(const KURL&)),
- this, SLOT(handleInsertFromFileAction(const KURL&)));
- connect(d->popup, SIGNAL(saveAsRequested(const QString&)),
- this, SLOT(handleSaveAsAction(const QString&)));
- connect(d->popup, SIGNAL(cutRequested()),
- this, SLOT(handleCutAction()));
- connect(d->popup, SIGNAL(copyRequested()),
- this, SLOT(handleCopyAction()));
- connect(d->popup, SIGNAL(pasteRequested()),
- this, SLOT(handlePasteAction()));
- connect(d->popup, SIGNAL(clearRequested()),
- this, SLOT(clear()));
- connect(d->popup, SIGNAL(showPropertiesRequested()),
- this, SLOT(handleShowPropertiesAction()));
+ //connect(d->popup, TQT_SIGNAL(aboutToShow()), this, TQT_SIGNAL(editRequested()));
+
+ connect(d->popup, TQT_SIGNAL(updateActionsAvailabilityRequested(bool&, bool&)),
+ this, TQT_SLOT(slotUpdateActionsAvailabilityRequested(bool&, bool&)));
+
+ connect(d->popup, TQT_SIGNAL(insertFromFileRequested(const KURL&)),
+ this, TQT_SLOT(handleInsertFromFileAction(const KURL&)));
+ connect(d->popup, TQT_SIGNAL(saveAsRequested(const TQString&)),
+ this, TQT_SLOT(handleSaveAsAction(const TQString&)));
+ connect(d->popup, TQT_SIGNAL(cutRequested()),
+ this, TQT_SLOT(handleCutAction()));
+ connect(d->popup, TQT_SIGNAL(copyRequested()),
+ this, TQT_SLOT(handleCopyAction()));
+ connect(d->popup, TQT_SIGNAL(pasteRequested()),
+ this, TQT_SLOT(handlePasteAction()));
+ connect(d->popup, TQT_SIGNAL(clearRequested()),
+ this, TQT_SLOT(clear()));
+ connect(d->popup, TQT_SIGNAL(showPropertiesRequested()),
+ this, TQT_SLOT(handleShowPropertiesAction()));
}
KexiBlobTableEdit::~KexiBlobTableEdit()
@@ -138,17 +138,17 @@ KexiBlobTableEdit::~KexiBlobTableEdit()
}
//! initializes this editor with \a add value
-void KexiBlobTableEdit::setValueInternal(const QVariant& add, bool removeOld)
+void KexiBlobTableEdit::setValueInternal(const TQVariant& add, bool removeOld)
{
if (!d->setValueInternalEnabled)
return;
if (removeOld)
d->value = add.toByteArray();
- else //do not add "m_origValue" to "add" as this is QByteArray
+ else //do not add "m_origValue" to "add" as this is TQByteArray
d->value = m_origValue.toByteArray();
#if 0 //todo?
- QByteArray val = m_origValue.toByteArray();
+ TQByteArray val = m_origValue.toByteArray();
kdDebug() << "KexiBlobTableEdit: Size of BLOB: " << val.size() << endl;
m_tempFile = new KTempFile();
m_tempFile->setAutoDelete(true);
@@ -161,7 +161,7 @@ void KexiBlobTableEdit::setValueInternal(const QVariant& add, bool removeOld)
KMimeMagicResult* mmr = KMimeMagic::self()->findFileType(m_tempFile->name());
kdDebug() << "KexiBlobTableEdit: Mimetype = " << mmr->mimeType() << endl;
- setViewWidget( new QWidget(this) );
+ setViewWidget( new TQWidget(this) );
#endif
}
@@ -178,7 +178,7 @@ bool KexiBlobTableEdit::valueIsEmpty()
return d->value.isEmpty();
}
-QVariant
+TQVariant
KexiBlobTableEdit::value()
{
return d->value;
@@ -188,23 +188,23 @@ KexiBlobTableEdit::value()
if(m_content && m_content->isModified())
{
- return QVariant(m_content->text());
+ return TQVariant(m_content->text());
}
- QByteArray value;
- QFile f( m_tempFile->name() );
+ TQByteArray value;
+ TQFile f( m_tempFile->name() );
f.open(IO_ReadOnly);
- QDataStream stream(&f);
+ TQDataStream stream(&f);
char* data = (char*) malloc(f.size());
value.resize(f.size());
stream.readRawBytes(data, f.size());
value.duplicate(data, f.size());
free(data);
kdDebug() << "KexiBlobTableEdit: Size of BLOB: " << value.size() << endl;
- return QVariant(value);
+ return TQVariant(value);
#endif
}
-void KexiBlobTableEdit::paintFocusBorders( QPainter *p, QVariant &, int x, int y, int w, int h )
+void KexiBlobTableEdit::paintFocusBorders( TQPainter *p, TQVariant &, int x, int y, int w, int h )
{
// d->currentEditorWidth = w;
if (!d->readOnly && w > d->button->width())
@@ -213,21 +213,21 @@ void KexiBlobTableEdit::paintFocusBorders( QPainter *p, QVariant &, int x, int y
}
void
-KexiBlobTableEdit::setupContents( QPainter *p, bool focused, const QVariant& val,
- QString &txt, int &align, int &x, int &y_offset, int &w, int &h )
+KexiBlobTableEdit::setupContents( TQPainter *p, bool focused, const TQVariant& val,
+ TQString &txt, int &align, int &x, int &y_offset, int &w, int &h )
{
Q_UNUSED(focused);
Q_UNUSED(txt);
Q_UNUSED(align);
//! @todo optimize: load to m_pixmap, downsize
- QPixmap pixmap;
+ TQPixmap pixmap;
x = 0;
w -= 1; //a place for border
h -= 1; //a place for border
- if (p && val.canCast(QVariant::ByteArray) && pixmap.loadFromData(val.toByteArray())) {
- KexiUtils::drawPixmap( *p, 0/*lineWidth*/, QRect(x, y_offset, w, h),
- pixmap, Qt::AlignCenter, true/*scaledContents*/, true/*keepAspectRatio*/);
+ if (p && val.canCast(TQVariant::ByteArray) && pixmap.loadFromData(val.toByteArray())) {
+ KexiUtils::drawPixmap( *p, 0/*lineWidth*/, TQRect(x, y_offset, w, h),
+ pixmap, TQt::AlignCenter, true/*scaledContents*/, true/*keepAspectRatio*/);
}
}
@@ -246,15 +246,15 @@ void KexiBlobTableEdit::handleInsertFromFileAction(const KURL& url)
if (isReadOnly())
return;
- QString fileName( url.isLocalFile() ? url.path() : url.prettyURL() );
+ TQString fileName( url.isLocalFile() ? url.path() : url.prettyURL() );
//! @todo download the file if remote, then set fileName properly
- QFile f(fileName);
+ TQFile f(fileName);
if (!f.open(IO_ReadOnly)) {
//! @todo err msg
return;
}
- QByteArray ba = f.readAll();
+ TQByteArray ba = f.readAll();
if (f.status()!=IO_Ok) {
//! @todo err msg
f.close();
@@ -267,7 +267,7 @@ void KexiBlobTableEdit::handleInsertFromFileAction(const KURL& url)
//emit acceptRequested();
}
-void KexiBlobTableEdit::handleAboutToSaveAsAction(QString& origFilename, QString& fileExtension, bool& dataIsEmpty)
+void KexiBlobTableEdit::handleAboutToSaveAsAction(TQString& origFilename, TQString& fileExtension, bool& dataIsEmpty)
{
Q_UNUSED(origFilename);
Q_UNUSED(fileExtension);
@@ -275,9 +275,9 @@ void KexiBlobTableEdit::handleAboutToSaveAsAction(QString& origFilename, QString
//! @todo no fname stored for now
}
-void KexiBlobTableEdit::handleSaveAsAction(const QString& fileName)
+void KexiBlobTableEdit::handleSaveAsAction(const TQString& fileName)
{
- QFile f(fileName);
+ TQFile f(fileName);
if (!f.open(IO_WriteOnly)) {
//! @todo err msg
return;
@@ -304,39 +304,39 @@ void KexiBlobTableEdit::handleCopyAction()
executeCopyAction(d->value);
}
-void KexiBlobTableEdit::executeCopyAction(const QByteArray& data)
+void KexiBlobTableEdit::executeCopyAction(const TQByteArray& data)
{
- QPixmap pixmap;
+ TQPixmap pixmap;
if (!pixmap.loadFromData(data))
return;
- qApp->clipboard()->setPixmap(pixmap, QClipboard::Clipboard);
+ tqApp->tqclipboard()->setPixmap(pixmap, TQClipboard::Clipboard);
}
void KexiBlobTableEdit::handlePasteAction()
{
if (isReadOnly())
return;
- QPixmap pm( qApp->clipboard()->pixmap(QClipboard::Clipboard) );
- QByteArray ba;
- QBuffer buffer( ba );
+ TQPixmap pm( tqApp->tqclipboard()->pixmap(TQClipboard::Clipboard) );
+ TQByteArray ba;
+ TQBuffer buffer( ba );
buffer.open( IO_WriteOnly );
if (pm.save( &buffer, "PNG" )) {// write pixmap into ba in PNG format
setValueInternal( ba, true );
}
else {
- setValueInternal( QByteArray(), true );
+ setValueInternal( TQByteArray(), true );
}
signalEditRequested();
//emit acceptRequested();
- repaintRelatedCell();
+ tqrepaintRelatedCell();
}
void KexiBlobTableEdit::clear()
{
- setValueInternal( QByteArray(), true );
+ setValueInternal( TQByteArray(), true );
signalEditRequested();
//emit acceptRequested();
- repaintRelatedCell();
+ tqrepaintRelatedCell();
}
void KexiBlobTableEdit::handleShowPropertiesAction()
@@ -344,7 +344,7 @@ void KexiBlobTableEdit::handleShowPropertiesAction()
//! @todo
}
-void KexiBlobTableEdit::showFocus( const QRect& r, bool readOnly )
+void KexiBlobTableEdit::showFocus( const TQRect& r, bool readOnly )
{
d->readOnly = readOnly; //cache for slotUpdateActionsAvailabilityRequested()
// d->button->move( pos().x()+ width(), pos().y() );
@@ -358,13 +358,13 @@ void KexiBlobTableEdit::showFocus( const QRect& r, bool readOnly )
void KexiBlobTableEdit::resize(int w, int h)
{
- d->totalSize = QSize(w,h);
+ d->totalSize = TQSize(w,h);
const int addWidth = d->readOnly ? 0 : d->button->width();
- QWidget::resize(w - addWidth, h);
+ TQWidget::resize(w - addWidth, h);
if (!d->readOnly)
d->button->resize( h, h );
m_rightMarginWhenFocused = m_rightMargin + addWidth;
- QRect r( pos().x(), pos().y(), w+1, h+1 );
+ TQRect r( pos().x(), pos().y(), w+1, h+1 );
r.moveBy(m_scrollView->contentsX(),m_scrollView->contentsY());
updateFocus( r );
//todo if (d->popup) {
@@ -372,7 +372,7 @@ void KexiBlobTableEdit::resize(int w, int h)
//todo }
}
-void KexiBlobTableEdit::updateFocus( const QRect& r )
+void KexiBlobTableEdit::updateFocus( const TQRect& r )
{
if (!d->readOnly) {
if (d->button->width() > r.width())
@@ -387,7 +387,7 @@ void KexiBlobTableEdit::hideFocus()
d->button->hide();
}
-QSize KexiBlobTableEdit::totalSize() const
+TQSize KexiBlobTableEdit::totalSize() const
{
return d->totalSize;
}
@@ -406,20 +406,20 @@ void KexiBlobTableEdit::signalEditRequested()
d->setValueInternalEnabled = true;
}
-bool KexiBlobTableEdit::handleKeyPress( QKeyEvent* ke, bool editorActive )
+bool KexiBlobTableEdit::handleKeyPress( TQKeyEvent* ke, bool editorActive )
{
Q_UNUSED(editorActive);
const int k = ke->key();
KKey kkey(ke);
if (!d->readOnly) {
- if ((ke->state()==Qt::NoButton && k==Qt::Key_F4)
- || (ke->state()==Qt::AltButton && k==Qt::Key_Down)) {
+ if ((ke->state()==Qt::NoButton && k==TQt::Key_F4)
+ || (ke->state()==TQt::AltButton && k==TQt::Key_Down)) {
d->button->animateClick();
- QMouseEvent me( QEvent::MouseButtonPress, QPoint(2,2), Qt::LeftButton, Qt::NoButton );
- QApplication::sendEvent( d->button, &me );
+ TQMouseEvent me( TQEvent::MouseButtonPress, TQPoint(2,2), Qt::LeftButton, Qt::NoButton );
+ TQApplication::sendEvent( d->button, &me );
}
- else if ((ke->state()==NoButton && (k==Qt::Key_F2 || k==Qt::Key_Space || k==Qt::Key_Enter || k==Qt::Key_Return))) {
+ else if ((ke->state()==Qt::NoButton && (k==TQt::Key_F2 || k==TQt::Key_Space || k==TQt::Key_Enter || k==TQt::Key_Return))) {
d->popup->insertFromFile();
}
else
@@ -436,13 +436,13 @@ bool KexiBlobTableEdit::handleDoubleClick()
return true;
}
-void KexiBlobTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue)
+void KexiBlobTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue)
{
Q_UNUSED(visibleValue);
executeCopyAction(value.toByteArray());
}
-void KexiBlobTableEdit::handleAction(const QString& actionName)
+void KexiBlobTableEdit::handleAction(const TQString& actionName)
{
if (actionName=="edit_paste") {
d->popup->paste();
@@ -453,18 +453,18 @@ void KexiBlobTableEdit::handleAction(const QString& actionName)
}
}
-bool KexiBlobTableEdit::eventFilter( QObject *o, QEvent *e )
+bool KexiBlobTableEdit::eventFilter( TQObject *o, TQEvent *e )
{
- if (o == d->popup && e->type()==QEvent::KeyPress) {
- QKeyEvent* ke = static_cast<QKeyEvent*>(e);
+ if (TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(d->popup) && e->type()==TQEvent::KeyPress) {
+ TQKeyEvent* ke = TQT_TQKEYEVENT(e);
const int state = ke->state();
const int k = ke->key();
- if ( (state==Qt::NoButton && (k==Qt::Key_Tab || k==Qt::Key_Left || k==Qt::Key_Right))
- || (state==Qt::ShiftButton && k==Qt::Key_Backtab)
+ if ( (state==Qt::NoButton && (k==TQt::Key_Tab || k==TQt::Key_Left || k==TQt::Key_Right))
+ || (state==TQt::ShiftButton && k==TQt::Key_Backtab)
)
{
d->popup->hide();
- QApplication::sendEvent( this, ke ); //re-send to move cursor
+ TQApplication::sendEvent( this, ke ); //re-send to move cursor
return true;
}
}
@@ -485,13 +485,13 @@ public:
{
}
//! We've no editor widget that would store current value, so we do this here
- QVariant currentValue;
+ TQVariant currentValue;
- QCache<QPixmap> pixmapCache;
+ TQCache<TQPixmap> pixmapCache;
};
-KexiKIconTableEdit::KexiKIconTableEdit(KexiTableViewColumn &column, QWidget *parent)
- : KexiTableEdit(column, parent)
+KexiKIconTableEdit::KexiKIconTableEdit(KexiTableViewColumn &column, TQWidget *tqparent)
+ : KexiTableEdit(column, tqparent)
, d( new Private() )
{
setName("KexiKIconTableEdit");
@@ -509,7 +509,7 @@ void KexiKIconTableEdit::init()
d->pixmapCache.setAutoDelete(true);
}
-void KexiKIconTableEdit::setValueInternal(const QVariant& /*add*/, bool /*removeOld*/)
+void KexiKIconTableEdit::setValueInternal(const TQVariant& /*add*/, bool /*removeOld*/)
{
d->currentValue = m_origValue;
}
@@ -524,14 +524,14 @@ bool KexiKIconTableEdit::valueIsEmpty()
return d->currentValue.isNull();
}
-QVariant KexiKIconTableEdit::value()
+TQVariant KexiKIconTableEdit::value()
{
return d->currentValue;
}
void KexiKIconTableEdit::clear()
{
- d->currentValue = QVariant();
+ d->currentValue = TQVariant();
}
bool KexiKIconTableEdit::cursorAtStart()
@@ -544,22 +544,22 @@ bool KexiKIconTableEdit::cursorAtEnd()
return true;
}
-void KexiKIconTableEdit::setupContents( QPainter *p, bool /*focused*/, const QVariant& val,
- QString &/*txt*/, int &/*align*/, int &/*x*/, int &y_offset, int &w, int &h )
+void KexiKIconTableEdit::setupContents( TQPainter *p, bool /*focused*/, const TQVariant& val,
+ TQString &/*txt*/, int &/*align*/, int &/*x*/, int &y_offset, int &w, int &h )
{
Q_UNUSED( y_offset );
#if 0
-#ifdef Q_WS_WIN
+#ifdef TQ_WS_WIN
y_offset = -1;
#else
y_offset = 0;
#endif
- int s = QMAX(h - 5, 12);
- s = QMIN( h-3, s );
- s = QMIN( w-3, s );//avoid too large box
- QRect r( QMAX( w/2 - s/2, 0 ) , h/2 - s/2 /*- 1*/, s, s);
- p->setPen(QPen(colorGroup().text(), 1));
+ int s = TQMAX(h - 5, 12);
+ s = TQMIN( h-3, s );
+ s = TQMIN( w-3, s );//avoid too large box
+ TQRect r( TQMAX( w/2 - s/2, 0 ) , h/2 - s/2 /*- 1*/, s, s);
+ p->setPen(TQPen(tqcolorGroup().text(), 1));
p->drawRect(r);
if (val.asBool()) {
p->drawLine(r.x(), r.y(), r.right(), r.bottom());
@@ -567,14 +567,14 @@ void KexiKIconTableEdit::setupContents( QPainter *p, bool /*focused*/, const QVa
}
#endif
- QString key = val.toString();
- QPixmap *pix = 0;
+ TQString key = val.toString();
+ TQPixmap *pix = 0;
if (!key.isEmpty() && !(pix = d->pixmapCache[ key ])) {
//cache pixmap
- QPixmap pm = KGlobal::iconLoader()->loadIcon( key, KIcon::Small,
+ TQPixmap pm = KGlobal::iconLoader()->loadIcon( key, KIcon::Small,
0, KIcon::DefaultState, 0L, true/*canReturnNull*/ );
if (!pm.isNull()) {
- pix = new QPixmap(pm);
+ pix = new TQPixmap(pm);
d->pixmapCache.insert(key, pix);
}
}
@@ -584,7 +584,7 @@ void KexiKIconTableEdit::setupContents( QPainter *p, bool /*focused*/, const QVa
}
}
-void KexiKIconTableEdit::handleCopyAction(const QVariant& value, const QVariant& visibleValue)
+void KexiKIconTableEdit::handleCopyAction(const TQVariant& value, const TQVariant& visibleValue)
{
Q_UNUSED(value);
Q_UNUSED(visibleValue);