diff options
Diffstat (limited to 'src/kbibtex_part.cpp')
-rw-r--r-- | src/kbibtex_part.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/kbibtex_part.cpp b/src/kbibtex_part.cpp index 27a40cc..eeee2d2 100644 --- a/src/kbibtex_part.cpp +++ b/src/kbibtex_part.cpp @@ -74,7 +74,7 @@ const TQString inPipeFilename = TQDir::homeDirPath() + "/.kbibtex.in"; 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 ) + : KParts::ReadWritePart( parent, name ), m_defInitCounter( 0 ), m_settingsDlg( NULL ), m_initializationDone( false ), m_inPipe( NULL ) { m_mainWindow = dynamic_cast<TDEMainWindow*>( parent ); if ( m_mainWindow == NULL ) @@ -93,10 +93,10 @@ KBibTeXPart::KBibTeXPart( TQWidget *parentWidget, const char *widgetName, setupActions(); // we are read-write by default - setReadWrite( TRUE ); + setReadWrite( true ); // we are not modified since we haven't done anything yet - setModified( FALSE ); + setModified( false ); // read configuration readSettings(); @@ -149,7 +149,7 @@ bool KBibTeXPart::queryClose() writeSettings(); if ( !isReadWrite() || !isModified() ) - return TRUE; + return true; TQString docName = url().fileName(); if ( docName.isEmpty() ) docName = i18n( "Untitled" ); @@ -173,12 +173,12 @@ bool KBibTeXPart::queryClose() else save(); } - else if ( abortClose ) return FALSE; + else if ( abortClose ) return false; return waitSaveComplete(); case KMessageBox::No : - return TRUE; + return true; default: - return FALSE; + return false; } } @@ -198,7 +198,7 @@ bool KBibTeXPart::closeURL() bool KBibTeXPart::openFile() { - return m_documentWidget->open( m_file, FALSE ); + return m_documentWidget->open( m_file, false ); } /** @@ -206,8 +206,8 @@ bool KBibTeXPart::openFile() */ bool KBibTeXPart::saveFile() { - if ( isReadWrite() == FALSE ) - return FALSE; + if ( isReadWrite() == false ) + return false; if ( !url().isValid() || url().isEmpty() ) return saveAs(); @@ -218,7 +218,7 @@ bool KBibTeXPart::saveFile() settings->createBackup( url(), widget() ); KTempFile tempBibFile = KTempFile( locateLocal( "tmp", "bibsave" ) ); - tempBibFile.setAutoDelete( TRUE ); + tempBibFile.setAutoDelete( true ); bool success = m_documentWidget->save( tempBibFile.file() ); tempBibFile.close(); if ( success ) @@ -244,7 +244,7 @@ void KBibTeXPart::slotFileSaveAs() bool KBibTeXPart::saveAs() { - bool result = FALSE; + bool result = false; KBibTeX::Settings * settings = KBibTeX::Settings::self( NULL ); TQString startDir = ! url().isEmpty() ? url().url() : TQDir::currentDirPath(); @@ -253,13 +253,13 @@ bool KBibTeXPart::saveAs() if ( saveURL.isValid() && !saveURL.isEmpty() ) { - if ( TDEIO::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 ) + if ( TDEIO::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 ) ) { emit signalAddRecentURL( saveURL ); - result = TRUE; + result = true; } } @@ -274,7 +274,7 @@ void KBibTeXPart::slotFileExport() if ( exportURL.isValid() && !exportURL.isEmpty() ) { - if ( TDEIO::NetAccess::exists( exportURL, FALSE, widget() ) ) + if ( TDEIO::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() ), TQString::null, i18n( "Overwrite" ) ) != KMessageBox::Continue ) return ; @@ -285,21 +285,21 @@ void KBibTeXPart::slotFileExport() } KTempFile tempBibFile = KTempFile( locateLocal( "tmp", "bibexport" ) ); - tempBibFile.setAutoDelete( TRUE ); + tempBibFile.setAutoDelete( true ); BibTeX::File::FileFormat format = BibTeX::File::formatBibTeX; - if ( exportURL.fileName().endsWith( ".rtf", FALSE ) ) + if ( exportURL.fileName().endsWith( ".rtf", false ) ) format = BibTeX::File::formatRTF; - else if ( exportURL.fileName().endsWith( ".pdf", FALSE ) ) + else if ( exportURL.fileName().endsWith( ".pdf", false ) ) format = BibTeX::File::formatPDF; - else if ( exportURL.fileName().endsWith( ".ps", FALSE ) ) + else if ( exportURL.fileName().endsWith( ".ps", false ) ) format = BibTeX::File::formatPS; - else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( exportURL.fileName().endsWith( ".ref", FALSE ) || exportURL.fileName().endsWith( ".refer", FALSE ) || exportURL.fileName().endsWith( ".txt", FALSE ) || exportURL.fileName().endsWith( ".rfr", FALSE ) ) ) + else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( exportURL.fileName().endsWith( ".ref", false ) || exportURL.fileName().endsWith( ".refer", false ) || exportURL.fileName().endsWith( ".txt", false ) || exportURL.fileName().endsWith( ".rfr", false ) ) ) format = BibTeX::File::formatEndNote; - else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( exportURL.fileName().endsWith( ".isi", FALSE ) || exportURL.fileName().endsWith( ".cgi", FALSE ) ) ) + else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( exportURL.fileName().endsWith( ".isi", false ) || exportURL.fileName().endsWith( ".cgi", false ) ) ) format = BibTeX::File::formatISI; - else if ( exportURL.fileName().endsWith( ".ris", FALSE ) ) + else if ( exportURL.fileName().endsWith( ".ris", false ) ) format = BibTeX::File::formatRIS; - else if ( exportURL.fileName().endsWith( ".xml", FALSE ) ) + else if ( exportURL.fileName().endsWith( ".xml", false ) ) { TQStringList options = TQStringList::split( '|', ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable ? "DocBook5|MODS|internal XML" : "DocBook5|internal XML" ) ); bool ok = false; @@ -311,7 +311,7 @@ void KBibTeXPart::slotFileExport() else if ( ok && !answer.isNull() && answer == "internal XML" ) format = BibTeX::File::formatXML; } - else if ( exportURL.fileName().endsWith( ".html", FALSE ) ) + else if ( exportURL.fileName().endsWith( ".html", false ) ) format = BibTeX::File::formatHTML; else { @@ -334,7 +334,7 @@ void KBibTeXPart::slotFileExport() if ( !error ) { tempBibFile.close(); - error = !TDEIO::NetAccess::file_copy( KURL( tempBibFile.name() ), exportURL, -1, TRUE, FALSE, widget() ); + error = !TDEIO::NetAccess::file_copy( KURL( tempBibFile.name() ), exportURL, -1, true, false, widget() ); } if ( error ) @@ -378,18 +378,18 @@ void KBibTeXPart::slotFileMerge() return; extension = extension.mid( extPos ); - if ( !TDEIO::NetAccess::exists( mergeURL, TRUE, widget() ) ) + if ( !TDEIO::NetAccess::exists( mergeURL, true, widget() ) ) { KMessageBox::error( widget(), i18n( "The given file could not be read, check if it exists or if it is readable for the current user." ) ); return ; } KTempFile tempBibFile = KTempFile( locateLocal( "tmp", "bibmerge" ), extension ); - tempBibFile.setAutoDelete( TRUE ); - bool error = !TDEIO::NetAccess::file_copy( mergeURL, KURL( tempBibFile.name() ), -1, TRUE, FALSE, widget() ); + tempBibFile.setAutoDelete( true ); + bool error = !TDEIO::NetAccess::file_copy( mergeURL, KURL( tempBibFile.name() ), -1, true, false, widget() ); if ( !error ) - error = !m_documentWidget->open( tempBibFile.name(), TRUE ); + error = !m_documentWidget->open( tempBibFile.name(), true ); tempBibFile.close(); @@ -399,7 +399,7 @@ void KBibTeXPart::slotFileMerge() return; } else - setModified( TRUE ); + setModified( true ); } void KBibTeXPart::slotPreferences() @@ -436,28 +436,28 @@ void KBibTeXPart::setupActions() m_actionEditCut = KStdAction::cut( m_documentWidget, TQ_SLOT( cutElements() ), actionCollection() ); m_actionEditCut->setToolTip( i18n( "Cut the selected BibTeX elements to the clipboard" ) ); - m_actionEditCut->setEnabled( FALSE ); + m_actionEditCut->setEnabled( false ); m_actionEditCopy = KStdAction::copy( m_documentWidget, TQ_SLOT( copyElements() ), actionCollection() ); m_actionEditCopy->setToolTip( i18n( "Copy the selected BibTeX elements to the clipboard" ) ); - m_actionEditCopy->setEnabled( FALSE ); + m_actionEditCopy->setEnabled( false ); m_actionEditUndo = KStdAction::undo( m_documentWidget, TQ_SLOT( undoEditor() ), actionCollection() ); connect( m_documentWidget, TQ_SIGNAL( undoChanged( bool ) ), this, TQ_SLOT( slotUndoChanged( bool ) ) ); m_actionEditCopyRef = new TDEAction( i18n( "Copy &Reference" ), CTRL + SHIFT + Key_C, m_documentWidget, TQ_SLOT( copyRefElements() ), actionCollection(), "edit_copyref" ); m_actionEditCopyRef->setToolTip( i18n( "Copy a reference of the selected BibTeX elements to the clipboard" ) ); - m_actionEditCopyRef->setEnabled( FALSE ); + m_actionEditCopyRef->setEnabled( false ); m_actionEditPaste = KStdAction::paste( m_documentWidget, TQ_SLOT( pasteElements() ), actionCollection() ); m_actionEditPaste->setToolTip( i18n( "Paste BibTeX elements from the clipboard" ) ); m_actionEditSelectAll = KStdAction::selectAll( m_documentWidget, TQ_SLOT( selectAll() ), actionCollection() ); m_actionEditSelectAll->setToolTip( i18n( "Select all BibTeX elements" ) ); m_actionElementSendToLyX = new TDEAction( i18n( "Send Reference to &LyX" ), CTRL + SHIFT + Key_L, m_documentWidget, TQ_SLOT( sendSelectedToLyx() ), actionCollection(), "element_sendtolyx" ); m_actionElementSendToLyX->setToolTip( i18n( "Send a reference of the selected BibTeX elements to LyX" ) ); - m_actionElementSendToLyX->setEnabled( FALSE ); + m_actionElementSendToLyX->setEnabled( false ); m_actionEditFind = KStdAction::find( m_documentWidget, TQ_SLOT( find() ), actionCollection() ); m_actionEditFind->setToolTip( i18n( "Find text" ) ); m_actionEditFindNext = KStdAction::findNext( m_documentWidget, TQ_SLOT( findNext() ), actionCollection() ); m_actionEditFindNext->setToolTip( i18n( "Find next occurrence" ) ); - m_actionEditFind->setEnabled( FALSE ); - m_actionEditFindNext->setEnabled( FALSE ); + m_actionEditFind->setEnabled( false ); + m_actionEditFindNext->setEnabled( false ); m_actionSearchOnlineDatabases = new TDEAction( i18n( "Search Online Databases" ), SmallIconSet( "network" ), CTRL + SHIFT + Key_S, m_documentWidget, TQ_SLOT( onlineSearch() ), actionCollection(), "search_onlinedatabases" ); m_actionSearchOnlineDatabases->setToolTip( i18n( "Search online databases to import bibliography data" ) ); @@ -465,23 +465,23 @@ void KBibTeXPart::setupActions() m_actionMenuSearchWebsites = new TDEActionMenu( i18n( "Search Document Online" ), actionCollection(), "search_document_online" ); m_actionMenuSearchWebsites->setToolTip( i18n( "Search websites for the selected BibTeX element" ) ); connect( m_actionMenuSearchWebsites->popupMenu(), TQ_SIGNAL( activated( int ) ), this, TQ_SLOT( slotSearchWebsites( int ) ) ); - m_actionMenuSearchWebsites->setEnabled( FALSE ); + m_actionMenuSearchWebsites->setEnabled( false ); m_actionViewShowColumns = new TDEActionMenu( i18n( "&Show Columns" ), actionCollection(), "view_showcolumns" ); m_actionViewShowColumns->setToolTip( i18n( "Select columns to show in the main list" ) ); m_actionViewDocument = new TDEActionMenu( i18n( "View Document" ), actionCollection(), "view_document" ); m_actionViewDocument->setToolTip( i18n( "View the documents associated with this BibTeX entry" ) ); - m_actionViewDocument->setEnabled( FALSE ); + m_actionViewDocument->setEnabled( false ); m_actionViewFirstDocument = new TDEAction( i18n( "View Primary Document" ), 0, m_documentWidget, TQ_SLOT( slotViewFirstDocument() ), actionCollection(), "view_first_document" ); m_actionViewFirstDocument->setShortcut( TQt::Key_F4 ); m_actionViewDocumentOnlineRef = new TDEAction( i18n( "View Primary Online Reference" ), 0, m_documentWidget, TQ_SLOT( slotViewFirstDocumentsOnlineRef() ), actionCollection(), "view_first_documents_online_ref" ); m_actionViewDocumentOnlineRef->setShortcut( TQt::Key_F5 ); m_actionAssignKeywords = new TDEActionMenu( i18n( "Assign Keywords" ), actionCollection(), "assign_keywords" ); m_actionAssignKeywords->setToolTip( i18n( "Assign keywords to this entry" ) ); - m_actionAssignKeywords->setEnabled( FALSE ); + m_actionAssignKeywords->setEnabled( false ); m_actionNormalizeIds = new TDEAction( i18n( "Normalize Entry Ids" ), 0, m_documentWidget, TQ_SLOT( slotNormalizeIds() ), actionCollection( ), "normalize_ids" ); m_actionNormalizeIds->setToolTip( i18n( "Set entry ids as specified in the id suggestion settings" ) ); - m_actionNormalizeIds->setEnabled( FALSE ); + m_actionNormalizeIds->setEnabled( false ); m_actionPreferences = KStdAction::preferences( this, TQ_SLOT( slotPreferences() ), actionCollection() ); m_actionPreferences->setToolTip( i18n( "Configure KBibTeX" ) ); @@ -508,10 +508,10 @@ void KBibTeXPart::setupActions() m_actionEditElement = new TDEAction( i18n( "&Edit" ), 0, m_documentWidget, TQ_SLOT( editElement() ), actionCollection(), "element_edit" ); m_actionEditElement->setToolTip( i18n( "Edit the selected BibTeX element" ) ); - m_actionEditElement->setEnabled( FALSE ); + m_actionEditElement->setEnabled( false ); m_actionDeleteElement = new TDEAction( i18n( "&Delete" ), 0, m_documentWidget, TQ_SLOT( deleteElements() ), actionCollection(), "element_delete" ); m_actionDeleteElement->setToolTip( i18n( "Delete the selected BibTeX elements" ) ); - m_actionDeleteElement->setEnabled( FALSE ); + m_actionDeleteElement->setEnabled( false ); m_actionShowComments = new TDEToggleAction( i18n( "Show &Comments" ), 0, this, TQ_SLOT( slotToggleShowSpecialElements() ), actionCollection(), "view_showcomments" ); m_actionShowComments->setToolTip( i18n( "Show the comments of a BibTeX document" ) ); @@ -536,7 +536,7 @@ void KBibTeXPart::setupActions() TDEActionMenu *acmElementNew = new TDEActionMenu( i18n( "&New" ), TQIconSet( SmallIcon( "document-new" ) ), actionCollection(), "element_new" ); acmElementNew->setToolTip( i18n( "Add a new element to this BibTeX document" ) ); - acmElementNew->setEnabled( FALSE ); + acmElementNew->setEnabled( false ); } bool KBibTeXPart::slotNewElement() @@ -554,15 +554,15 @@ bool KBibTeXPart::slotNewElement() else if ( strcmp( sender() ->name(), "element_new_preamble" ) == 0 ) elementType = "preamble"; else - return FALSE; + return false; bool result = m_documentWidget->newElement( elementType ); if ( result ) - setModified( TRUE ); + setModified( true ); return result; } - return FALSE; + return false; } void KBibTeXPart::readSettings() @@ -684,7 +684,7 @@ void KBibTeXPart::slotDeferredInitialization() { m_documentWidget->setFactory( factory(), this ); m_documentWidget->deferredInitialization(); - m_initializationDone = TRUE; + m_initializationDone = true; } else { |