diff options
Diffstat (limited to 'kbarcode/labeleditor.cpp')
-rw-r--r-- | kbarcode/labeleditor.cpp | 337 |
1 files changed, 165 insertions, 172 deletions
diff --git a/kbarcode/labeleditor.cpp b/kbarcode/labeleditor.cpp index 144d9a1..4cbab7c 100644 --- a/kbarcode/labeleditor.cpp +++ b/kbarcode/labeleditor.cpp @@ -51,33 +51,30 @@ //NY34 // QT includes -#include <qbuffer.h> -#include <qcanvas.h> -#include <qcheckbox.h> -#include <qclipboard.h> -#include <qdockarea.h> -#include <qdom.h> -#include <qdragobject.h> -#include <qgroupbox.h> -#include <qimage.h> -#include <qinputdialog.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qmap.h> -#include <qmime.h> -#include <qpainter.h> -#include <qpaintdevicemetrics.h> -#include <qpicture.h> -#include <qpoint.h> -#include <qprogressdialog.h> -#include <qsqlquery.h> -#include <qtextbrowser.h> -#include <qtooltip.h> -#include <qvalidator.h> -#include <qxml.h> -#if QT_VERSION <= 0x030100 - #include <qregexp.h> -#endif +#include <tqbuffer.h> +#include <tqcanvas.h> +#include <tqcheckbox.h> +#include <tqclipboard.h> +#include <tqdockarea.h> +#include <tqdom.h> +#include <tqdragobject.h> +#include <tqgroupbox.h> +#include <tqimage.h> +#include <tqinputdialog.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqmap.h> +#include <tqmime.h> +#include <tqpainter.h> +#include <tqpaintdevicemetrics.h> +#include <tqpicture.h> +#include <tqpoint.h> +#include <tqprogressdialog.h> +#include <tqsqlquery.h> +#include <tqtextbrowser.h> +#include <tqtooltip.h> +#include <tqvalidator.h> +#include <tqxml.h> // KDE includes #include <kabc/stdaddressbook.h> @@ -124,17 +121,17 @@ using namespace KABC; -LabelEditor::LabelEditor( QWidget *parent, QString _filename, const char *name, WFlags f ) +LabelEditor::LabelEditor( TQWidget *tqparent, TQString _filename, const char *name, WFlags f ) : DCOPObject( "LabelEditor" ), - DSMainWindow( parent, name, f ) + DSMainWindow( tqparent, name, f ) { undoAct = redoAct = NULL; history = NULL; - description = QString::null; + description = TQString(); d = new Definition(); - m_token = new TokenProvider( KApplication::desktop() ); + m_token = new TokenProvider( TQT_TQPAINTDEVICE(KApplication::desktop()) ); statusBar()->insertItem( "", STATUS_ID_TEMPLATE, 0, true ); statusBar()->insertItem( "", STATUS_ID_SIZE, 0, true ); @@ -142,7 +139,7 @@ LabelEditor::LabelEditor( QWidget *parent, QString _filename, const char *name, statusBar()->setSizeGripEnabled( true ); statusBar()->show(); - c = new MyCanvas( this ); + c = new MyCanvas( TQT_TQOBJECT(this) ); c->setDoubleBuffering( true ); c->setUpdatePeriod( CANVAS_UPDATE_PERIOD ); @@ -152,7 +149,7 @@ LabelEditor::LabelEditor( QWidget *parent, QString _filename, const char *name, setupActions(); setupContextMenu(); - setAutoSaveSettings( QString("Window") + name, true ); + setAutoSaveSettings( TQString("Window") + name, true ); clearLabel(); @@ -160,16 +157,16 @@ LabelEditor::LabelEditor( QWidget *parent, QString _filename, const char *name, show(); // if( isFirstStart() ) -// moveDockWindow( tools, Qt::DockLeft ); +// moveDockWindow( tools, TQt::DockLeft ); - connect( cv, SIGNAL( doubleClickedItem(TCanvasItem*) ), this, SLOT( doubleClickedItem(TCanvasItem*) ) ); - connect( cv, SIGNAL( showContextMenu(QPoint) ), this, SLOT( showContextMenu(QPoint) ) ); - connect( cv, SIGNAL( movedSomething() ), this, SLOT( setEdited() ) ); - connect( KBarcodeSettings::getInstance(), SIGNAL( updateGrid( int ) ), cv, SLOT( updateGUI() ) ); - connect( kapp, SIGNAL( aboutToQuit() ), this, SLOT( saveConfig() ) ); + connect( cv, TQT_SIGNAL( doubleClickedItem(TCanvasItem*) ), TQT_TQOBJECT(this), TQT_SLOT( doubleClickedItem(TCanvasItem*) ) ); + connect( cv, TQT_SIGNAL( showContextMenu(TQPoint) ), TQT_TQOBJECT(this), TQT_SLOT( showContextMenu(TQPoint) ) ); + connect( cv, TQT_SIGNAL( movedSomething() ), TQT_TQOBJECT(this), TQT_SLOT( setEdited() ) ); + connect( KBarcodeSettings::getInstance(), TQT_SIGNAL( updateGrid( int ) ), cv, TQT_SLOT( updateGUI() ) ); + connect( kapp, TQT_SIGNAL( aboutToQuit() ), TQT_TQOBJECT(this), TQT_SLOT( saveConfig() ) ); - connect( history, SIGNAL( commandExecuted() ), cv, SLOT( updateGUI() ) ); - connect( history, SIGNAL( commandExecuted() ), this, SLOT( setEdited() ) ); + connect( history, TQT_SIGNAL( commandExecuted() ), cv, TQT_SLOT( updateGUI() ) ); + connect( history, TQT_SIGNAL( commandExecuted() ), TQT_TQOBJECT(this), TQT_SLOT( setEdited() ) ); if( !_filename.isEmpty() ) openUrl( _filename ); @@ -242,20 +239,20 @@ void LabelEditor::createCommandHistoryActions() void LabelEditor::clearLabel() { TCanvasItem* citem; - QCanvasItemList::Iterator it; + TQCanvasItemList::Iterator it; - description = QString::null; + description = TQString(); delete history; createCommandHistory(); createCommandHistoryActions(); - connect( history, SIGNAL( commandExecuted() ), cv, SLOT( updateGUI() ) ); - connect( history, SIGNAL( commandExecuted() ), this, SLOT( setEdited() ) ); + connect( history, TQT_SIGNAL( commandExecuted() ), cv, TQT_SLOT( updateGUI() ) ); + connect( history, TQT_SIGNAL( commandExecuted() ), TQT_TQOBJECT(this), TQT_SLOT( setEdited() ) ); m_edited = false; - QCanvasItemList list = c->allItems(); + TQCanvasItemList list = c->allItems(); it = list.begin(); for (; it != list.end(); ++it) { @@ -265,7 +262,7 @@ void LabelEditor::clearLabel() updateInfo(); c->update(); - cv->repaintContents(); + cv->tqrepaintContents(); } bool LabelEditor::save() @@ -287,7 +284,7 @@ bool LabelEditor::save() bool LabelEditor::saveas() { - QString name = KFileDialog::getSaveFileName ( NULL, "*.kbarcode", this ); + TQString name = KFileDialog::getSaveFileName ( NULL, "*.kbarcode", this ); if(name.isEmpty()) return false; @@ -297,18 +294,18 @@ bool LabelEditor::saveas() return save( name ); } -bool LabelEditor::save( QString name ) +bool LabelEditor::save( TQString name ) { - if( QFile::exists( name ) ) - QFile::remove( name ); + if( TQFile::exists( name ) ) + TQFile::remove( name ); - QFile f( name ); + TQFile f( name ); if ( !f.open( IO_WriteOnly ) ) return false; - save( &f ); + save( TQT_TQIODEVICE(&f) ); - m_token->setLabelName( filename.right( filename.length() - filename.findRev( "/" ) - 1 ) ); + m_token->setLabelName( filename.right( filename.length() - filename.tqfindRev( "/" ) - 1 ) ); // maybe we should redraw all items on the canvas now. // if there is a label with [filename], the filename might not // get updated if the label gets saved with another filename. @@ -323,16 +320,16 @@ bool LabelEditor::save( QString name ) return true; } -void LabelEditor::save( QIODevice* device ) +void LabelEditor::save( TQIODevice* device ) { - QDomDocument doc( "KBarcodeLabel" ); - QDomElement root = doc.createElement( "kbarcode" ); + TQDomDocument doc( "KBarcodeLabel" ); + TQDomElement root = doc.createElement( "kbarcode" ); doc.appendChild( root ); writeXMLHeader( &root, description, d ); - QCanvasItemList list = c->allItems(); + TQCanvasItemList list = c->allItems(); for( unsigned int i = 0; i < list.count(); i++ ) { TCanvasItem* item = static_cast<TCanvasItem*>(list[i]); @@ -341,20 +338,20 @@ void LabelEditor::save( QIODevice* device ) writeXMLDocumentItem( &root, &ditem ); } - QCString xml = doc.toCString(); + TQCString xml = doc.toCString(); device->writeBlock( xml, xml.length() ); device->close(); } bool LabelEditor::open() { - QString name = KFileDialog::getOpenFileName ( NULL, "*.kbarcode", this, i18n("Select Label") ); + TQString name = KFileDialog::getOpenFileName ( NULL, "*.kbarcode", this, i18n("Select Label") ); if(name.isEmpty()) return false; return openUrl( name ); } -bool LabelEditor::openUrl( const QString & url ) +bool LabelEditor::openUrl( const TQString & url ) { if( url.isEmpty() ) { return open(); @@ -362,15 +359,15 @@ bool LabelEditor::openUrl( const QString & url ) filename = url; setCaption( filename, false ); - m_token->setLabelName( filename.right( filename.length() - filename.findRev( "/" ) - 1 ) ); + m_token->setLabelName( filename.right( filename.length() - filename.tqfindRev( "/" ) - 1 ) ); - QFile f( filename ); + TQFile f( filename ); if ( !f.open( IO_ReadOnly ) ) return false; clearLabel(); - QDomDocument doc( "KBarcodeLabel" ); + TQDomDocument doc( "KBarcodeLabel" ); if ( !doc.setContent( &f ) ) { f.close(); return false; @@ -385,7 +382,7 @@ bool LabelEditor::openUrl( const QString & url ) if( !d || d->getId() == -1 ) { - KMessageBox::error( this, QString( i18n("<qt>The file <b>%1</b> cannot be loaded as the label definition is missing.</qt>") ).arg( filename ) ); + KMessageBox::error( this, TQString( i18n("<qt>The file <b>%1</b> cannot be loaded as the label definition is missing.</qt>") ).tqarg( filename ) ); return false; } @@ -406,7 +403,7 @@ bool LabelEditor::openUrl( const QString & url ) recentAct->addURL( murl ); enableActions(); - cv->repaintContents( true ); + cv->tqrepaintContents( true ); return true; } @@ -414,7 +411,7 @@ bool LabelEditor::openUrl( const QString & url ) bool LabelEditor::newLabel() { NewLabel* nl = new NewLabel( this ); - if( nl->exec() != QDialog::Accepted ) { + if( nl->exec() != TQDialog::Accepted ) { delete nl; return false; } @@ -430,8 +427,8 @@ bool LabelEditor::newLabel() delete nl; - filename = QString::null; - m_token->setLabelName( filename.right( filename.length() - filename.findRev( "/" ) - 1 ) ); + filename = TQString(); + m_token->setLabelName( filename.right( filename.length() - filename.tqfindRev( "/" ) - 1 ) ); setCaption( filename, false ); enableActions(); @@ -440,47 +437,47 @@ bool LabelEditor::newLabel() void LabelEditor::setupActions() { - KAction* newAct = KStdAction::openNew( this, SLOT(startEditor()), actionCollection() ); - KAction* loadAct = KStdAction::open( this, SLOT(startLoadEditor()), actionCollection() ); - KAction* quitAct = KStdAction::quit(kapp, SLOT(quit()), actionCollection()); - KAction* closeAct = KStdAction::close( this, SLOT( close() ), actionCollection(), "close" ); - closeLabelAct = new KAction( i18n("Close &Label" ), 0, 0, this, SLOT( closeLabel() ), actionCollection() ); - - recentAct = new KRecentFilesAction( i18n("&Recent Files"), 0, this, SLOT( loadRecentEditor( const KURL& ) ) ); - - KAction* importPrintFileAct = new KAction( i18n("&Import and Print Batch File..."), BarIconSet( "fileprint" ), 0, this, SLOT( batchPrint() ), actionCollection() ); - - saveAct = KStdAction::save( this, SLOT( save() ), actionCollection(), "save" ); - saveAsAct = KStdAction::saveAs( this, SLOT( saveas() ), actionCollection(), "saveas" ); - descriptionAct = new KAction( i18n("&Change description..."), 0, 0, this, SLOT(changeDes()), actionCollection() ); - deleteAct = new KAction( i18n("&Delete Object"), QIconSet( BarIcon("editdelete") ), Key_Delete, cv, SLOT( deleteCurrent() ), actionCollection() ); - editPropAct = new KAction( i18n("&Properties..."), 0, 0, this, SLOT( doubleClickedCurrent() ), actionCollection() ); - printAct = KStdAction::print( this, SLOT( print() ), actionCollection(), "print" ); - bcpAct = new KAction( i18n("Print to &Barcode Printer..."), 0, 0, this, SLOT( printBCP() ), actionCollection() ); - imgAct = new KAction( i18n("Print to &Image..."), 0, 0, this, SLOT(printImage() ), actionCollection() ); - changeSizeAct = new KAction( i18n("&Change Label..."), 0, 0, this, SLOT( changeSize() ), actionCollection() ); - barcodeAct = new KAction( i18n("Insert &Barcode"), QIconSet( BarIcon("barcode") ), 0, this, SLOT( insertBarcode() ), actionCollection() ); + KAction* newAct = KStdAction::openNew( TQT_TQOBJECT(this), TQT_SLOT(startEditor()), actionCollection() ); + KAction* loadAct = KStdAction::open( TQT_TQOBJECT(this), TQT_SLOT(startLoadEditor()), actionCollection() ); + KAction* quitAct = KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), actionCollection()); + KAction* closeAct = KStdAction::close( TQT_TQOBJECT(this), TQT_SLOT( close() ), actionCollection(), "close" ); + closeLabelAct = new KAction( i18n("Close &Label" ), 0, 0, TQT_TQOBJECT(this), TQT_SLOT( closeLabel() ), actionCollection() ); + + recentAct = new KRecentFilesAction( i18n("&Recent Files"), 0, TQT_TQOBJECT(this), TQT_SLOT( loadRecentEditor( const KURL& ) ) ); + + KAction* importPrintFileAct = new KAction( i18n("&Import and Print Batch File..."), BarIconSet( "fileprint" ), 0, TQT_TQOBJECT(this), TQT_SLOT( batchPrint() ), actionCollection() ); + + saveAct = KStdAction::save( TQT_TQOBJECT(this), TQT_SLOT( save() ), actionCollection(), "save" ); + saveAsAct = KStdAction::saveAs( TQT_TQOBJECT(this), TQT_SLOT( saveas() ), actionCollection(), "saveas" ); + descriptionAct = new KAction( i18n("&Change description..."), 0, 0, TQT_TQOBJECT(this), TQT_SLOT(changeDes()), actionCollection() ); + deleteAct = new KAction( i18n("&Delete Object"), TQIconSet( BarIcon("editdelete") ), Key_Delete, TQT_TQOBJECT(cv), TQT_SLOT( deleteCurrent() ), actionCollection() ); + editPropAct = new KAction( i18n("&Properties..."), 0, 0, TQT_TQOBJECT(this), TQT_SLOT( doubleClickedCurrent() ), actionCollection() ); + printAct = KStdAction::print( TQT_TQOBJECT(this), TQT_SLOT( print() ), actionCollection(), "print" ); + bcpAct = new KAction( i18n("Print to &Barcode Printer..."), 0, 0, TQT_TQOBJECT(this), TQT_SLOT( printBCP() ), actionCollection() ); + imgAct = new KAction( i18n("Print to &Image..."), 0, 0, TQT_TQOBJECT(this), TQT_SLOT(printImage() ), actionCollection() ); + changeSizeAct = new KAction( i18n("&Change Label..."), 0, 0, TQT_TQOBJECT(this), TQT_SLOT( changeSize() ), actionCollection() ); + barcodeAct = new KAction( i18n("Insert &Barcode"), TQIconSet( BarIcon("barcode") ), 0, TQT_TQOBJECT(this), TQT_SLOT( insertBarcode() ), actionCollection() ); barcodeAct->setEnabled( Barkode::haveBarcode() ); - pictureAct = new KAction( i18n("Insert &Picture"), QIconSet( BarIcon("inline_image") ), 0, this, SLOT( insertPicture() ), actionCollection() ); - textAct = new KAction( i18n("Insert &Text"), QIconSet( BarIcon("text") ), 0, this, SLOT( insertText() ), actionCollection() ); - textDataAct = new KAction( i18n("Insert &Data Field"), QIconSet( BarIcon("contents") ), 0, this, SLOT( insertDataText() ), actionCollection() ); - textLineAct = new KAction( i18n("Insert &Text Line"), QIconSet( BarIcon("text") ), 0, this, SLOT( insertTextLine() ), actionCollection() ); - lineAct = new KAction( i18n("Insert &Line"), QIconSet( BarIcon("kbarcodelinetool") ), 0, this, SLOT( insertLine() ), actionCollection() ); - rectAct = new KAction( i18n("Insert &Rectangle"), QIconSet( BarIcon("kbarcoderect") ), 0, this, SLOT( insertRect() ), actionCollection() ); - circleAct = new KAction( i18n("Insert &Ellipse"), QIconSet( BarIcon("kbarcodeellipse") ), 0, this, SLOT( insertCircle() ), actionCollection() ); - spellAct = KStdAction::spelling( this, SLOT(spellCheck()), actionCollection(), "spell" ); - gridAct = new KToggleAction( i18n("&Grid"), QIconSet( BarIcon("kbarcodegrid") ), 0, this, SLOT( toggleGrid() ), actionCollection() ); - previewAct = new KAction( i18n("&Preview..."), 0, 0, this, SLOT( preview() ), actionCollection() ); - sep = new KActionSeparator( this ); - cutAct = KStdAction::cut( this, SLOT( cut() ), actionCollection(), "cut" ); - copyAct = KStdAction::copy( this, SLOT( copy() ), actionCollection(), "copy" ); - pasteAct = KStdAction::paste( this, SLOT( paste() ), actionCollection(), "paste" ); - selectAllAct = KStdAction::selectAll( cv, SLOT( selectAll() ), actionCollection(), "select_all" ); - deSelectAllAct = KStdAction::deselect( cv, SLOT( deSelectAll() ), actionCollection(), "de_select_all" ); - addressBookAct = new KAction( i18n("Address&book"), QIconSet( BarIcon("kaddressbook") ), 0, this, SLOT( launchAddressBook() ), actionCollection() ); + pictureAct = new KAction( i18n("Insert &Picture"), TQIconSet( BarIcon("inline_image") ), 0, TQT_TQOBJECT(this), TQT_SLOT( insertPicture() ), actionCollection() ); + textAct = new KAction( i18n("Insert &Text"), TQIconSet( BarIcon("text") ), 0, TQT_TQOBJECT(this), TQT_SLOT( insertText() ), actionCollection() ); + textDataAct = new KAction( i18n("Insert &Data Field"), TQIconSet( BarIcon("contents") ), 0, TQT_TQOBJECT(this), TQT_SLOT( insertDataText() ), actionCollection() ); + textLineAct = new KAction( i18n("Insert &Text Line"), TQIconSet( BarIcon("text") ), 0, TQT_TQOBJECT(this), TQT_SLOT( insertTextLine() ), actionCollection() ); + lineAct = new KAction( i18n("Insert &Line"), TQIconSet( BarIcon("kbarcodelinetool") ), 0, TQT_TQOBJECT(this), TQT_SLOT( insertLine() ), actionCollection() ); + rectAct = new KAction( i18n("Insert &Rectangle"), TQIconSet( BarIcon("kbarcoderect") ), 0, TQT_TQOBJECT(this), TQT_SLOT( insertRect() ), actionCollection() ); + circleAct = new KAction( i18n("Insert &Ellipse"), TQIconSet( BarIcon("kbarcodeellipse") ), 0, TQT_TQOBJECT(this), TQT_SLOT( insertCircle() ), actionCollection() ); + spellAct = KStdAction::spelling( TQT_TQOBJECT(this), TQT_SLOT(spellCheck()), actionCollection(), "spell" ); + gridAct = new KToggleAction( i18n("&Grid"), TQIconSet( BarIcon("kbarcodegrid") ), 0, TQT_TQOBJECT(this), TQT_SLOT( toggleGrid() ), actionCollection() ); + previewAct = new KAction( i18n("&Preview..."), 0, 0, TQT_TQOBJECT(this), TQT_SLOT( preview() ), actionCollection() ); + sep = new KActionSeparator( TQT_TQOBJECT(this) ); + cutAct = KStdAction::cut( TQT_TQOBJECT(this), TQT_SLOT( cut() ), actionCollection(), "cut" ); + copyAct = KStdAction::copy( TQT_TQOBJECT(this), TQT_SLOT( copy() ), actionCollection(), "copy" ); + pasteAct = KStdAction::paste( TQT_TQOBJECT(this), TQT_SLOT( paste() ), actionCollection(), "paste" ); + selectAllAct = KStdAction::selectAll( TQT_TQOBJECT(cv), TQT_SLOT( selectAll() ), actionCollection(), "select_all" ); + deSelectAllAct = KStdAction::deselect( TQT_TQOBJECT(cv), TQT_SLOT( deSelectAll() ), actionCollection(), "de_select_all" ); + addressBookAct = new KAction( i18n("Address&book"), TQIconSet( BarIcon("kaddressbook") ), 0, TQT_TQOBJECT(this), TQT_SLOT( launchAddressBook() ), actionCollection() ); KAction* singleBarcodeAct = new KAction(i18n("&Create Single Barcode..."), "", - 0, this, SLOT(startBarcodeGen()), + 0, TQT_TQOBJECT(this), TQT_SLOT(startBarcodeGen()), actionCollection(), "create" ); singleBarcodeAct->setEnabled( Barkode::haveBarcode() ); @@ -503,12 +500,12 @@ void LabelEditor::setupActions() lineAct->plug( tools ); rectAct->plug( tools ); circleAct->plug( tools ); - (new KActionSeparator( this ))->plug( tools ); + (new KActionSeparator( TQT_TQOBJECT(this) ))->plug( tools ); // spellAct->plug( tools ); // KDE 3.2 gridAct->plug( tools ); DSMainWindow::setupActions(); - connect( recentAct, SIGNAL( urlSelected( const KURL& ) ), this, SLOT( startLoadRecentEditor( const KURL& ) ) ); + connect( recentAct, TQT_SIGNAL( urlSelected( const KURL& ) ), TQT_TQOBJECT(this), TQT_SLOT( startLoadRecentEditor( const KURL& ) ) ); KPopupMenu* fileMenu = new KPopupMenu( this ); editMenu = new KPopupMenu( this ); @@ -582,22 +579,22 @@ void LabelEditor::setupContextMenu() m_mnuContext->setCheckable( true ); KPopupMenu* orderMenu = new KPopupMenu( m_mnuContext ); - orderMenu->insertItem( i18n("&On Top"), this, SLOT( onTopCurrent() ) ); - orderMenu->insertItem( i18n("&Raise"), this, SLOT( raiseCurrent() ) ); - orderMenu->insertItem( i18n("&Lower"), this, SLOT( lowerCurrent() ) ); - orderMenu->insertItem( i18n("&To Background"), this, SLOT( backCurrent() ) ); + orderMenu->insertItem( i18n("&On Top"), TQT_TQOBJECT(this), TQT_SLOT( onTopCurrent() ) ); + orderMenu->insertItem( i18n("&Raise"), TQT_TQOBJECT(this), TQT_SLOT( raiseCurrent() ) ); + orderMenu->insertItem( i18n("&Lower"), TQT_TQOBJECT(this), TQT_SLOT( lowerCurrent() ) ); + orderMenu->insertItem( i18n("&To Background"), TQT_TQOBJECT(this), TQT_SLOT( backCurrent() ) ); KPopupMenu* centerMenu = new KPopupMenu( m_mnuContext ); - centerMenu->insertItem( i18n("Center &Horizontally"), this, SLOT( centerHorizontal() ) ); - centerMenu->insertItem( i18n("Center &Vertically"), this, SLOT( centerVertical() ) ); + centerMenu->insertItem( i18n("Center &Horizontally"), TQT_TQOBJECT(this), TQT_SLOT( centerHorizontal() ) ); + centerMenu->insertItem( i18n("Center &Vertically"), TQT_TQOBJECT(this), TQT_SLOT( centerVertical() ) ); m_mnuContext->insertItem( i18n("&Order"), orderMenu ); m_mnuContext->insertItem( i18n("&Center"), centerMenu ); m_mnuContext->insertSeparator(); - m_mnuContext->insertItem( SmallIcon("editdelete"), i18n("&Delete"), cv, SLOT( deleteCurrent() ) ); - m_mnuContext->insertItem( i18n("&Protect Position and Size"), this, SLOT( lockItem() ), 0, ID_LOCK_ITEM ); + m_mnuContext->insertItem( SmallIcon("editdelete"), i18n("&Delete"), cv, TQT_SLOT( deleteCurrent() ) ); + m_mnuContext->insertItem( i18n("&Protect Position and Size"), TQT_TQOBJECT(this), TQT_SLOT( lockItem() ), 0, ID_LOCK_ITEM ); m_mnuContext->insertSeparator(); - m_mnuContext->insertItem( i18n("&Properties"), this, SLOT( doubleClickedCurrent() ) ); + m_mnuContext->insertItem( i18n("&Properties"), TQT_TQOBJECT(this), TQT_SLOT( doubleClickedCurrent() ) ); } void LabelEditor::insertBarcode() @@ -629,14 +626,14 @@ void LabelEditor::insertText() void LabelEditor::insertDataText() { // DocumentItemList list = cv->getAllItems(); -// QStringList vars = m_token->listUserVars( &list ); +// TQStringList vars = m_token->listUserVars( &list ); - TokenDialog dlg( m_token, this, "dlg" ); - if( dlg.exec() == QDialog::Accepted ) + TokenDialog dlg( m_token, this, "dlg" ); + if( dlg.exec() == TQDialog::Accepted ) insertText( dlg.token() ); } -void LabelEditor::insertText( QString caption ) +void LabelEditor::insertText( TQString caption ) { NewTextCommand* tc = new NewTextCommand( caption, cv, m_token ); history->addCommand( tc, true ); @@ -648,7 +645,7 @@ void LabelEditor::insertTextLine() insertTextLine( "Some Plain Text" ); } -void LabelEditor::insertTextLine( QString caption ) +void LabelEditor::insertTextLine( TQString caption ) { NewTextLineCommand* tc = new NewTextLineCommand( caption, cv, m_token ); history->addCommand( tc, true ); @@ -675,8 +672,8 @@ void LabelEditor::insertLine() void LabelEditor::changeDes() { - QString tmp = QInputDialog::getText( i18n("Label Description"), - i18n("Please enter a description:"), QLineEdit::Normal, description ); + TQString tmp = TQInputDialog::getText( i18n("Label Description"), + i18n("Please enter a description:"), TQLineEdit::Normal, description ); if( !tmp.isEmpty() ) description = tmp; } @@ -685,7 +682,7 @@ void LabelEditor::changeSize() { NewLabel* nl = new NewLabel( this, "nl", true, true ); nl->setLabelId( d->getId() ); - if( nl->exec() == QDialog::Rejected ) + if( nl->exec() == TQDialog::Rejected ) { delete nl; return; @@ -699,15 +696,15 @@ void LabelEditor::changeSize() // TODO: make sure that all items are redrawn. // Otherwise barcodes might become invisible when changing the label c->update(); - cv->repaint(); + cv->tqrepaint(); delete nl; } void LabelEditor::updateInfo() { - statusBar()->changeItem( i18n("Size: ") + QString("%1%2 x %3%4").arg( - d->getMeasurements().width() ).arg( Measurements::system() - ).arg( d->getMeasurements().height() ).arg( Measurements::system() ), STATUS_ID_SIZE ); + statusBar()->changeItem( i18n("Size: ") + TQString("%1%2 x %3%4").tqarg( + d->getMeasurements().width() ).tqarg( Measurements::system() + ).tqarg( d->getMeasurements().height() ).tqarg( Measurements::system() ), STATUS_ID_SIZE ); statusBar()->changeItem( i18n("Label Template: ") + d->getProducer() + " - " + d->getType(), STATUS_ID_TEMPLATE ); } @@ -715,10 +712,10 @@ void LabelEditor::doubleClickedItem( TCanvasItem* item ) { m_token->setCurrentDocumentItems( cv->getAllItems() ); DocumentItemDlg dlg( m_token, item->item(), history, this ); - if( dlg.exec() == QDialog::Accepted ) + if( dlg.exec() == TQDialog::Accepted ) { c->update(); - cv->repaintContents(); + cv->tqrepaintContents(); } } @@ -728,7 +725,7 @@ void LabelEditor::doubleClickedCurrent() doubleClickedItem( cv->getActive() ); } -void LabelEditor::showContextMenu( QPoint pos ) +void LabelEditor::showContextMenu( TQPoint pos ) { TCanvasItemList list = cv->getSelected(); @@ -757,7 +754,7 @@ void LabelEditor::lockItem() void LabelEditor::print() { PrintLabelDlg pld( this, "pld" ); - if( pld.exec() != QDialog::Accepted ) + if( pld.exec() != TQDialog::Accepted ) return; PrinterSettings::getInstance()->getData()->border = pld.border(); @@ -777,9 +774,9 @@ void LabelEditor::print() void LabelEditor::printBCP() { BarcodePrinterDlg dlg(this); - if( dlg.exec() == QDialog::Accepted ) + if( dlg.exec() == TQDialog::Accepted ) { - QString name( dlg.printToFile() ? dlg.fileName() : dlg.deviceName() ); + TQString name( dlg.printToFile() ? dlg.fileName() : dlg.deviceName() ); BatchPrinter batch( name, dlg.outputFormat(), this ); batchPrint( &batch, 1, BatchPrinter::BCP ); @@ -788,11 +785,11 @@ void LabelEditor::printBCP() void LabelEditor::printImage() { - KFileDialog fd( ":save_image", KImageIO::pattern( KImageIO::Writing ), this, "fd", true ); + KFileDialog fd( ":save_image", KImageIO::pattern( KImageIO::Writing ), this, "fd", true ); fd.setMode( KFile::File ); fd.setOperationMode( KFileDialog::Saving ); - if( fd.exec() == QDialog::Accepted ) { - QString path = fd.selectedURL().path(); + if( fd.exec() == TQDialog::Accepted ) { + TQString path = fd.selectedURL().path(); BatchPrinter batch( path, this ); batchPrint( &batch, 1, BatchPrinter::IMAGE ); } @@ -800,24 +797,24 @@ void LabelEditor::printImage() void LabelEditor::batchPrint( BatchPrinter* batch, int copies, int mode ) { - QBuffer buffer; + TQBuffer buffer; if( !buffer.open( IO_WriteOnly ) ) return; - save( &buffer ); + save( TQT_TQIODEVICE(&buffer) ); batch->setBuffer( &buffer ); - batch->setSerial( QString::null, 1 ); + batch->setSerial( TQString(), 1 ); batch->setName( filename ); batch->setDefinition( d ); - batch->setCustomer( QString::null ); + batch->setCustomer( TQString() ); batch->setEvents( false ); - QValueList<BatchPrinter::data>* list = new QValueList<BatchPrinter::data>; + TQValueList<BatchPrinter::data>* list = new TQValueList<BatchPrinter::data>; BatchPrinter::data m_data; m_data.number = copies; - m_data.article_no = QString::null; - m_data.group = QString::null; + m_data.article_no = TQString(); + m_data.group = TQString(); list->append( m_data ); batch->setData( list ); @@ -839,12 +836,12 @@ void LabelEditor::batchPrint( BatchPrinter* batch, int copies, int mode ) void LabelEditor::spellCheck() { KMacroCommand* sc = new KMacroCommand( i18n("Spellchecking") ); - QCanvasItemList list = c->allItems(); + TQCanvasItemList list = c->allItems(); for( unsigned int i = 0; i < list.count(); i++ ) if( list[i]->rtti() == eRtti_Text ) { TCanvasItem* item = (TCanvasItem*)list[i]; TextItem* mytext = (TextItem*)item->item(); - QString text = mytext->text(); + TQString text = mytext->text(); bool nocheck = false; // for( int z = 0; z < comboText->count(); z++ ) // if( text == "[" + comboText->text(z) + "]" ) { @@ -853,7 +850,7 @@ void LabelEditor::spellCheck() // } if( !nocheck ) { - QString textbefore = text; + TQString textbefore = text; KSpell::modalCheck( text ); if( text != textbefore ) { TextChangeCommand* tc = new TextChangeCommand( mytext, text ); @@ -913,7 +910,7 @@ void LabelEditor::onTopCurrent() int z = 0; - QCanvasItemList list = c->allItems(); + TQCanvasItemList list = c->allItems(); for( unsigned int i = 0; i < list.count(); i++ ) if( list[i]->z() > z ) z = (int)list[i]->z(); @@ -930,7 +927,7 @@ void LabelEditor::backCurrent() int z = 0; - QCanvasItemList list = c->allItems(); + TQCanvasItemList list = c->allItems(); for( unsigned int i = 0; i < list.count(); i++ ) if( list[i]->z() < z ) z = (int)list[i]->z(); @@ -939,28 +936,28 @@ void LabelEditor::backCurrent() history->addCommand( czc, true ); } -const QString LabelEditor::fileName() const +const TQString LabelEditor::fileName() const { - return filename.right( filename.length() - filename.findRev( "/" ) - 1 ); + return filename.right( filename.length() - filename.tqfindRev( "/" ) - 1 ); } void LabelEditor::preview() { - QBuffer buffer; + TQBuffer buffer; if( !buffer.open( IO_WriteOnly ) ) return; - save( &buffer ); + save( TQT_TQIODEVICE(&buffer) ); // No need to delete pd as it has WDestructiveClose set! - PreviewDialog* pd = new PreviewDialog( &buffer, d, fileName(), this ); + PreviewDialog* pd = new PreviewDialog( TQT_TQIODEVICE(&buffer), d, fileName(), this ); pd->exec(); } void LabelEditor::toggleGrid() { c->setGrid( gridAct->isChecked() ); - cv->repaintContents(); + cv->tqrepaintContents(); } void LabelEditor::cut() @@ -981,16 +978,12 @@ void LabelEditor::copy() DocumentItemDrag* drag = new DocumentItemDrag(); drag->setDocumentItem( &items ); -#if QT_VERSION >= 0x030100 - kapp->clipboard()->setData( drag, QClipboard::Clipboard ); -#else - kapp->clipboard()->setData( drag ); -#endif + kapp->tqclipboard()->setData( drag, TQClipboard::Clipboard ); } void LabelEditor::paste() { - QMimeSource* data = QApplication::clipboard()->data(); + TQMimeSource* data = TQApplication::tqclipboard()->data(); if ( DocumentItemDrag::canDecode( data ) ) DocumentItemDrag::decode( data, cv, m_token, history ); } @@ -998,8 +991,8 @@ void LabelEditor::paste() void LabelEditor::startEditor() { if( isChanged() ) { - LabelEditor* lb = new LabelEditor( NULL, QString::null, "LabelEditorWindow" ); - lb->startupDlg( eCreateNewLabel, QString::null ); + LabelEditor* lb = new LabelEditor( NULL, TQString(), "LabelEditorWindow" ); + lb->startupDlg( eCreateNewLabel, TQString() ); } else newLabel(); } @@ -1011,8 +1004,8 @@ void LabelEditor::startBarcodeGen() void LabelEditor::startLoadRecentEditor( const KURL& url ) { - if( !QFile::exists( url.path() ) ) { - KMessageBox::information( this, i18n("The file %1 does not exist.").arg( url.path() ) ); + if( !TQFile::exists( url.path() ) ) { + KMessageBox::information( this, i18n("The file %1 does not exist.").tqarg( url.path() ) ); recentAct->removeURL( url ); return; } @@ -1026,8 +1019,8 @@ void LabelEditor::startLoadRecentEditor( const KURL& url ) void LabelEditor::startLoadEditor() { if( isChanged() ) { - LabelEditor* lb = new LabelEditor( 0, QString::null, "LabelEditorWindow" ); - lb->startupDlg( eLoadLabel, QString::null ); + LabelEditor* lb = new LabelEditor( 0, TQString(), "LabelEditorWindow" ); + lb->startupDlg( eLoadLabel, TQString() ); } else open(); } @@ -1037,7 +1030,7 @@ void LabelEditor::batchPrint() new BatchWizard( NULL ); } -void LabelEditor::closeEvent( QCloseEvent* e ) +void LabelEditor::closeEvent( TQCloseEvent* e ) { if( !isChanged() ) { saveConfig(); @@ -1075,7 +1068,7 @@ bool LabelEditor::isChanged() return false; } -bool LabelEditor::startupDlg( ELabelEditorMode mode, QString f ) +bool LabelEditor::startupDlg( ELabelEditorMode mode, TQString f ) { if( mode == eCreateNewLabel && KBarcodeSettings::getInstance()->newDialog() ) { @@ -1107,7 +1100,7 @@ void LabelEditor::closeLabel() cv->setDefinition( d ); - filename = QString::null; + filename = TQString(); setCaption( filename, false ); } |