From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/fileiconview-example.html | 564 ++++++++++++++++++------------------- 1 file changed, 282 insertions(+), 282 deletions(-) (limited to 'doc/html/fileiconview-example.html') diff --git a/doc/html/fileiconview-example.html b/doc/html/fileiconview-example.html index 72eb6b69e..78a1a849c 100644 --- a/doc/html/fileiconview-example.html +++ b/doc/html/fileiconview-example.html @@ -34,7 +34,7 @@ body { background: #ffffff; color: black; }

This example implements a simple and not fully functional file manager using -a widget derived from TQIconView to display the current directory. +a widget derived from TQIconView to display the current directory. To display the directory tree the widget written in the dirview example is used. @@ -54,12 +54,12 @@ used. #define TQTFILEICONVIEW_H -#include <qiconset.h> -#include <qstring.h> -#include <qfileinfo.h> -#include <qdir.h> -#include <qtimer.h> -#include <qiconview.h> +#include <ntqiconset.h> +#include <ntqstring.h> +#include <ntqfileinfo.h> +#include <ntqdir.h> +#include <ntqtimer.h> +#include <ntqiconview.h> class TQtFileIconView; class TQDragObject; @@ -76,15 +76,15 @@ class TQtFileIconDrag : public TQIconDrag Q_OBJECT public: - TQtFileIconDrag( TQWidget * dragSource, const char* name = 0 ); + TQtFileIconDrag( TQWidget * dragSource, const char* name = 0 ); const char* format( int i ) const; TQByteArray encodedData( const char* mime ) const; static bool canDecode( TQMimeSource* e ); - void append( const TQIconDragItem &item, const TQRect &pr, const TQRect &tr, const TQString &url ); + void append( const TQIconDragItem &item, const TQRect &pr, const TQRect &tr, const TQString &url ); private: - TQStringList urls; + TQStringList urls; }; @@ -94,12 +94,12 @@ private: * *****************************************************************************/ class TQtFileIconViewItem; -class TQtFileIconView : public TQIconView +class TQtFileIconView : public TQIconView { Q_OBJECT public: - TQtFileIconView( const TQString &dir, TQWidget *parent = 0, const char *name = 0 ); + TQtFileIconView( const TQString &dir, TQWidget *parent = 0, const char *name = 0 ); enum ViewMode { Large, Small }; @@ -110,13 +110,13 @@ public: } public slots: - void setDirectory( const TQString &dir ); - void setDirectory( const TQDir &dir ); + void setDirectory( const TQString &dir ); + void setDirectory( const TQDir &dir ); void newDirectory(); - TQDir currentDir(); + TQDir currentDir(); signals: - void directoryChanged( const TQString & ); + void directoryChanged( const TQString & ); void startReadDir( int dirs ); void readNextDir(); void readDirDone(); @@ -127,7 +127,7 @@ signals: protected slots: void itemDoubleClicked( TQIconViewItem *i ); - void slotDropped( TQDropEvent *e, const TQValueList<TQIconDragItem> & ); + void slotDropped( TQDropEvent *e, const TQValueList<TQIconDragItem> & ); void viewLarge(); void viewSmall(); @@ -140,22 +140,22 @@ protected slots: void sortAscending(); void sortDescending(); void arrangeItemsInGrid() { - TQIconView::arrangeItemsInGrid( TRUE ); + TQIconView::arrangeItemsInGrid( TRUE ); } void slotRightPressed( TQIconViewItem *item ); void openFolder(); protected: - void readDir( const TQDir &dir ); + void readDir( const TQDir &dir ); virtual TQDragObject *dragObject(); virtual void keyPressEvent( TQKeyEvent *e ); - TQDir viewDir; + TQDir viewDir; int newFolderNum; - TQSize sz; - TQPixmap pix; + TQSize sz; + TQPixmap pix; ViewMode vm; TQtFileIconViewItem *openItem; @@ -184,27 +184,27 @@ public: ItemType type() const { return itemType; } - TQString filename() const { return itemFileName; } + TQString filename() const { return itemFileName; } virtual bool acceptDrop( const TQMimeSource *e ) const; - virtual void setText( const TQString &text ); + virtual void setText( const TQString &text ); virtual TQPixmap *pixmap() const; virtual void dragEntered(); virtual void dragLeft(); void viewModeChanged( TQtFileIconView::ViewMode m ); - void paintItem( TQPainter *p, const TQColorGroup &cg ); + void paintItem( TQPainter *p, const TQColorGroup &cg ); protected: - virtual void dropped( TQDropEvent *e, const TQValueList<TQIconDragItem> & ); + virtual void dropped( TQDropEvent *e, const TQValueList<TQIconDragItem> & ); - TQString itemFileName; - TQFileInfo *itemFileInfo; + TQString itemFileName; + TQFileInfo *itemFileInfo; ItemType itemType; bool checkSetText; - TQTimer timer; + TQTimer timer; TQtFileIconView::ViewMode vm; }; @@ -226,18 +226,18 @@ protected: *****************************************************************************/ #include "qfileiconview.h" -#include <qpainter.h> -#include <qstringlist.h> -#include <qpixmap.h> -#include <qmime.h> -#include <qstrlist.h> -#include <qdragobject.h> -#include <qmessagebox.h> -#include <qevent.h> -#include <qpopupmenu.h> -#include <qcursor.h> -#include <qapplication.h> -#include <qwmatrix.h> +#include <ntqpainter.h> +#include <ntqstringlist.h> +#include <ntqpixmap.h> +#include <ntqmime.h> +#include <ntqstrlist.h> +#include <ntqdragobject.h> +#include <ntqmessagebox.h> +#include <ntqevent.h> +#include <ntqpopupmenu.h> +#include <ntqcursor.h> +#include <ntqapplication.h> +#include <ntqwmatrix.h> #include <stdlib.h> @@ -469,7 +469,7 @@ static void cleanup() * *****************************************************************************/ -TQtFileIconDrag::TQtFileIconDrag( TQWidget * dragSource, const char* name ) +TQtFileIconDrag::TQtFileIconDrag( TQWidget * dragSource, const char* name ) : TQIconDrag( dragSource, name ) { } @@ -490,9 +490,9 @@ static void cleanup() if ( TQString( mime ) == "application/x-qiconlist" ) { a = TQIconDrag::encodedData( mime ); } else if ( TQString( mime ) == "text/uri-list" ) { - TQString s = urls.join( "\r\n" ); - a.resize( s.length() ); - memcpy( a.data(), s.latin1(), s.length() ); + TQString s = urls.join( "\r\n" ); + a.resize( s.length() ); + memcpy( a.data(), s.latin1(), s.length() ); } return a; } @@ -503,15 +503,15 @@ static void cleanup() e->provides( "text/uri-list" ); } -void TQtFileIconDrag::append( const TQIconDragItem &item, const TQRect &pr, - const TQRect &tr, const TQString &url ) +void TQtFileIconDrag::append( const TQIconDragItem &item, const TQRect &pr, + const TQRect &tr, const TQString &url ) { TQIconDrag::append( item, pr, tr ); - TQString ourUrl = url; + TQString ourUrl = url; #ifdef Q_WS_WIN - if (ourUrl.length() > 2 && ourUrl[1] != ':') { - TQDir dir(ourUrl); - ourUrl = dir.absPath(); + if (ourUrl.length() > 2 && ourUrl[1] != ':') { + TQDir dir(ourUrl); + ourUrl = dir.absPath(); } #endif urls << TQUriDrag::localFileToUri(ourUrl); @@ -524,36 +524,36 @@ static void cleanup() *****************************************************************************/ TQtFileIconViewItem::TQtFileIconViewItem( TQtFileIconView *parent, TQFileInfo *fi ) - : TQIconViewItem( parent, fi->fileName() ), itemFileName( fi->filePath() ), + : TQIconViewItem( parent, fi->fileName() ), itemFileName( fi->filePath() ), itemFileInfo( fi ), checkSetText( FALSE ) { vm = TQtFileIconView::Large; - if ( itemFileInfo->isDir() ) + if ( itemFileInfo->isDir() ) itemType = Dir; - else if ( itemFileInfo->isFile() ) + else if ( itemFileInfo->isFile() ) itemType = File; - if ( itemFileInfo->isSymLink() ) + if ( itemFileInfo->isSymLink() ) itemType = Link; viewModeChanged( ( (TQtFileIconView*)iconView() )->viewMode() ); - if ( itemFileInfo->fileName() == "." || - itemFileInfo->fileName() == ".." ) + if ( itemFileInfo->fileName() == "." || + itemFileInfo->fileName() == ".." ) setRenameEnabled( FALSE ); checkSetText = TRUE; - TQObject::connect( &timer, SIGNAL( timeout() ), + TQObject::connect( &timer, SIGNAL( timeout() ), iconView(), SLOT( openFolder() ) ); } -void TQtFileIconViewItem::paintItem( TQPainter *p, const TQColorGroup &cg ) +void TQtFileIconViewItem::paintItem( TQPainter *p, const TQColorGroup &cg ) { - if ( itemFileInfo->isSymLink() ) { - TQFont f( p->font() ); - f.setItalic( TRUE ); - p->setFont( f ); + if ( itemFileInfo->isSymLink() ) { + TQFont f( p->font() ); + f.setItalic( TRUE ); + p->setFont( f ); } TQIconViewItem::paintItem( p, cg ); @@ -605,16 +605,16 @@ TQtFileIconViewItem::~TQtFileIconViewItem() delete itemFileInfo; } -void TQtFileIconViewItem::setText( const TQString &text ) +void TQtFileIconViewItem::setText( const TQString &text ) { if ( checkSetText ) { - if ( text == "." || text == "." || text.isEmpty() ) + if ( text == "." || text == "." || text.isEmpty() ) return; - TQDir dir( itemFileInfo->dir() ); - if ( dir.rename( itemFileInfo->fileName(), text ) ) { - itemFileName = itemFileInfo->dirPath( TRUE ) + "/" + text; + TQDir dir( itemFileInfo->dir() ); + if ( dir.rename( itemFileInfo->fileName(), text ) ) { + itemFileName = itemFileInfo->dirPath( TRUE ) + "/" + text; delete itemFileInfo; - itemFileInfo = new TQFileInfo( itemFileName ); + itemFileInfo = new TQFileInfo( itemFileName ); TQIconViewItem::setText( text ); } } else { @@ -631,7 +631,7 @@ TQtFileIconViewItem::~TQtFileIconViewItem() return FALSE; } -void TQtFileIconViewItem::dropped( TQDropEvent *e, const TQValueList<TQIconDragItem> & ) +void TQtFileIconViewItem::dropped( TQDropEvent *e, const TQValueList<TQIconDragItem> & ) { timer.stop(); @@ -640,23 +640,23 @@ TQtFileIconViewItem::~TQtFileIconViewItem() return; } - TQStringList lst; + TQStringList lst; TQUriDrag::decodeLocalFiles( e, lst ); - TQString str; + TQString str; if ( e->action() == TQDropEvent::Copy ) str = "Copy\n\n"; else str = "Move\n\n"; - for ( uint i = 0; i < lst.count(); ++i ) + for ( uint i = 0; i < lst.count(); ++i ) str += TQString( " %1\n" ).arg( lst[i] ); str += TQString( "\n" "To\n\n" " %1" ).arg( filename() ); - TQMessageBox::information( iconView(), e->action() == TQDropEvent::Copy ? "Copy" : "Move" , str, "Not Implemented" ); + TQMessageBox::information( iconView(), e->action() == TQDropEvent::Copy ? "Copy" : "Move" , str, "Not Implemented" ); if ( e->action() == TQDropEvent::Move ) - TQMessageBox::information( iconView(), "Remove" , str, "Not Implemented" ); + TQMessageBox::information( iconView(), "Remove" , str, "Not Implemented" ); e->acceptAction(); } @@ -685,51 +685,51 @@ TQtFileIconViewItem::~TQtFileIconViewItem() * *****************************************************************************/ -TQtFileIconView::TQtFileIconView( const TQString &dir, TQWidget *parent, const char *name ) - : TQIconView( parent, name ), viewDir( dir ), newFolderNum( 0 ) +TQtFileIconView::TQtFileIconView( const TQString &dir, TQWidget *parent, const char *name ) + : TQIconView( parent, name ), viewDir( dir ), newFolderNum( 0 ) { if ( !iconFolderLockedLarge ) { - qAddPostRoutine( cleanup ); - TQWMatrix m; - m.scale( 0.6, 0.6 ); - TQPixmap iconpix( folder_locked_icon ); - iconFolderLockedLarge = new TQPixmap( folder_locked_icon ); - iconpix = iconpix.xForm( m ); - iconFolderLockedSmall = new TQPixmap( iconpix ); + qAddPostRoutine( cleanup ); + TQWMatrix m; + m.scale( 0.6, 0.6 ); + TQPixmap iconpix( folder_locked_icon ); + iconFolderLockedLarge = new TQPixmap( folder_locked_icon ); + iconpix = iconpix.xForm( m ); + iconFolderLockedSmall = new TQPixmap( iconpix ); iconpix = TQPixmap( folder_icon ); - iconFolderLarge = new TQPixmap( folder_icon ); - iconpix = iconpix.xForm( m ); - iconFolderSmall = new TQPixmap( iconpix ); + iconFolderLarge = new TQPixmap( folder_icon ); + iconpix = iconpix.xForm( m ); + iconFolderSmall = new TQPixmap( iconpix ); iconpix = TQPixmap( file_icon ); - iconFileLarge = new TQPixmap( file_icon ); - iconpix = iconpix.xForm( m ); - iconFileSmall = new TQPixmap( iconpix ); + iconFileLarge = new TQPixmap( file_icon ); + iconpix = iconpix.xForm( m ); + iconFileSmall = new TQPixmap( iconpix ); iconpix = TQPixmap( link_icon ); - iconLinkLarge = new TQPixmap( link_icon ); - iconpix = iconpix.xForm( m ); - iconLinkSmall = new TQPixmap( iconpix ); + iconLinkLarge = new TQPixmap( link_icon ); + iconpix = iconpix.xForm( m ); + iconLinkSmall = new TQPixmap( iconpix ); } vm = Large; - setGridX( 75 ); - setResizeMode( Adjust ); - setWordWrapIconText( FALSE ); + setGridX( 75 ); + setResizeMode( Adjust ); + setWordWrapIconText( FALSE ); - connect( this, SIGNAL( doubleClicked( TQIconViewItem * ) ), + connect( this, SIGNAL( doubleClicked( TQIconViewItem * ) ), this, SLOT( itemDoubleClicked( TQIconViewItem * ) ) ); - connect( this, SIGNAL( returnPressed( TQIconViewItem * ) ), + connect( this, SIGNAL( returnPressed( TQIconViewItem * ) ), this, SLOT( itemDoubleClicked( TQIconViewItem * ) ) ); - connect( this, SIGNAL( dropped( TQDropEvent *, const TQValueList<TQIconDragItem> & ) ), - this, SLOT( slotDropped( TQDropEvent *, const TQValueList<TQIconDragItem> & ) ) ); - connect( this, SIGNAL( contextMenuRequested( TQIconViewItem *, const TQPoint & ) ), + connect( this, SIGNAL( dropped( TQDropEvent *, const TQValueList<TQIconDragItem> & ) ), + this, SLOT( slotDropped( TQDropEvent *, const TQValueList<TQIconDragItem> & ) ) ); + connect( this, SIGNAL( contextMenuRequested( TQIconViewItem *, const TQPoint & ) ), this, SLOT( slotRightPressed( TQIconViewItem * ) ) ); - setHScrollBarMode( AlwaysOff ); - setVScrollBarMode( Auto ); + setHScrollBarMode( AlwaysOff ); + setVScrollBarMode( Auto ); - setAutoArrange( TRUE ); - setSorting( TRUE ); + setAutoArrange( TRUE ); + setSorting( TRUE ); openItem = 0; } @@ -746,13 +746,13 @@ void TQtFileIconView::openFolder() setDirectory( openItem->itemFileName ); } -void TQtFileIconView::setDirectory( const TQString &dir ) +void TQtFileIconView::setDirectory( const TQString &dir ) { viewDir = TQDir( dir ); readDir( viewDir ); } -void TQtFileIconView::setDirectory( const TQDir &dir ) +void TQtFileIconView::setDirectory( const TQDir &dir ) { viewDir = dir; readDir( viewDir ); @@ -760,22 +760,22 @@ void TQtFileIconView::setDirectory( const TQDir &dir void TQtFileIconView::newDirectory() { - setAutoArrange( FALSE ); - selectAll( FALSE ); + setAutoArrange( FALSE ); + selectAll( FALSE ); if ( viewDir.mkdir( TQString( "New Folder %1" ).arg( ++newFolderNum ) ) ) { - TQFileInfo *fi = new TQFileInfo( viewDir, TQString( "New Folder %1" ).arg( newFolderNum ) ); - TQtFileIconViewItem *item = new TQtFileIconViewItem( this, new TQFileInfo( *fi ) ); - item->setKey( TQString( "000000%1" ).arg( fi->fileName() ) ); + TQFileInfo *fi = new TQFileInfo( viewDir, TQString( "New Folder %1" ).arg( newFolderNum ) ); + TQtFileIconViewItem *item = new TQtFileIconViewItem( this, new TQFileInfo( *fi ) ); + item->setKey( TQString( "000000%1" ).arg( fi->fileName() ) ); delete fi; - repaintContents( contentsX(), contentsY(), contentsWidth(), contentsHeight(), FALSE ); - ensureItemVisible( item ); + repaintContents( contentsX(), contentsY(), contentsWidth(), contentsHeight(), FALSE ); + ensureItemVisible( item ); item->setSelected( TRUE, TRUE ); - setCurrentItem( item ); - repaintItem( item ); - qApp->processEvents(); + setCurrentItem( item ); + repaintItem( item ); + qApp->processEvents(); item->rename(); } - setAutoArrange( TRUE ); + setAutoArrange( TRUE ); } TQDir TQtFileIconView::currentDir() @@ -783,21 +783,21 @@ TQDir TQtFileIconView::currentDir() return viewDir; } -static bool isRoot( const TQString &s ) +static bool isRoot( const TQString &s ) { #if defined(Q_OS_UNIX) if ( s == "/" ) return TRUE; #elif defined(Q_OS_WIN32) - TQString p = s; - if ( p.length() == 3 && - p.right( 2 ) == ":/" ) + TQString p = s; + if ( p.length() == 3 && + p.right( 2 ) == ":/" ) return TRUE; if ( p[ 0 ] == '/' && p[ 1 ] == '/' ) { - int slashes = p.contains( '/' ); + int slashes = p.contains( '/' ); if ( slashes <= 3 ) return TRUE; - if ( slashes == 4 && p[ (int)p.length() - 1 ] == '/' ) + if ( slashes == 4 && p[ (int)p.length() - 1 ] == '/' ) return TRUE; } #endif @@ -805,39 +805,39 @@ static bool isRoot( const TQString &s ) return FALSE; } -void TQtFileIconView::readDir( const TQDir &dir ) +void TQtFileIconView::readDir( const TQDir &dir ) { - if ( !dir.isReadable() ) + if ( !dir.isReadable() ) return; - if ( isRoot( dir.absPath() ) ) + if ( isRoot( dir.absPath() ) ) emit disableUp(); else emit enableUp(); - clear(); + clear(); - emit directoryChanged( dir.absPath() ); + emit directoryChanged( dir.absPath() ); - const TQFileInfoList *filist = dir.entryInfoList( TQDir::DefaultFilter, TQDir::DirsFirst | TQDir::Name ); + const TQFileInfoList *filist = dir.entryInfoList( TQDir::DefaultFilter, TQDir::DirsFirst | TQDir::Name ); emit startReadDir( filist->count() ); TQFileInfoListIterator it( *filist ); - TQFileInfo *fi; + TQFileInfo *fi; bool allowRename = FALSE, allowRenameSet = FALSE; while ( ( fi = it.current() ) != 0 ) { ++it; - if ( fi && fi->fileName() == ".." && ( fi->dirPath() == "/" || fi->dirPath().isEmpty() ) ) + if ( fi && fi->fileName() == ".." && ( fi->dirPath() == "/" || fi->dirPath().isEmpty() ) ) continue; emit readNextDir(); - TQtFileIconViewItem *item = new TQtFileIconViewItem( this, new TQFileInfo( *fi ) ); - if ( fi->isDir() ) - item->setKey( TQString( "000000%1" ).arg( fi->fileName() ) ); + TQtFileIconViewItem *item = new TQtFileIconViewItem( this, new TQFileInfo( *fi ) ); + if ( fi->isDir() ) + item->setKey( TQString( "000000%1" ).arg( fi->fileName() ) ); else - item->setKey( fi->fileName() ); + item->setKey( fi->fileName() ); if ( !allowRenameSet ) { - if ( !TQFileInfo( fi->absFilePath() ).isWritable() || + if ( !TQFileInfo( fi->absFilePath() ).isWritable() || item->text() == "." || item->text() == ".." ) allowRename = FALSE; else @@ -850,7 +850,7 @@ void TQtFileIconView::readDir( const TQDi item->setRenameEnabled( allowRename ); } - if ( !TQFileInfo( dir.absPath() ).isWritable() ) + if ( !TQFileInfo( dir.absPath() ).isWritable() ) emit disableMkdir(); else emit enableMkdir(); @@ -872,26 +872,26 @@ void TQtFileIconView::itemDoubleClicked( TQDragObject *TQtFileIconView::dragObject() +TQDragObject *TQtFileIconView::dragObject() { if ( !currentItem() ) return 0; - TQPoint orig = viewportToContents( viewport()->mapFromGlobal( TQCursor::pos() ) ); - TQtFileIconDrag *drag = new TQtFileIconDrag( viewport() ); - drag->setPixmap( *currentItem()->pixmap(), - TQPoint( currentItem()->pixmapRect().width() / 2, currentItem()->pixmapRect().height() / 2 ) ); - for ( TQtFileIconViewItem *item = (TQtFileIconViewItem*)firstItem(); item; + TQPoint orig = viewportToContents( viewport()->mapFromGlobal( TQCursor::pos() ) ); + TQtFileIconDrag *drag = new TQtFileIconDrag( viewport() ); + drag->setPixmap( *currentItem()->pixmap(), + TQPoint( currentItem()->pixmapRect().width() / 2, currentItem()->pixmapRect().height() / 2 ) ); + for ( TQtFileIconViewItem *item = (TQtFileIconViewItem*)firstItem(); item; item = (TQtFileIconViewItem*)item->nextItem() ) { if ( item->isSelected() ) { TQIconDragItem id; id.setData( TQCString( item->filename() ) ); drag->append( id, - TQRect( item->pixmapRect( FALSE ).x() - orig.x(), - item->pixmapRect( FALSE ).y() - orig.y(), + TQRect( item->pixmapRect( FALSE ).x() - orig.x(), + item->pixmapRect( FALSE ).y() - orig.y(), item->pixmapRect().width(), item->pixmapRect().height() ), - TQRect( item->textRect( FALSE ).x() - orig.x(), - item->textRect( FALSE ).y() - orig.y(), + TQRect( item->textRect( FALSE ).x() - orig.x(), + item->textRect( FALSE ).y() - orig.y(), item->textRect().width(), item->textRect().height() ), TQString( item->filename() ) ); } @@ -900,16 +900,16 @@ void TQtFileIconView::itemDoubleClicked( void TQtFileIconView::keyPressEvent( TQKeyEvent *e ) +void TQtFileIconView::keyPressEvent( TQKeyEvent *e ) { if ( e->key() == Key_N && ( e->state() & ControlButton ) ) newDirectory(); else - TQIconView::keyPressEvent( e ); + TQIconView::keyPressEvent( e ); } -void TQtFileIconView::slotDropped( TQDropEvent *e, const TQValueList<TQIconDragItem> & ) +void TQtFileIconView::slotDropped( TQDropEvent *e, const TQValueList<TQIconDragItem> & ) { if ( openItem ) openItem->timer.stop(); @@ -918,23 +918,23 @@ void TQtFileIconView::slotDropped( return; } - TQStringList lst; + TQStringList lst; TQUriDrag::decodeLocalFiles( e, lst ); - TQString str; + TQString str; if ( e->action() == TQDropEvent::Copy ) str = "Copy\n\n"; else str = "Move\n\n"; - for ( uint i = 0; i < lst.count(); ++i ) - str += TQString( " %1\n" ).arg( TQDir::convertSeparators(lst[i]) ); + for ( uint i = 0; i < lst.count(); ++i ) + str += TQString( " %1\n" ).arg( TQDir::convertSeparators(lst[i]) ); str += TQString( "\n" "To\n\n" " %1" ).arg( viewDir.absPath() ); - TQMessageBox::information( this, e->action() == TQDropEvent::Copy ? "Copy" : "Move" , str, "Not Implemented" ); + TQMessageBox::information( this, e->action() == TQDropEvent::Copy ? "Copy" : "Move" , str, "Not Implemented" ); if ( e->action() == TQDropEvent::Move ) - TQMessageBox::information( this, "Remove" , TQDir::convertSeparators(lst.join("\n")), "Not Implemented" ); + TQMessageBox::information( this, "Remove" , TQDir::convertSeparators(lst.join("\n")), "Not Implemented" ); e->acceptAction(); openItem = 0; } @@ -951,80 +951,80 @@ void TQtFileIconView::viewSmall() void TQtFileIconView::viewBottom() { - setItemTextPos( Bottom ); + setItemTextPos( Bottom ); } void TQtFileIconView::viewRight() { - setItemTextPos( Right ); + setItemTextPos( Right ); } void TQtFileIconView::flowEast() { - setHScrollBarMode( AlwaysOff ); - setVScrollBarMode( Auto ); - setArrangement( LeftToRight ); + setHScrollBarMode( AlwaysOff ); + setVScrollBarMode( Auto ); + setArrangement( LeftToRight ); } void TQtFileIconView::flowSouth() { - setVScrollBarMode( AlwaysOff ); - setHScrollBarMode( Auto ); - setArrangement( TopToBottom ); + setVScrollBarMode( AlwaysOff ); + setHScrollBarMode( Auto ); + setArrangement( TopToBottom ); } void TQtFileIconView::sortAscending() { - sort( TRUE ); + sort( TRUE ); } void TQtFileIconView::sortDescending() { - sort( FALSE ); + sort( FALSE ); } void TQtFileIconView::itemTextTruncate() { - setWordWrapIconText( FALSE ); + setWordWrapIconText( FALSE ); } void TQtFileIconView::itemTextWordWrap() { - setWordWrapIconText( TRUE ); + setWordWrapIconText( TRUE ); } void TQtFileIconView::slotRightPressed( TQIconViewItem *item ) { if ( !item ) { // right pressed on viewport - TQPopupMenu menu( this ); - - menu.insertItem( "&Large view", this, SLOT( viewLarge() ) ); - menu.insertItem( "&Small view", this, SLOT( viewSmall() ) ); - menu.insertSeparator(); - menu.insertItem( "Text at the &bottom", this, SLOT( viewBottom() ) ); - menu.insertItem( "Text at the &right", this, SLOT( viewRight() ) ); - menu.insertSeparator(); - menu.insertItem( "Arrange l&eft to right", this, SLOT( flowEast() ) ); - menu.insertItem( "Arrange t&op to bottom", this, SLOT( flowSouth() ) ); - menu.insertSeparator(); - menu.insertItem( "&Truncate item text", this, SLOT( itemTextTruncate() ) ); - menu.insertItem( "&Wordwrap item text", this, SLOT( itemTextWordWrap() ) ); - menu.insertSeparator(); - menu.insertItem( "Arrange items in &grid", this, SLOT( arrangeItemsInGrid() ) ); - menu.insertSeparator(); - menu.insertItem( "Sort &ascending", this, SLOT( sortAscending() ) ); - menu.insertItem( "Sort &descending", this, SLOT( sortDescending() ) ); - - menu.setMouseTracking( TRUE ); - menu.exec( TQCursor::pos() ); + TQPopupMenu menu( this ); + + menu.insertItem( "&Large view", this, SLOT( viewLarge() ) ); + menu.insertItem( "&Small view", this, SLOT( viewSmall() ) ); + menu.insertSeparator(); + menu.insertItem( "Text at the &bottom", this, SLOT( viewBottom() ) ); + menu.insertItem( "Text at the &right", this, SLOT( viewRight() ) ); + menu.insertSeparator(); + menu.insertItem( "Arrange l&eft to right", this, SLOT( flowEast() ) ); + menu.insertItem( "Arrange t&op to bottom", this, SLOT( flowSouth() ) ); + menu.insertSeparator(); + menu.insertItem( "&Truncate item text", this, SLOT( itemTextTruncate() ) ); + menu.insertItem( "&Wordwrap item text", this, SLOT( itemTextWordWrap() ) ); + menu.insertSeparator(); + menu.insertItem( "Arrange items in &grid", this, SLOT( arrangeItemsInGrid() ) ); + menu.insertSeparator(); + menu.insertItem( "Sort &ascending", this, SLOT( sortAscending() ) ); + menu.insertItem( "Sort &descending", this, SLOT( sortDescending() ) ); + + menu.setMouseTracking( TRUE ); + menu.exec( TQCursor::pos() ); } else { // on item - TQPopupMenu menu( this ); + TQPopupMenu menu( this ); - int RENAME_ITEM = menu.insertItem( "Rename Item" ); - int REMOVE_ITEM = menu.insertItem( "Remove Item" ); + int RENAME_ITEM = menu.insertItem( "Rename Item" ); + int REMOVE_ITEM = menu.insertItem( "Remove Item" ); - menu.setMouseTracking( TRUE ); - int id = menu.exec( TQCursor::pos() ); + menu.setMouseTracking( TRUE ); + int id = menu.exec( TQCursor::pos() ); if ( id == -1 ) return; @@ -1033,7 +1033,7 @@ void TQtFileIconView::slotRightPressed( rename(); } else if ( id == REMOVE_ITEM ) { delete item; - TQMessageBox::information( this, "Not implemented!", "Deleting files not implemented yet,\n" + TQMessageBox::information( this, "Not implemented!", "Deleting files not implemented yet,\n" "The item has only been removed from the view! " ); } } @@ -1045,11 +1045,11 @@ void TQtFileIconView::setViewMode( ViewMode m ) return; vm = m; - TQtFileIconViewItem *item = (TQtFileIconViewItem*)firstItem(); + TQtFileIconViewItem *item = (TQtFileIconViewItem*)firstItem(); for ( ; item; item = (TQtFileIconViewItem*)item->nextItem() ) item->viewModeChanged( vm ); - arrangeItemsInGrid(); + arrangeItemsInGrid(); } @@ -1068,7 +1068,7 @@ void TQtFileIconView::setViewMode( ViewMode m ) #ifndef MAINWIN_H #define MAINWIN_H -#include <qmainwindow.h> +#include <ntqmainwindow.h> class TQtFileIconView; class DirectoryView; @@ -1077,7 +1077,7 @@ class TQLabel; class TQComboBox; class TQToolButton; -class FileMainWindow : public TQMainWindow +class FileMainWindow : public TQMainWindow { Q_OBJECT @@ -1095,19 +1095,19 @@ protected: TQtFileIconView *fileview; DirectoryView *dirlist; - TQProgressBar *progress; - TQLabel *label; - TQComboBox *pathCombo; - TQToolButton *upButton, *mkdirButton; + TQProgressBar *progress; + TQLabel *label; + TQComboBox *pathCombo; + TQToolButton *upButton, *mkdirButton; protected slots: - void directoryChanged( const TQString & ); + void directoryChanged( const TQString & ); void slotStartReadDir( int dirs ); void slotReadNextDir(); void slotReadDirDone(); void cdUp(); void newFolder(); - void changePath( const TQString &path ); + void changePath( const TQString &path ); void enableUp(); void disableUp(); void enableMkdir(); @@ -1134,16 +1134,16 @@ protected slots: #include "qfileiconview.h" #include "../dirview/dirview.h" -#include <qsplitter.h> -#include <qprogressbar.h> -#include <qlabel.h> -#include <qstatusbar.h> -#include <qtoolbar.h> -#include <qcombobox.h> -#include <qpixmap.h> -#include <qtoolbutton.h> -#include <qdir.h> -#include <qfileinfo.h> +#include <ntqsplitter.h> +#include <ntqprogressbar.h> +#include <ntqlabel.h> +#include <ntqstatusbar.h> +#include <ntqtoolbar.h> +#include <ntqcombobox.h> +#include <ntqpixmap.h> +#include <ntqtoolbutton.h> +#include <ntqdir.h> +#include <ntqfileinfo.h> static const char* cdtoparent_xpm[]={ "15 13 3 1", @@ -1186,134 +1186,134 @@ static const char* newfolder_xpm[] = { "........... "}; FileMainWindow::FileMainWindow() - : TQMainWindow() + : TQMainWindow() { setup(); } -void FileMainWindow::show() +void FileMainWindow::show() { - TQMainWindow::show(); + TQMainWindow::show(); } void FileMainWindow::setup() { - TQSplitter *splitter = new TQSplitter( this ); + TQSplitter *splitter = new TQSplitter( this ); dirlist = new DirectoryView( splitter, "dirlist", TRUE ); - dirlist->addColumn( "Name" ); - dirlist->addColumn( "Type" ); + dirlist->addColumn( "Name" ); + dirlist->addColumn( "Type" ); Directory *root = new Directory( dirlist, "/" ); root->setOpen( TRUE ); - splitter->setResizeMode( dirlist, TQSplitter::KeepSize ); + splitter->setResizeMode( dirlist, TQSplitter::KeepSize ); fileview = new TQtFileIconView( "/", splitter ); - fileview->setSelectionMode( TQIconView::Extended ); + fileview->setSelectionMode( TQIconView::Extended ); - setCentralWidget( splitter ); + setCentralWidget( splitter ); - TQToolBar *toolbar = new TQToolBar( this, "toolbar" ); - setRightJustification( TRUE ); + TQToolBar *toolbar = new TQToolBar( this, "toolbar" ); + setRightJustification( TRUE ); - (void)new TQLabel( tr( " Path: " ), toolbar ); + (void)new TQLabel( tr( " Path: " ), toolbar ); - pathCombo = new TQComboBox( TRUE, toolbar ); - pathCombo->setAutoCompletion( TRUE ); - toolbar->setStretchableWidget( pathCombo ); - connect( pathCombo, SIGNAL( activated( const TQString & ) ), - this, SLOT ( changePath( const TQString & ) ) ); + pathCombo = new TQComboBox( TRUE, toolbar ); + pathCombo->setAutoCompletion( TRUE ); + toolbar->setStretchableWidget( pathCombo ); + connect( pathCombo, SIGNAL( activated( const TQString & ) ), + this, SLOT ( changePath( const TQString & ) ) ); - toolbar->addSeparator(); + toolbar->addSeparator(); - TQPixmap pix; + TQPixmap pix; pix = TQPixmap( cdtoparent_xpm ); - upButton = new TQToolButton( pix, "One directory up", TQString::null, + upButton = new TQToolButton( pix, "One directory up", TQString::null, this, SLOT( cdUp() ), toolbar, "cd up" ); pix = TQPixmap( newfolder_xpm ); - mkdirButton = new TQToolButton( pix, "New Folder", TQString::null, + mkdirButton = new TQToolButton( pix, "New Folder", TQString::null, this, SLOT( newFolder() ), toolbar, "new folder" ); - connect( dirlist, SIGNAL( folderSelected( const TQString & ) ), - fileview, SLOT ( setDirectory( const TQString & ) ) ); - connect( fileview, SIGNAL( directoryChanged( const TQString & ) ), - this, SLOT( directoryChanged( const TQString & ) ) ); - connect( fileview, SIGNAL( startReadDir( int ) ), + connect( dirlist, SIGNAL( folderSelected( const TQString & ) ), + fileview, SLOT ( setDirectory( const TQString & ) ) ); + connect( fileview, SIGNAL( directoryChanged( const TQString & ) ), + this, SLOT( directoryChanged( const TQString & ) ) ); + connect( fileview, SIGNAL( startReadDir( int ) ), this, SLOT( slotStartReadDir( int ) ) ); - connect( fileview, SIGNAL( readNextDir() ), + connect( fileview, SIGNAL( readNextDir() ), this, SLOT( slotReadNextDir() ) ); - connect( fileview, SIGNAL( readDirDone() ), + connect( fileview, SIGNAL( readDirDone() ), this, SLOT( slotReadDirDone() ) ); - setDockEnabled( DockLeft, FALSE ); - setDockEnabled( DockRight, FALSE ); + setDockEnabled( DockLeft, FALSE ); + setDockEnabled( DockRight, FALSE ); - label = new TQLabel( statusBar() ); - statusBar()->addWidget( label, 2, TRUE ); - progress = new TQProgressBar( statusBar() ); - statusBar()->addWidget( progress, 1, TRUE ); + label = new TQLabel( statusBar() ); + statusBar()->addWidget( label, 2, TRUE ); + progress = new TQProgressBar( statusBar() ); + statusBar()->addWidget( progress, 1, TRUE ); - connect( fileview, SIGNAL( enableUp() ), + connect( fileview, SIGNAL( enableUp() ), this, SLOT( enableUp() ) ); - connect( fileview, SIGNAL( disableUp() ), + connect( fileview, SIGNAL( disableUp() ), this, SLOT( disableUp() ) ); - connect( fileview, SIGNAL( enableMkdir() ), + connect( fileview, SIGNAL( enableMkdir() ), this, SLOT( enableMkdir() ) ); - connect( fileview, SIGNAL( disableMkdir() ), + connect( fileview, SIGNAL( disableMkdir() ), this, SLOT( disableMkdir() ) ); } void FileMainWindow::setPathCombo() { - TQString dir = caption(); + TQString dir = caption(); int i = 0; bool found = FALSE; - for ( i = 0; i < pathCombo->count(); ++i ) { - if ( pathCombo->text( i ) == dir) { + for ( i = 0; i < pathCombo->count(); ++i ) { + if ( pathCombo->text( i ) == dir) { found = TRUE; break; } } if ( found ) - pathCombo->setCurrentItem( i ); + pathCombo->setCurrentItem( i ); else { - pathCombo->insertItem( dir ); - pathCombo->setCurrentItem( pathCombo->count() - 1 ); + pathCombo->insertItem( dir ); + pathCombo->setCurrentItem( pathCombo->count() - 1 ); } } -void FileMainWindow::directoryChanged( const TQString &dir ) +void FileMainWindow::directoryChanged( const TQString &dir ) { - setCaption( dir ); + setCaption( dir ); setPathCombo(); } void FileMainWindow::slotStartReadDir( int dirs ) { - label->setText( tr( " Reading Directory..." ) ); - progress->reset(); - progress->setTotalSteps( dirs ); + label->setText( tr( " Reading Directory..." ) ); + progress->reset(); + progress->setTotalSteps( dirs ); } void FileMainWindow::slotReadNextDir() { - int p = progress->progress(); - progress->setProgress( ++p ); + int p = progress->progress(); + progress->setProgress( ++p ); } void FileMainWindow::slotReadDirDone() { - label->setText( tr( " Reading Directory Done." ) ); - progress->setProgress( progress->totalSteps() ); + label->setText( tr( " Reading Directory Done." ) ); + progress->setProgress( progress->totalSteps() ); } void FileMainWindow::cdUp() { - TQDir dir = fileview->currentDir(); - dir.cd( ".." ); + TQDir dir = fileview->currentDir(); + dir.cd( ".." ); fileview->setDirectory( dir ); } @@ -1322,7 +1322,7 @@ void FileMainWindow::newFolder() fileview->newDirectory(); } -void FileMainWindow::changePath( const TQString &path ) +void FileMainWindow::changePath( const TQString &path ) { if ( TQFileInfo( path ).exists() ) fileview->setDirectory( path ); @@ -1332,22 +1332,22 @@ void FileMainWindow::changePath( const FileMainWindow::enableUp() { - upButton->setEnabled( TRUE ); + upButton->setEnabled( TRUE ); } void FileMainWindow::disableUp() { - upButton->setEnabled( FALSE ); + upButton->setEnabled( FALSE ); } void FileMainWindow::enableMkdir() { - mkdirButton->setEnabled( TRUE ); + mkdirButton->setEnabled( TRUE ); } void FileMainWindow::disableMkdir() { - mkdirButton->setEnabled( FALSE ); + mkdirButton->setEnabled( FALSE ); } @@ -1366,19 +1366,19 @@ void FileMainWindow::disableMkdir() #include "mainwindow.h" #include "qfileiconview.h" -#include <qapplication.h> +#include <ntqapplication.h> int main( int argc, char **argv ) { - TQApplication a( argc, argv ); + TQApplication a( argc, argv ); FileMainWindow mw; - mw.resize( 680, 480 ); - a.setMainWidget( &mw ); + mw.resize( 680, 480 ); + a.setMainWidget( &mw ); mw.fileView()->setDirectory( "/" ); - mw.show(); - return a.exec(); + mw.show(); + return a.exec(); } -- cgit v1.2.1