diff options
author | Slávek Banko <[email protected]> | 2013-06-29 12:56:53 +0200 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2013-07-04 03:11:35 +0200 |
commit | 5f5e7c5455d52826b0bd50f64fcffb7695ce970d (patch) | |
tree | c8ee8792d3fb139365abbf70c2255f1e69d2aa34 /src/kbibtex_part.cpp | |
parent | 251c9a439759c830d34c70683d0fc9454d703010 (diff) | |
download | kbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.tar.gz kbibtex-5f5e7c5455d52826b0bd50f64fcffb7695ce970d.zip |
Initial TQt conversion
Diffstat (limited to 'src/kbibtex_part.cpp')
-rw-r--r-- | src/kbibtex_part.cpp | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/src/kbibtex_part.cpp b/src/kbibtex_part.cpp index 3a5f16a..eaf72b8 100644 --- a/src/kbibtex_part.cpp +++ b/src/kbibtex_part.cpp @@ -20,18 +20,18 @@ #include <string> #include <fcntl.h> -#include <qstring.h> -#include <qsplitter.h> -#include <qtimer.h> -#include <qvaluelist.h> -#include <qlayout.h> -#include <qlineedit.h> -#include <qbuffer.h> -#include <qtoolbutton.h> -#include <qtabwidget.h> -#include <qlabel.h> -#include <qtextedit.h> -#include <qclipboard.h> +#include <ntqstring.h> +#include <ntqsplitter.h> +#include <ntqtimer.h> +#include <ntqvaluelist.h> +#include <ntqlayout.h> +#include <ntqlineedit.h> +#include <ntqbuffer.h> +#include <ntqtoolbutton.h> +#include <ntqtabwidget.h> +#include <ntqlabel.h> +#include <ntqtextedit.h> +#include <ntqclipboard.h> #include <kinstance.h> #include <kaction.h> #include <kstdaction.h> @@ -70,10 +70,10 @@ #include <encoderlatex.h> #include "kbibtex_part.h" -const QString inPipeFilename = QDir::homeDirPath() + "/.kbibtex.in"; +const TQString inPipeFilename = TQDir::homeDirPath() + "/.kbibtex.in"; -KBibTeXPart::KBibTeXPart( QWidget *parentWidget, const char *widgetName, - QObject *parent, const char *name ) +KBibTeXPart::KBibTeXPart( TQWidget *parentWidget, const char *widgetName, + TQObject *parent, const char *name ) : KParts::ReadWritePart( parent, name ), m_defInitCounter( 0 ), m_settingsDlg( NULL ), m_initializationDone( FALSE ), m_inPipe( NULL ) { m_mainWindow = dynamic_cast<KMainWindow*>( parent ); @@ -101,7 +101,7 @@ KBibTeXPart::KBibTeXPart( QWidget *parentWidget, const char *widgetName, // read configuration readSettings(); - QTimer::singleShot( 100, this, SLOT( slotDeferredInitialization() ) ); + TQTimer::singleShot( 100, this, SLOT( slotDeferredInitialization() ) ); } KBibTeXPart::~KBibTeXPart() @@ -151,7 +151,7 @@ bool KBibTeXPart::queryClose() if ( !isReadWrite() || !isModified() ) return TRUE; - QString docName = url().fileName(); + TQString docName = url().fileName(); if ( docName.isEmpty() ) docName = i18n( "Untitled" ); int res = KMessageBox::warningYesNoCancel( widget(), @@ -223,9 +223,9 @@ bool KBibTeXPart::saveFile() tempBibFile.close(); if ( success ) { - QString usedFileName = m_file; - QFileInfo fi( usedFileName ); - if ( !fi.readLink().isNull() && KMessageBox::questionYesNo( widget(), QString( i18n( "The selected filename \"%1\" is a symbolic link pointing to \"%2\".\nReplace the link with a new file or overwrite the existing file the link points to?" ) ).arg( usedFileName ).arg(KBibTeX::Settings::resolveLink( m_file, fi.readLink() ) ), i18n( "Symbolic Link" ), KGuiItem( i18n( "Replace link" ) ), KGuiItem( i18n( "Overwrite file the link points to" ) ) ) == KMessageBox::No ) + TQString usedFileName = m_file; + TQFileInfo fi( usedFileName ); + if ( !fi.readLink().isNull() && KMessageBox::questionYesNo( widget(), TQString( i18n( "The selected filename \"%1\" is a symbolic link pointing to \"%2\".\nReplace the link with a new file or overwrite the existing file the link points to?" ) ).arg( usedFileName ).arg(KBibTeX::Settings::resolveLink( m_file, fi.readLink() ) ), i18n( "Symbolic Link" ), KGuiItem( i18n( "Replace link" ) ), KGuiItem( i18n( "Overwrite file the link points to" ) ) ) == KMessageBox::No ) usedFileName = KBibTeX::Settings::resolveLink( m_file, fi.readLink() ); m_documentWidget->dirWatch().stopScan(); @@ -247,13 +247,13 @@ bool KBibTeXPart::saveAs() bool result = FALSE; KBibTeX::Settings * settings = KBibTeX::Settings::self( NULL ); - QString startDir = ! url().isEmpty() ? url().url() : QDir::currentDirPath(); + TQString startDir = ! url().isEmpty() ? url().url() : TQDir::currentDirPath(); KURL saveURL = KFileDialog::getSaveURL( startDir, "*.bib|" + i18n( "BibTeX (*.bib)" ) + "\n*.ris|" + i18n( "Reference Manager (*.ris)" ) + ( settings->external_xml2bibAvailable ? "\n*.ref *.refer *.rfr *.txt|" + i18n( "EndNote (Refer format) (*.ref *.refer *.rfr *.txt)" ) + "\n*.isi *.cgi|" + i18n( "ISI Web of Knowledge (*.isi *.cgi)" ) : "" ) + "\n*.xml|" + ( settings->external_xml2bibAvailable ? i18n( "DocBook 5 or MODS (*.xml)" ) : i18n( "DocBook 5 (*.xml)" ) ), widget() ); if ( saveURL.isValid() && !saveURL.isEmpty() ) { - if ( KIO::NetAccess::exists( saveURL, FALSE, widget() ) && KMessageBox::warningContinueCancel( widget(), i18n( "A file named '%1' already exists. Are you sure you want to overwrite it?" ).arg( saveURL.filename() ), QString::null, i18n( "Overwrite" ) ) != KMessageBox::Continue ) + if ( KIO::NetAccess::exists( saveURL, FALSE, widget() ) && KMessageBox::warningContinueCancel( widget(), i18n( "A file named '%1' already exists. Are you sure you want to overwrite it?" ).arg( saveURL.filename() ), TQString::null, i18n( "Overwrite" ) ) != KMessageBox::Continue ) return result; if ( ReadWritePart::saveAs( saveURL ) ) @@ -269,14 +269,14 @@ bool KBibTeXPart::saveAs() void KBibTeXPart::slotFileExport() { KBibTeX::Settings * settings = KBibTeX::Settings::self( NULL ); - QString startDir = ! url().isEmpty() ? url().url() : QDir::currentDirPath(); + TQString startDir = ! url().isEmpty() ? url().url() : TQDir::currentDirPath(); KURL exportURL = KFileDialog::getSaveURL( startDir, "*.pdf|" + i18n( "Portable Document File (*.pdf)" ) + "\n*.ps|" + i18n( "PostScript (*.ps)" ) + "\n*.ris|" + i18n( "Reference Manager (*.ris)" ) + ( settings->external_xml2bibAvailable ? "\n*.ref *.refer *.rfr *.txt|" + i18n( "EndNote (Refer format) (*.ref *.refer *.rfr *.txt)" ) + "\n*.isi *.cgi|" + i18n( "ISI Web of Knowledge (*.isi *.cgi)" ) : "" ) + "\n*.xml|" + ( settings->external_xml2bibAvailable ? i18n( "DocBook 5 or MODS (*.xml)" ) : i18n( "DocBook 5 (*.xml)" ) ) + "\n*.html|" + i18n( "Hypertext Markup Langage (*.html)" ) + "\n*.rtf|" + i18n( "Rich Text Format (*.rtf)" ), widget() ); if ( exportURL.isValid() && !exportURL.isEmpty() ) { if ( KIO::NetAccess::exists( exportURL, FALSE, widget() ) ) { - if ( KMessageBox::warningContinueCancel( widget(), i18n( "A file named '%1' already exists. Are you sure you want to overwrite it?" ).arg( exportURL.filename() ), QString::null, i18n( "Overwrite" ) ) != KMessageBox::Continue ) + if ( KMessageBox::warningContinueCancel( widget(), i18n( "A file named '%1' already exists. Are you sure you want to overwrite it?" ).arg( exportURL.filename() ), TQString::null, i18n( "Overwrite" ) ) != KMessageBox::Continue ) return ; /** make backup if defined by the user */ @@ -301,9 +301,9 @@ void KBibTeXPart::slotFileExport() format = BibTeX::File::formatRIS; else if ( exportURL.fileName().endsWith( ".xml", FALSE ) ) { - QStringList options = QStringList::split( '|', ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable ? "DocBook5|MODS|internal XML" : "DocBook5|internal XML" ) ); + TQStringList options = TQStringList::split( '|', ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable ? "DocBook5|MODS|internal XML" : "DocBook5|internal XML" ) ); bool ok = false; - QString answer = KInputDialog::getItem( i18n( "Choose file format" ), QString( i18n( "Choose file format of file '%1':" ) ).arg( exportURL.fileName() ), options, 0, false, &ok, widget() ); + TQString answer = KInputDialog::getItem( i18n( "Choose file format" ), TQString( i18n( "Choose file format of file '%1':" ) ).arg( exportURL.fileName() ), options, 0, false, &ok, widget() ); if ( ok && !answer.isNull() && answer == "DocBook5" ) format = BibTeX::File::formatDocBook5; else if ( ok && !answer.isNull() && answer == "MODS" ) @@ -315,9 +315,9 @@ void KBibTeXPart::slotFileExport() format = BibTeX::File::formatHTML; else { - QStringList options = QStringList::split( '|', ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable ? "BibTeX|EndNote|ISI|RIS" : "BibTeX|RIS" ) ); + TQStringList options = TQStringList::split( '|', ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable ? "BibTeX|EndNote|ISI|RIS" : "BibTeX|RIS" ) ); bool ok = false; - QString answer = KInputDialog::getItem( i18n( "Choose file format" ), QString( i18n( "Choose file format of file '%1':" ) ).arg( exportURL.fileName() ), options, 0, false, &ok, widget() ); + TQString answer = KInputDialog::getItem( i18n( "Choose file format" ), TQString( i18n( "Choose file format of file '%1':" ) ).arg( exportURL.fileName() ), options, 0, false, &ok, widget() ); if ( ok && !answer.isNull() && answer == "BibTeX" ) format = BibTeX::File::formatBibTeX; else if ( ok && !answer.isNull() && answer == "EndNote" ) @@ -328,7 +328,7 @@ void KBibTeXPart::slotFileExport() format = BibTeX::File::formatRIS; } - QStringList errorLog; + TQStringList errorLog; bool error = !m_documentWidget->save( tempBibFile.file(), format, i18n( "Exporting" ), &errorLog ) ; if ( !error ) @@ -341,10 +341,10 @@ void KBibTeXPart::slotFileExport() { #if (KDE_VERSION_MINOR>=4) && (KDE_VERSION_MAJOR>=3) if ( !errorLog.empty() ) - KMessageBox::errorList( widget(), QString( i18n( "File could not be exported in '%1'." ) ).arg( exportURL.prettyURL() ).append( i18n( "\n\nSee the following error log for details." ) ), errorLog, i18n( "Exporting failed" ) ); + KMessageBox::errorList( widget(), TQString( i18n( "File could not be exported in '%1'." ) ).arg( exportURL.prettyURL() ).append( i18n( "\n\nSee the following error log for details." ) ), errorLog, i18n( "Exporting failed" ) ); else #endif - KMessageBox::error( widget(), QString( i18n( "File could not be exported to '%1'." ) ).arg( exportURL.prettyURL() ), i18n( "Exporting failed" ) ); + KMessageBox::error( widget(), TQString( i18n( "File could not be exported to '%1'." ) ).arg( exportURL.prettyURL() ), i18n( "Exporting failed" ) ); } } @@ -364,15 +364,15 @@ void KBibTeXPart::slotFileFindDups() void KBibTeXPart::slotFileMerge() { KBibTeX::Settings * settings = KBibTeX::Settings::self( NULL ); - QString startDir = ! url().isEmpty() ? url().url() : QDir::currentDirPath(); - KURL mergeURL = KFileDialog::getOpenURL( startDir, QString( "*.bib *.ris" ) + + TQString startDir = ! url().isEmpty() ? url().url() : TQDir::currentDirPath(); + KURL mergeURL = KFileDialog::getOpenURL( startDir, TQString( "*.bib *.ris" ) + ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable ? " *.xml *.ref *.refer *.rfr *.txt *.isi *.cgi" : "" ) + "|" + i18n( "Supported Bibliographies" ) + "\n*.bib|" + i18n( "BibTeX (*.bib)" ) + "\n*.ris|" + i18n( "Reference Manager (*.ris)" ) + ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable ? "\n*.ref *.refer *.rfr *.txt|" + i18n( "EndNote (Refer format) (*.ref *.refer *.rfr *.txt)" ) + "\n*.isi *.cgi|" + i18n( "ISI Web of Knowledge (*.isi *.cgi)" ) + "\n*.xml|" + i18n( "MODS or EndNote XML (*.xml)" ) : "" ) + "\n*|" + i18n( "All files (*.*)" ) , widget() ); if ( !mergeURL.isValid() || mergeURL.isEmpty() ) return; - QString extension = mergeURL.fileName(); + TQString extension = mergeURL.fileName(); int extPos = extension.find( '.' ); if ( extPos < 0 ) return; @@ -408,11 +408,11 @@ void KBibTeXPart::slotPreferences() m_settingsDlg = new KBibTeX::SettingsDlg( widget(), "settings_dlg" ); m_documentWidget->saveState(); - if ( m_settingsDlg->exec() == QDialog::Accepted ) + if ( m_settingsDlg->exec() == TQDialog::Accepted ) m_documentWidget->restoreState(); } -void KBibTeXPart::setupGUI( QWidget *parentWidget, const char *name ) +void KBibTeXPart::setupGUI( TQWidget *parentWidget, const char *name ) { m_documentWidget = new KBibTeX::DocumentWidget( !isReadWrite(), parentWidget, name ); @@ -473,9 +473,9 @@ void KBibTeXPart::setupActions() m_actionViewDocument->setToolTip( i18n( "View the documents associated with this BibTeX entry" ) ); m_actionViewDocument->setEnabled( FALSE ); m_actionViewFirstDocument = new KAction( i18n( "View Primary Document" ), 0, m_documentWidget, SLOT( slotViewFirstDocument() ), actionCollection(), "view_first_document" ); - m_actionViewFirstDocument->setShortcut( Qt::Key_F4 ); + m_actionViewFirstDocument->setShortcut( TQt::Key_F4 ); m_actionViewDocumentOnlineRef = new KAction( i18n( "View Primary Online Reference" ), 0, m_documentWidget, SLOT( slotViewFirstDocumentsOnlineRef() ), actionCollection(), "view_first_documents_online_ref" ); - m_actionViewDocumentOnlineRef->setShortcut( Qt::Key_F5 ); + m_actionViewDocumentOnlineRef->setShortcut( TQt::Key_F5 ); m_actionAssignKeywords = new KActionMenu( i18n( "Assign Keywords" ), actionCollection(), "assign_keywords" ); m_actionAssignKeywords->setToolTip( i18n( "Assign keywords to this entry" ) ); m_actionAssignKeywords->setEnabled( FALSE ); @@ -527,14 +527,14 @@ void KBibTeXPart::setupActions() KStatusBar * statusBar = m_mainWindow->statusBar(); if ( statusBar != NULL ) { - connect( actionCollection(), SIGNAL( actionStatusText( const QString & ) ), statusBar, SLOT( message( const QString & ) ) ); + connect( actionCollection(), SIGNAL( actionStatusText( const TQString & ) ), statusBar, SLOT( message( const TQString & ) ) ); connect( actionCollection(), SIGNAL( clearStatusText() ), statusBar, SLOT( clear() ) ); } } actionCollection() ->setHighlightingEnabled( true ); - KActionMenu *acmElementNew = new KActionMenu( i18n( "&New" ), QIconSet( SmallIcon( "filenew" ) ), actionCollection(), "element_new" ); + KActionMenu *acmElementNew = new KActionMenu( i18n( "&New" ), TQIconSet( SmallIcon( "filenew" ) ), actionCollection(), "element_new" ); acmElementNew->setToolTip( i18n( "Add a new element to this BibTeX document" ) ); acmElementNew->setEnabled( FALSE ); } @@ -543,10 +543,10 @@ bool KBibTeXPart::slotNewElement() { if ( isReadWrite() && sender() ) { - QString elementType; + TQString elementType; if ( strncmp( sender() ->name(), "element_new_entry_", 18 ) == 0 ) - elementType = QString( sender() ->name() + 18 ); + elementType = TQString( sender() ->name() + 18 ); else if ( strcmp( sender() ->name(), "element_new_comment" ) == 0 ) elementType = "comment"; else if ( strcmp( sender() ->name(), "element_new_macro" ) == 0 ) @@ -617,9 +617,9 @@ void KBibTeXPart::slotUndoChanged( bool undoAvailable ) void KBibTeXPart::slotUseInPipe() { - if ( m_inPipe == NULL && QFile::exists( inPipeFilename ) ) + if ( m_inPipe == NULL && TQFile::exists( inPipeFilename ) ) { - KMessageBox::error( widget(), QString( i18n( "Some other KBibTeX instance is using the pipe.\nIf this assumption is wrong, please delete '%1'." ) ).arg( inPipeFilename ), i18n( "Pipe already in use" ) ); + KMessageBox::error( widget(), TQString( i18n( "Some other KBibTeX instance is using the pipe.\nIf this assumption is wrong, please delete '%1'." ) ).arg( inPipeFilename ), i18n( "Pipe already in use" ) ); } else { @@ -630,25 +630,25 @@ void KBibTeXPart::slotUseInPipe() m_inPipe->remove(); delete m_inPipe; m_inPipe = NULL; - QFile::remove( inPipeFilename ); + TQFile::remove( inPipeFilename ); } else { // create pipe if ( ::mkfifo( inPipeFilename.latin1(), 0600 ) == 0 ) { - m_inPipe = new QFile( inPipeFilename ); + m_inPipe = new TQFile( inPipeFilename ); if ( !m_inPipe->open( IO_ReadOnly ) || fcntl( m_inPipe->handle(), F_SETFL, O_NONBLOCK ) < 0 ) { m_inPipe->close(); m_inPipe = NULL; } if ( m_inPipe == NULL ) - QFile::remove( inPipeFilename ); + TQFile::remove( inPipeFilename ); } if ( m_inPipe == NULL ) - KMessageBox::error( widget(), QString( i18n( "Could not create pipe at '%1'." ) ).arg( inPipeFilename ), i18n( "Error creating pipe" ) ); + KMessageBox::error( widget(), TQString( i18n( "Could not create pipe at '%1'." ) ).arg( inPipeFilename ), i18n( "Error creating pipe" ) ); } } @@ -695,7 +695,7 @@ void KBibTeXPart::slotDeferredInitialization() KMessageBox::sorry( widget(), i18n( "The KBibTeX part has problems to initialize itself. Only limited functionality will be available." ), i18n( "KBibTeX Part" ) ); return ; } - QTimer::singleShot( 250, this, SLOT( slotDeferredInitialization() ) ); + TQTimer::singleShot( 250, this, SLOT( slotDeferredInitialization() ) ); } } @@ -721,15 +721,15 @@ KBibTeXPartFactory::~KBibTeXPartFactory() s_instance = 0L; } -KParts::Part* KBibTeXPartFactory::createPartObject( QWidget *parentWidget, const char *widgetName, - QObject *parent, const char *name, - const char *classname, const QStringList & /* args */ ) +KParts::Part* KBibTeXPartFactory::createPartObject( TQWidget *parentWidget, const char *widgetName, + TQObject *parent, const char *name, + const char *classname, const TQStringList & /* args */ ) { // Create an instance of our Part KBibTeXPart * obj = new KBibTeXPart( parentWidget, widgetName, parent, name ); // See if we are to be read-write or not - if ( QCString( classname ) == "KParts::ReadOnlyPart" ) + if ( TQCString( classname ) == "KParts::ReadOnlyPart" ) obj->setReadWrite( false ); return obj; |