From d6f8bbb45b267065a6907e71ff9c98bb6d161241 Mon Sep 17 00:00:00 2001 From: tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> Date: Sat, 31 Jul 2010 19:56:07 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- parts/bookmarks/bookmarks_part.cpp | 126 ++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 63 deletions(-) (limited to 'parts/bookmarks/bookmarks_part.cpp') diff --git a/parts/bookmarks/bookmarks_part.cpp b/parts/bookmarks/bookmarks_part.cpp index f23863af..50830723 100644 --- a/parts/bookmarks/bookmarks_part.cpp +++ b/parts/bookmarks/bookmarks_part.cpp @@ -9,11 +9,11 @@ * * ***************************************************************************/ -#include <qwhatsthis.h> -#include <qvbox.h> -#include <qtimer.h> -#include <qtextstream.h> -#include <qfile.h> +#include <tqwhatsthis.h> +#include <tqvbox.h> +#include <tqtimer.h> +#include <tqtextstream.h> +#include <tqfile.h> #include <kdebug.h> #include <kiconloader.h> @@ -44,7 +44,7 @@ typedef KDevGenericFactory<BookmarksPart> BookmarksFactory; static const KDevPluginInfo data("kdevbookmarks"); K_EXPORT_COMPONENT_FACTORY( libkdevbookmarks, BookmarksFactory( data ) ) -BookmarksPart::BookmarksPart(QObject *parent, const char *name, const QStringList& ) +BookmarksPart::BookmarksPart(TQObject *parent, const char *name, const TQStringList& ) : KDevPlugin(&data, parent, name ? name : "BookmarksPart" ) { setInstance(BookmarksFactory::instance()); @@ -54,9 +54,9 @@ BookmarksPart::BookmarksPart(QObject *parent, const char *name, const QStringLis _widget->setCaption(i18n("Bookmarks")); _widget->setIcon(SmallIcon( info()->icon() )); - _marksChangeTimer = new QTimer( this ); + _marksChangeTimer = new TQTimer( this ); - QWhatsThis::add(_widget, i18n("<b>Bookmarks</b><p>" + TQWhatsThis::add(_widget, i18n("<b>Bookmarks</b><p>" "The bookmark viewer shows all the source bookmarks in the project.")); mainWindow()->embedSelectView(_widget, i18n("Bookmarks"), i18n("Source bookmarks")); @@ -64,19 +64,19 @@ BookmarksPart::BookmarksPart(QObject *parent, const char *name, const QStringLis _editorMap.setAutoDelete( true ); _settingMarks = false; - connect( partController(), SIGNAL( partAdded( KParts::Part * ) ), this, SLOT( partAdded( KParts::Part * ) ) ); + connect( partController(), TQT_SIGNAL( partAdded( KParts::Part * ) ), this, TQT_SLOT( partAdded( KParts::Part * ) ) ); _configProxy = new ConfigWidgetProxy( core() ); _configProxy->createProjectConfigPage( i18n("Bookmarks"), BOOKMARKSETTINGSPAGE, info()->icon() ); - connect( _configProxy, SIGNAL(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )), - this, SLOT(insertConfigWidget(const KDialogBase*, QWidget*, unsigned int )) ); + connect( _configProxy, TQT_SIGNAL(insertConfigWidget(const KDialogBase*, TQWidget*, unsigned int )), + this, TQT_SLOT(insertConfigWidget(const KDialogBase*, TQWidget*, unsigned int )) ); - connect( _widget, SIGNAL( removeAllBookmarksForURL( const KURL & ) ), - this, SLOT( removeAllBookmarksForURL( const KURL & ) ) ); - connect( _widget, SIGNAL( removeBookmarkForURL( const KURL &, int ) ), - this, SLOT( removeBookmarkForURL( const KURL &, int ) ) ); + connect( _widget, TQT_SIGNAL( removeAllBookmarksForURL( const KURL & ) ), + this, TQT_SLOT( removeAllBookmarksForURL( const KURL & ) ) ); + connect( _widget, TQT_SIGNAL( removeBookmarkForURL( const KURL &, int ) ), + this, TQT_SLOT( removeBookmarkForURL( const KURL &, int ) ) ); - connect( _marksChangeTimer, SIGNAL( timeout() ), this, SLOT( marksChanged() ) ); + connect( _marksChangeTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( marksChanged() ) ); _config = new BookmarksConfig; _config->readConfig(); @@ -112,10 +112,10 @@ void BookmarksPart::partAdded( KParts::Part * part ) // connect to this editor KTextEditor::Document * doc = static_cast<KTextEditor::Document*>( ro_part ); - connect( doc, SIGNAL( marksChanged() ), this, SLOT( marksEvent() ) ); + connect( doc, TQT_SIGNAL( marksChanged() ), this, TQT_SLOT( marksEvent() ) ); // workaround for a katepart oddity where it drops all bookmarks on 'reload' - connect( doc, SIGNAL( completed() ), this, SLOT( reload() ) ); + connect( doc, TQT_SIGNAL( completed() ), this, TQT_SLOT( reload() ) ); } } } @@ -124,7 +124,7 @@ void BookmarksPart::reload() { //kdDebug(0) << "BookmarksPart::reload()" << endl; - QObject * senderobj = const_cast<QObject*>( sender() ); + TQObject * senderobj = const_cast<TQObject*>( sender() ); if ( KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart *>( senderobj ) ) { if ( partIsSane( ro_part ) ) @@ -140,7 +140,7 @@ void BookmarksPart::marksEvent() if ( ! _settingMarks ) { - QObject * senderobj = const_cast<QObject*>( sender() ); + TQObject * senderobj = const_cast<TQObject*>( sender() ); KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart *>( senderobj ); if ( partIsSane( ro_part ) && !_dirtyParts.contains( ro_part ) ) @@ -155,7 +155,7 @@ void BookmarksPart::marksChanged() { //kdDebug(0) << "BookmarksPart::marksChanged()" << endl; - QValueListIterator<KParts::ReadOnlyPart*> it = _dirtyParts.begin(); + TQValueListIterator<KParts::ReadOnlyPart*> it = _dirtyParts.begin(); while ( it != _dirtyParts.end() ) { KParts::ReadOnlyPart * ro_part = *it; @@ -179,31 +179,31 @@ void BookmarksPart::marksChanged() _dirtyParts.clear(); } -void BookmarksPart::restorePartialProjectSession( const QDomElement * el ) +void BookmarksPart::restorePartialProjectSession( const TQDomElement * el ) { //kdDebug(0) << "BookmarksPart::restorePartialProjectSession()" << endl; if ( ! el ) return; - QDomElement bookmarksList = el->namedItem( "bookmarks" ).toElement(); + TQDomElement bookmarksList = el->namedItem( "bookmarks" ).toElement(); if ( bookmarksList.isNull() ) return; - QDomElement bookmark = bookmarksList.firstChild().toElement(); + TQDomElement bookmark = bookmarksList.firstChild().toElement(); while ( ! bookmark.isNull() ) { - QString path = bookmark.attribute( "url" ); - if ( path != QString::null ) + TQString path = bookmark.attribute( "url" ); + if ( path != TQString::null ) { EditorData * data = new EditorData; data->url.setPath( path ); - QDomElement mark = bookmark.firstChild().toElement(); + TQDomElement mark = bookmark.firstChild().toElement(); while ( ! mark.isNull() ) { - QString line = mark.attribute( "line" ); - if ( line != QString::null ) + TQString line = mark.attribute( "line" ); + if ( line != TQString::null ) { - data->marks.append( qMakePair( line.toInt(), QString() ) ); + data->marks.append( qMakePair( line.toInt(), TQString() ) ); } mark = mark.nextSibling().toElement(); } @@ -224,28 +224,28 @@ void BookmarksPart::restorePartialProjectSession( const QDomElement * el ) _widget->update( _editorMap ); } -void BookmarksPart::savePartialProjectSession( QDomElement * el ) +void BookmarksPart::savePartialProjectSession( TQDomElement * el ) { //kdDebug(0) << "BookmarksPart::savePartialProjectSession()" << endl; if ( ! el ) return; - QDomDocument domDoc = el->ownerDocument(); + TQDomDocument domDoc = el->ownerDocument(); if ( domDoc.isNull() ) return; - QDomElement bookmarksList = domDoc.createElement( "bookmarks" ); + TQDomElement bookmarksList = domDoc.createElement( "bookmarks" ); - QDictIterator<EditorData> it( _editorMap ); + TQDictIterator<EditorData> it( _editorMap ); while ( it.current() ) { - QDomElement bookmark = domDoc.createElement( "bookmark" ); + TQDomElement bookmark = domDoc.createElement( "bookmark" ); bookmark.setAttribute( "url", it.current()->url.path() ); bookmarksList.appendChild( bookmark ); - QValueListIterator< QPair<int,QString> > it2 = it.current()->marks.begin(); + TQValueListIterator< QPair<int,TQString> > it2 = it.current()->marks.begin(); while ( it2 != it.current()->marks.end() ) { - QDomElement line = domDoc.createElement( "mark" ); + TQDomElement line = domDoc.createElement( "mark" ); line.setAttribute( "line", (*it2).first ); bookmark.appendChild( line ); ++it2; @@ -275,7 +275,7 @@ void BookmarksPart::removeBookmarkForURL( KURL const & url, int line ) if ( EditorData * data = _editorMap.find( url.path() ) ) { - QValueListIterator< QPair<int,QString> > it = data->marks.begin(); + TQValueListIterator< QPair<int,TQString> > it = data->marks.begin(); while ( it != data->marks.end() ) { if ( (*it).first == line ) @@ -309,7 +309,7 @@ void BookmarksPart::updateContextStringForURL( KParts::ReadOnlyPart * ro_part ) if ( ! ( data && ed ) ) return; - QValueListIterator< QPair<int,QString> > it = data->marks.begin(); + TQValueListIterator< QPair<int,TQString> > it = data->marks.begin(); while ( it != data->marks.end() ) { (*it).second = ed->textLine( (*it).first ); @@ -324,7 +324,7 @@ void BookmarksPart::updateContextStringForURL( KURL const & url ) void BookmarksPart::updateContextStringForAll() { - QDictIterator<EditorData> it( _editorMap ); + TQDictIterator<EditorData> it( _editorMap ); while ( it.current() ) { if ( ! it.current()->marks.isEmpty() ) @@ -347,7 +347,7 @@ bool BookmarksPart::setBookmarksForURL( KParts::ReadOnlyPart * ro_part ) { // we've seen this one before, apply stored bookmarks - QValueListIterator< QPair<int,QString> > it = data->marks.begin(); + TQValueListIterator< QPair<int,TQString> > it = data->marks.begin(); while ( it != data->marks.end() ) { mi->addMark( (*it).first, KTextEditor::MarkInterface::markType01 ); @@ -371,8 +371,8 @@ bool BookmarksPart::clearBookmarksForURL( KParts::ReadOnlyPart * ro_part ) { _settingMarks = true; - QPtrList<KTextEditor::Mark> marks = mi->marks(); - QPtrListIterator<KTextEditor::Mark> it( marks ); + TQPtrList<KTextEditor::Mark> marks = mi->marks(); + TQPtrListIterator<KTextEditor::Mark> it( marks ); while ( it.current() ) { if ( it.current()->type & KTextEditor::MarkInterface::markType01 ) @@ -402,14 +402,14 @@ EditorData * BookmarksPart::storeBookmarksForURL( KParts::ReadOnlyPart * ro_part // removing previous data for this url, if any _editorMap.remove( data->url.path() ); - QPtrList<KTextEditor::Mark> marks = mi->marks(); - QPtrListIterator<KTextEditor::Mark> it( marks ); + TQPtrList<KTextEditor::Mark> marks = mi->marks(); + TQPtrListIterator<KTextEditor::Mark> it( marks ); while ( it.current() ) { if ( it.current()->type & KTextEditor::MarkInterface::markType01 ) { int line = it.current()->line; - data->marks.append( qMakePair( line, QString() ) ); + data->marks.append( qMakePair( line, TQString() ) ); } ++it; } @@ -430,9 +430,9 @@ EditorData * BookmarksPart::storeBookmarksForURL( KParts::ReadOnlyPart * ro_part void BookmarksPart::setBookmarksForAllURLs() { - if( const QPtrList<KParts::Part> * partlist = partController()->parts() ) + if( const TQPtrList<KParts::Part> * partlist = partController()->parts() ) { - QPtrListIterator<KParts::Part> it( *partlist ); + TQPtrListIterator<KParts::Part> it( *partlist ); while ( KParts::Part* part = it.current() ) { if ( KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart *>( part ) ) @@ -446,9 +446,9 @@ void BookmarksPart::setBookmarksForAllURLs() void BookmarksPart::storeBookmarksForAllURLs() { - if( const QPtrList<KParts::Part> * partlist = partController()->parts() ) + if( const TQPtrList<KParts::Part> * partlist = partController()->parts() ) { - QPtrListIterator<KParts::Part> it( *partlist ); + TQPtrListIterator<KParts::Part> it( *partlist ); while ( KParts::Part* part = it.current() ) { if ( KParts::ReadOnlyPart * ro_part = dynamic_cast<KParts::ReadOnlyPart *>( part ) ) @@ -463,7 +463,7 @@ void BookmarksPart::storeBookmarksForAllURLs() // reimplemented from PartController::partForURL to avoid linking KParts::ReadOnlyPart * BookmarksPart::partForURL( KURL const & url ) { - QPtrListIterator<KParts::Part> it( *partController()->parts() ); + TQPtrListIterator<KParts::Part> it( *partController()->parts() ); while( it.current() ) { KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(it.current()); @@ -483,20 +483,20 @@ bool BookmarksPart::partIsSane( KParts::ReadOnlyPart * ro_part ) !ro_part->url().path().isEmpty(); } -void BookmarksPart::insertConfigWidget( const KDialogBase * dlg, QWidget * page, unsigned int pagenumber ) +void BookmarksPart::insertConfigWidget( const KDialogBase * dlg, TQWidget * page, unsigned int pagenumber ) { kdDebug() << k_funcinfo << endl; if ( pagenumber == BOOKMARKSETTINGSPAGE ) { BookmarkSettings * w = new BookmarkSettings( this, page ); - connect( dlg, SIGNAL(okClicked()), w, SLOT(slotAccept()) ); + connect( dlg, TQT_SIGNAL(okClicked()), w, TQT_SLOT(slotAccept()) ); } } //////////////////////////////////////////// -QStringList BookmarksPart::getContextFromStream( QTextStream & istream, unsigned int line, unsigned int context ) +TQStringList BookmarksPart::getContextFromStream( TQTextStream & istream, unsigned int line, unsigned int context ) { kdDebug() << k_funcinfo << endl; @@ -504,10 +504,10 @@ QStringList BookmarksPart::getContextFromStream( QTextStream & istream, unsigned int endline = line + context; int n = 0; - QStringList list; + TQStringList list; while ( !istream.atEnd() ) { - QString templine = istream.readLine(); + TQString templine = istream.readLine(); if ( (n >= startline) && ( n <= endline ) ) { list << templine; @@ -531,31 +531,31 @@ QStringList BookmarksPart::getContextFromStream( QTextStream & istream, unsigned return list; } -QStringList BookmarksPart::getContext( KURL const & url, unsigned int line, unsigned int context ) +TQStringList BookmarksPart::getContext( KURL const & url, unsigned int line, unsigned int context ) { // if the file is open - get the line from the editor buffer if ( KTextEditor::EditInterface * ei = dynamic_cast<KTextEditor::EditInterface*>( partForURL( url ) ) ) { kdDebug() << "the file is open - get the line from the editor buffer" << endl; - QString ibuffer = ei->text(); - QTextStream istream( &ibuffer, IO_ReadOnly ); + TQString ibuffer = ei->text(); + TQTextStream istream( &ibuffer, IO_ReadOnly ); return getContextFromStream( istream, line, context ); } else if ( url.isLocalFile() ) // else the file is not open - get the line from the file on disk { kdDebug() << "the file is not open - get the line from the file on disk" << endl; - QFile file( url.path() ); - QString buffer; + TQFile file( url.path() ); + TQString buffer; if ( file.open( IO_ReadOnly ) ) { - QTextStream istream( &file ); + TQTextStream istream( &file ); return getContextFromStream( istream, line, context ); } } - return QStringList( i18n("Could not find file") ); + return TQStringList( i18n("Could not find file") ); } BookmarksConfig * BookmarksPart::config( ) -- cgit v1.2.1