diff options
Diffstat (limited to 'src/documentwidget.cpp')
-rw-r--r-- | src/documentwidget.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/src/documentwidget.cpp b/src/documentwidget.cpp index fa99d89..0dc35b7 100644 --- a/src/documentwidget.cpp +++ b/src/documentwidget.cpp @@ -110,7 +110,7 @@ namespace KBibTeX void DocumentWidget::setupGUI() { - setAcceptDrops( TRUE ); + setAcceptDrops( true ); setFocusPolicy( TQWidget::ClickFocus ); // List view tab widget =============================== @@ -133,7 +133,7 @@ namespace KBibTeX m_listViewElements = new DocumentListView( this, m_isReadOnly, m_vertSplitter ); m_preview = new KTextEdit( m_vertSplitter ); - m_preview->setReadOnly( TRUE ); + m_preview->setReadOnly( true ); m_preview->setAlignment( TQt::AlignTop && TQt::AlignLeft ); // Source view tab widget ============================= @@ -161,7 +161,7 @@ namespace KBibTeX bool DocumentWidget::open( const TQString &fileName, bool mergeOnly ) { - bool result = FALSE; + bool result = false; if ( !mergeOnly ) m_dirWatch.removeFile( m_filename ); @@ -194,8 +194,8 @@ namespace KBibTeX bool DocumentWidget::open( TQIODevice *iodevice, bool mergeOnly, const TQString &label, BibTeX::FileImporter *importer ) { - bool result = FALSE; - setEnabled( FALSE ); + bool result = false; + setEnabled( false ); bool usingDefaultImporter = importer == NULL; if ( usingDefaultImporter ) @@ -241,40 +241,40 @@ namespace KBibTeX settings->addToCompletion( m_bibtexfile ); m_sideBar->refreshLists( m_bibtexfile ); - result = TRUE; + result = true; } else { kdDebug() << "Could not load bibliography file from io device" << endl; - result = FALSE; + result = false; } - setEnabled( TRUE ); + setEnabled( true ); return result; } bool DocumentWidget::save( const TQString &fileName, TQStringList *errorLog ) { - bool result = FALSE; + bool result = false; m_dirWatch.removeFile( m_filename ); Settings * settings = Settings::self( NULL ); BibTeX::File::FileFormat format = BibTeX::File::formatUndefined; - if ( fileName.endsWith( ".rtf", FALSE ) ) + if ( fileName.endsWith( ".rtf", false ) ) format = BibTeX::File::formatRTF; - else if ( fileName.endsWith( ".pdf", FALSE ) ) + else if ( fileName.endsWith( ".pdf", false ) ) format = BibTeX::File::formatPDF; - else if ( fileName.endsWith( ".bib", FALSE ) ) + else if ( fileName.endsWith( ".bib", false ) ) format = BibTeX::File::formatBibTeX; - else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( fileName.endsWith( ".ref", FALSE ) || fileName.endsWith( ".refer", FALSE ) || fileName.endsWith( ".txt", FALSE ) || fileName.endsWith( ".rfr", FALSE ) ) ) + else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( fileName.endsWith( ".ref", false ) || fileName.endsWith( ".refer", false ) || fileName.endsWith( ".txt", false ) || fileName.endsWith( ".rfr", false ) ) ) format = BibTeX::File::formatEndNote; - else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( fileName.endsWith( ".isi", FALSE ) || fileName.endsWith( ".cgi", FALSE ) ) ) + else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( fileName.endsWith( ".isi", false ) || fileName.endsWith( ".cgi", false ) ) ) format = BibTeX::File::formatISI; - else if ( fileName.endsWith( ".ris", FALSE ) ) + else if ( fileName.endsWith( ".ris", false ) ) format = BibTeX::File::formatRIS; - else if ( fileName.endsWith( ".ps", FALSE ) ) + else if ( fileName.endsWith( ".ps", false ) ) format = BibTeX::File::formatPS; - else if ( fileName.endsWith( ".xml", FALSE ) ) + else if ( fileName.endsWith( ".xml", false ) ) { TQStringList options = TQStringList::split( '|', ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable ? "DocBook5|MODS|internal XML" : "DocBook5|internal XML" ) ); bool ok = false; @@ -286,7 +286,7 @@ namespace KBibTeX else if ( ok && !answer.isNull() && answer == "internal XML" ) format = BibTeX::File::formatXML; } - else if ( fileName.endsWith( ".html", FALSE ) || fileName.endsWith( ".xhtml", FALSE ) || fileName.endsWith( ".htm", FALSE ) ) + else if ( fileName.endsWith( ".html", false ) || fileName.endsWith( ".xhtml", false ) || fileName.endsWith( ".htm", false ) ) format = BibTeX::File::formatHTML; if ( format != BibTeX::File::formatUndefined ) @@ -320,8 +320,8 @@ namespace KBibTeX { Settings * settings = Settings::self( m_bibtexfile ); - bool result = FALSE; - setEnabled( FALSE ); + bool result = false; + setEnabled( false ); updateFromGUI(); @@ -418,7 +418,7 @@ namespace KBibTeX if ( settings->fileIO_EmbedFiles && !Settings::kpsewhich( "embedfile.sty" ) ) { KMessageBox::sorry( this, i18n( "Embedding files into the PDF file is enabled, but the required file 'embedfile.sty' was not found. Embedding files will be disabled." ), i18n( "Embedding files disabled" ) ); - settings->fileIO_EmbedFiles = FALSE; + settings->fileIO_EmbedFiles = false; } BibTeX::FileExporterPDF *pdfExporter = new BibTeX::FileExporterPDF( settings->fileIO_EmbedFiles ); @@ -428,7 +428,7 @@ namespace KBibTeX for ( TQStringList::Iterator it = settings->editing_DocumentSearchPaths.begin(); it != settings->editing_DocumentSearchPaths.end(); ++it ) searchPaths.append( *it ); if ( m_bibtexfile->fileName != TQString::null ) - searchPaths.append( KURL( m_bibtexfile->fileName ).directory( FALSE, FALSE ) ); + searchPaths.append( KURL( m_bibtexfile->fileName ).directory( false, false ) ); pdfExporter->setDocumentSearchPaths( searchPaths ); exporter = pdfExporter; } @@ -456,7 +456,7 @@ namespace KBibTeX delete exporter; } - setEnabled( TRUE ); + setEnabled( true ); return result; } @@ -476,12 +476,12 @@ namespace KBibTeX m_bibtexfile->appendElement( macro ); settings->addToCompletion( macro ); m_sideBar->refreshLists( m_bibtexfile ); - return TRUE; + return true; } else { delete macro; - return FALSE; + return false; } } else if ( elementType.lower() == "comment" ) @@ -491,12 +491,12 @@ namespace KBibTeX { new DocumentListViewItem( m_bibtexfile, comment, m_listViewElements ); m_bibtexfile->appendElement( comment ); - return TRUE; + return true; } else { delete comment; - return FALSE; + return false; } } else if ( elementType.lower() == "preamble" ) @@ -506,12 +506,12 @@ namespace KBibTeX { new DocumentListViewItem( m_bibtexfile, preamble, m_listViewElements ); m_bibtexfile->appendElement( preamble ); - return TRUE; + return true; } else { delete preamble; - return FALSE; + return false; } } else @@ -519,20 +519,20 @@ namespace KBibTeX TQString name = nextNewEntry(); BibTeX::Entry *entry = new BibTeX::Entry( elementType, name ); m_dirWatch.stopScan(); - if ( EntryWidget::execute( entry, m_bibtexfile, m_isReadOnly, TRUE ) == TQDialog::Accepted ) + if ( EntryWidget::execute( entry, m_bibtexfile, m_isReadOnly, true ) == TQDialog::Accepted ) { new DocumentListViewItem( m_bibtexfile, entry, m_listViewElements ); m_bibtexfile->appendElement( entry ); settings->addToCompletion( entry ); m_sideBar->refreshLists( m_bibtexfile ); m_dirWatch.startScan(); - return TRUE; + return true; } else { delete entry; m_dirWatch.startScan(); - return FALSE; + return false; } } } @@ -593,10 +593,10 @@ namespace KBibTeX delete exporter; } - return TRUE; + return true; } - return FALSE; + return false; } void DocumentWidget::updateViews() @@ -667,7 +667,7 @@ namespace KBibTeX if ( currentElement != NULL ) entry = dynamic_cast<BibTeX::Entry*>( currentElement ); - m_viewDocumentActionMenu->setEnabled( FALSE ); + m_viewDocumentActionMenu->setEnabled( false ); if ( entry != NULL ) { KURL::List documentURLs = getEntryURLs( entry ); @@ -676,17 +676,17 @@ namespace KBibTeX for ( KURL::List::Iterator i = documentURLs.begin(); i != documentURLs.end(); ++i ) { TQString prettyURL = ( *i ).prettyURL(); - if ( prettyURL.endsWith( ".pdf", FALSE ) || prettyURL.find( "/pdf/" ) > 0 ) + if ( prettyURL.endsWith( ".pdf", false ) || prettyURL.find( "/pdf/" ) > 0 ) popup->insertItem( SmallIcon( "application-pdf" ), prettyURL ); - else if ( prettyURL.endsWith( ".ps", FALSE ) ) + else if ( prettyURL.endsWith( ".ps", false ) ) popup->insertItem( SmallIcon( "application-postscript" ), prettyURL ); - else if ( prettyURL.endsWith( ".html", FALSE ) || prettyURL.startsWith( "http://", FALSE ) ) + else if ( prettyURL.endsWith( ".html", false ) || prettyURL.startsWith( "http://", false ) ) popup->insertItem( SmallIcon( "text-html" ), prettyURL ); else popup->insertItem( prettyURL ); m_viewDocumentActionMenuURLs.append( prettyURL ); } - m_viewDocumentActionMenu->setEnabled( TRUE ); + m_viewDocumentActionMenu->setEnabled( true ); } } } @@ -772,9 +772,9 @@ namespace KBibTeX /** * Build menu */ - bool popupEmpty = FALSE; + bool popupEmpty = false; if ( allKeywords.isEmpty() ) - popupEmpty = TRUE; + popupEmpty = true; else if ( allKeywords.count() < 24 ) { for ( TQStringList::Iterator it = allKeywords.begin(); it != allKeywords.end(); ++it ) @@ -878,7 +878,7 @@ namespace KBibTeX void DocumentWidget::executeElement( DocumentListViewItem* item ) { Settings * settings = Settings::self( m_bibtexfile ); - bool openingDocumentOK = FALSE; + bool openingDocumentOK = false; if ( settings->editing_MainListDoubleClickAction == 1 ) { @@ -953,7 +953,7 @@ namespace KBibTeX TQDialog::DialogCode dialogResult = TQDialog::Rejected; BibTeX::Entry * entry = dynamic_cast<BibTeX::Entry*>( element ); if ( entry ) - dialogResult = KBibTeX::EntryWidget::execute( entry, m_bibtexfile, m_isReadOnly, FALSE ); + dialogResult = KBibTeX::EntryWidget::execute( entry, m_bibtexfile, m_isReadOnly, false ); else { BibTeX::Comment * comment = dynamic_cast<BibTeX::Comment*>( element ); @@ -1330,15 +1330,15 @@ namespace KBibTeX BibTeX::FileImporter * importer = NULL; BibTeX::File::FileFormat format = BibTeX::File::formatUndefined; - if ( fileName.endsWith( ".bib", FALSE ) ) + if ( fileName.endsWith( ".bib", false ) ) format = BibTeX::File::formatBibTeX; - else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( fileName.endsWith( ".ref", FALSE ) || fileName.endsWith( ".refer", FALSE ) || fileName.endsWith( ".txt", FALSE ) || fileName.endsWith( ".rfr", FALSE ) ) ) + else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( fileName.endsWith( ".ref", false ) || fileName.endsWith( ".refer", false ) || fileName.endsWith( ".txt", false ) || fileName.endsWith( ".rfr", false ) ) ) format = BibTeX::File::formatEndNote; - else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( fileName.endsWith( ".isi", FALSE ) || fileName.endsWith( ".cgi", FALSE ) ) ) + else if ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable && ( fileName.endsWith( ".isi", false ) || fileName.endsWith( ".cgi", false ) ) ) format = BibTeX::File::formatISI; - else if ( fileName.endsWith( ".ris", FALSE ) ) + else if ( fileName.endsWith( ".ris", false ) ) format = BibTeX::File::formatRIS; - else if ( fileName.endsWith( ".xml", FALSE ) ) + else if ( fileName.endsWith( ".xml", false ) ) { TQStringList options = TQStringList::split( '|', ( settings->external_xml2bibAvailable && settings->external_end2xmlAvailable ? "MODS|EndNote XML|internal XML" : "internal XML" ) ); bool ok = false; @@ -1459,7 +1459,7 @@ namespace KBibTeX void DocumentWidget::slotTabChanged( TQWidget *tab ) { - setEnabled( FALSE ); + setEnabled( false ); TQApplication::setOverrideCursor( TQt::waitCursor ); BibTeX::File *bibTeXFile = NULL; @@ -1485,9 +1485,9 @@ namespace KBibTeX if ( m_actionEditCut && m_actionEditCopy && m_actionEditPaste ) { - m_actionEditCut->setEnabled( TRUE ); - m_actionEditCopy->setEnabled( TRUE ); - m_actionEditPaste->setEnabled( TRUE ); + m_actionEditCut->setEnabled( true ); + m_actionEditCopy->setEnabled( true ); + m_actionEditPaste->setEnabled( true ); } } else if ( tab == m_container && m_editMode != emList ) @@ -1511,7 +1511,7 @@ namespace KBibTeX m_editMode = emList; } - setEnabled( TRUE ); + setEnabled( true ); if ( tab == m_sourceView ) m_sourceView->setFocus(); @@ -1552,7 +1552,7 @@ namespace KBibTeX void DocumentWidget::slotRefreshDirtyFile() { if ( KMessageBox::questionYesNo( this, TQString( i18n( "File '%1' has been modified. Reload file to import changes or ignore changes?" ) ).arg( m_filename ), i18n( "Reload file?" ), KGuiItem( i18n( "Reload" ), "reload" ), KGuiItem( i18n( "Ignore" ), "ignore" ) ) == KMessageBox::Yes ) - open( m_filename, FALSE ); + open( m_filename, false ); else m_dirWatch.addFile( m_filename ); } |