diff options
Diffstat (limited to 'src/documentwidget.cpp')
-rw-r--r-- | src/documentwidget.cpp | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/src/documentwidget.cpp b/src/documentwidget.cpp index e31e868..db02187 100644 --- a/src/documentwidget.cpp +++ b/src/documentwidget.cpp @@ -42,7 +42,7 @@ #include <tdepopupmenu.h> #include <kiconloader.h> #include <tdeio/netaccess.h> -#include <kstandarddirs.h> +#include <tdestandarddirs.h> #include <tdemessagebox.h> #include <tdeapplication.h> #include <klineedit.h> @@ -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 ============================= @@ -143,25 +143,25 @@ namespace KBibTeX m_sourceView->setFont( TDEGlobalSettings::fixedFont() ); // Setup actions - connect( m_searchBar, SIGNAL( onlineSearch() ), this, SLOT( onlineSearch() ) ); - connect( m_searchBar, SIGNAL( doSearch( const TQString&, BibTeX::Element::FilterType, BibTeX::EntryField::FieldType ) ), m_listViewElements, SLOT( filter( const TQString&, BibTeX::Element::FilterType, BibTeX::EntryField::FieldType ) ) ); - connect( m_listViewElements, SIGNAL( executed( DocumentListViewItem* ) ), this, SLOT( executeElement( DocumentListViewItem* ) ) ); - connect( m_listViewElements, SIGNAL( selectionChanged() ), this, SLOT( slotSelectionChanged() ) ); - connect( m_listViewElements, SIGNAL( currentChanged( TQListViewItem* ) ), this, SLOT( slotPreviewElement( TQListViewItem* ) ) ); - connect( m_listViewElements, SIGNAL( clicked( TQListViewItem* ) ), this, SLOT( slotPreviewElement( TQListViewItem* ) ) ); - connect( this, SIGNAL( currentChanged( TQWidget * ) ), this, SLOT( slotTabChanged( TQWidget* ) ) ); - connect( m_sourceView, SIGNAL( modified() ), this, SLOT( slotModified() ) ); - connect( m_listViewElements, SIGNAL( modified() ), this, SLOT( slotModified() ) ); - connect( m_sideBar, SIGNAL( valueRenamed() ), this, SLOT( slotModified() ) ); - connect( m_sideBar, SIGNAL( valueRenamed() ), this, SLOT( refreshBibTeXFile() ) ); - connect( m_sideBar, SIGNAL( selected( const TQString&, BibTeX::Element::FilterType, BibTeX::EntryField::FieldType ) ), m_searchBar, SLOT( setSearch( const TQString&, BibTeX::Element::FilterType, BibTeX::EntryField::FieldType ) ) ); - connect( &m_dirWatch, SIGNAL( dirty( const TQString& ) ), this, SLOT( slotFileGotDirty( const TQString & ) ) ); + connect( m_searchBar, TQ_SIGNAL( onlineSearch() ), this, TQ_SLOT( onlineSearch() ) ); + connect( m_searchBar, TQ_SIGNAL( doSearch( const TQString&, BibTeX::Element::FilterType, BibTeX::EntryField::FieldType ) ), m_listViewElements, TQ_SLOT( filter( const TQString&, BibTeX::Element::FilterType, BibTeX::EntryField::FieldType ) ) ); + connect( m_listViewElements, TQ_SIGNAL( executed( DocumentListViewItem* ) ), this, TQ_SLOT( executeElement( DocumentListViewItem* ) ) ); + connect( m_listViewElements, TQ_SIGNAL( selectionChanged() ), this, TQ_SLOT( slotSelectionChanged() ) ); + connect( m_listViewElements, TQ_SIGNAL( currentChanged( TQListViewItem* ) ), this, TQ_SLOT( slotPreviewElement( TQListViewItem* ) ) ); + connect( m_listViewElements, TQ_SIGNAL( clicked( TQListViewItem* ) ), this, TQ_SLOT( slotPreviewElement( TQListViewItem* ) ) ); + connect( this, TQ_SIGNAL( currentChanged( TQWidget * ) ), this, TQ_SLOT( slotTabChanged( TQWidget* ) ) ); + connect( m_sourceView, TQ_SIGNAL( modified() ), this, TQ_SLOT( slotModified() ) ); + connect( m_listViewElements, TQ_SIGNAL( modified() ), this, TQ_SLOT( slotModified() ) ); + connect( m_sideBar, TQ_SIGNAL( valueRenamed() ), this, TQ_SLOT( slotModified() ) ); + connect( m_sideBar, TQ_SIGNAL( valueRenamed() ), this, TQ_SLOT( refreshBibTeXFile() ) ); + connect( m_sideBar, TQ_SIGNAL( selected( const TQString&, BibTeX::Element::FilterType, BibTeX::EntryField::FieldType ) ), m_searchBar, TQ_SLOT( setSearch( const TQString&, BibTeX::Element::FilterType, BibTeX::EntryField::FieldType ) ) ); + connect( &m_dirWatch, TQ_SIGNAL( dirty( const TQString& ) ), this, TQ_SLOT( slotFileGotDirty( const TQString & ) ) ); } 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() @@ -626,10 +626,10 @@ namespace KBibTeX m_viewDocumentActionMenu = dynamic_cast<TDEActionMenu*>( client->action( "view_document" ) ); if ( m_viewDocumentActionMenu != NULL ) - connect( m_viewDocumentActionMenu->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( slotViewDocument( int ) ) ); + connect( m_viewDocumentActionMenu->popupMenu(), TQ_SIGNAL( activated( int ) ), this, TQ_SLOT( slotViewDocument( int ) ) ); m_assignKeywordsActionMenu = dynamic_cast<TDEActionMenu*>( client->action( "assign_keywords" ) ); if ( m_assignKeywordsActionMenu != NULL ) - connect( m_assignKeywordsActionMenu->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( slotAssignKeywords( int ) ) ); + connect( m_assignKeywordsActionMenu->popupMenu(), TQ_SIGNAL( activated( int ) ), this, TQ_SLOT( slotAssignKeywords( int ) ) ); m_actionEditCut = client->action( "edit_cut" ); m_actionEditCopy = client->action( "edit_copy" ); @@ -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 ) @@ -789,7 +789,7 @@ namespace KBibTeX int maxCountPerSubMenu = ( int )sqrt( allKeywords.count() ) + 1; int countPerSubMenu = 0; TDEPopupMenu *subMenu = new TDEPopupMenu( popup ); - connect( subMenu, SIGNAL( activated( int ) ), this, SLOT( slotAssignKeywords( int ) ) ); + connect( subMenu, TQ_SIGNAL( activated( int ) ), this, TQ_SLOT( slotAssignKeywords( int ) ) ); TQString startWord, endWord; for ( TQStringList::Iterator it = allKeywords.begin(); it != allKeywords.end(); ++it ) { @@ -805,7 +805,7 @@ namespace KBibTeX { popup->insertItem( TQString( i18n( "%1 ... %2" ) ).arg( startWord ).arg( endWord ), subMenu ); subMenu = new TDEPopupMenu( popup ); - connect( subMenu, SIGNAL( activated( int ) ), this, SLOT( slotAssignKeywords( int ) ) ); + connect( subMenu, TQ_SIGNAL( activated( int ) ), this, TQ_SLOT( slotAssignKeywords( int ) ) ); countPerSubMenu = 0; } } @@ -833,7 +833,7 @@ namespace KBibTeX container->setFocusPolicy( TQWidget::ClickFocus ); popup->insertItem( container ); - connect( m_lineEditNewKeyword, SIGNAL( returnPressed() ), this, SLOT( slotAddKeyword() ) ); + connect( m_lineEditNewKeyword, TQ_SIGNAL( returnPressed() ), this, TQ_SLOT( slotAddKeyword() ) ); } void DocumentWidget::deferredInitialization() @@ -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 ); @@ -1141,15 +1141,15 @@ namespace KBibTeX { m_progressDialog = new TQProgressDialog( this ); m_progressDialog->setLabelText( label ); - connect( progressFrom, SIGNAL( progress( int, int ) ), this, SLOT( slotShowProgress( int, int ) ) ); - connect( m_progressDialog, SIGNAL( canceled() ), progressFrom, SLOT( cancel( ) ) ); + connect( progressFrom, TQ_SIGNAL( progress( int, int ) ), this, TQ_SLOT( slotShowProgress( int, int ) ) ); + connect( m_progressDialog, TQ_SIGNAL( canceled() ), progressFrom, TQ_SLOT( cancel( ) ) ); TQApplication::setOverrideCursor( TQt::waitCursor ); } void DocumentWidget::endProgress( TQObject * progressFrom ) { - disconnect( progressFrom, SIGNAL( progress( int, int ) ), this, SLOT( slotShowProgress( int, int ) ) ); - disconnect( m_progressDialog, SIGNAL( canceled() ), progressFrom, SLOT( cancel( ) ) ); + disconnect( progressFrom, TQ_SIGNAL( progress( int, int ) ), this, TQ_SLOT( slotShowProgress( int, int ) ) ); + disconnect( m_progressDialog, TQ_SIGNAL( canceled() ), progressFrom, TQ_SLOT( cancel( ) ) ); delete m_progressDialog; m_progressDialog = NULL; TQApplication::restoreOverrideCursor(); @@ -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(); @@ -1545,14 +1545,14 @@ namespace KBibTeX if ( path == m_filename ) { m_dirWatch.removeFile( m_filename ); - TQTimer::singleShot( 100, this, SLOT( slotRefreshDirtyFile( ) ) ); + TQTimer::singleShot( 100, this, TQ_SLOT( slotRefreshDirtyFile( ) ) ); } } 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 ); } |