1
1
/***************************************************************************
2
* Copyright (C) 2004-2006 by Thomas Fischer *
2
* Copyright (C) 2004-2007 by Thomas Fischer *
3
3
* fischer@unix-ag.uni-kl.de *
5
5
* This program is free software; you can redistribute it and/or modify *
124
125
void EntryWidgetExternal::openURL()
126
127
BibTeX::Value * value = m_fieldLineEditURL->value();
127
if ( value->count() == 1 && !value->first() ->isStringKey() )
129
KURL url( value->plainString() );
131
kapp->invokeBrowser( url.prettyURL() );
133
m_pushButtonOpenURL->setEnabled( FALSE );
128
KURL url = Settings::locateFile( value->text(), m_bibtexfile->fileName, this );
130
new KRun( url, this );
132
m_pushButtonOpenURL->setEnabled( FALSE );
137
135
void EntryWidgetExternal::openDoi()
139
137
BibTeX::Value * value = m_fieldLineEditDoi->value();
140
KURL url = Settings::doiURL( value->plainString() );
138
KURL url = Settings::doiURL( value->text() );
141
139
if ( url.isValid() )
142
kapp->invokeBrowser( url.prettyURL() );
140
new KRun( url, this );
144
142
m_pushButtonOpenDoi->setEnabled( FALSE );
147
145
void EntryWidgetExternal::openLocalFile()
149
147
BibTeX::Value * value = m_fieldLineEditLocalFile->value();
150
if ( value->count() == 1 && !value->first() ->isStringKey() )
152
KURL url( value->plainString() );
154
kapp->invokeBrowser( url.prettyURL() );
156
m_pushButtonOpenLocalFile->setEnabled( FALSE );
148
KURL url = Settings::locateFile( value->text(), m_bibtexfile->fileName, this );
150
new KRun( url, this );
152
m_pushButtonOpenLocalFile->setEnabled( FALSE );
161
155
void EntryWidgetExternal::browseLocalFile()
165
159
if ( !filename.isEmpty() )
167
BibTeX::Value * value = new BibTeX::Value ();;
168
value->add( new BibTeX::ValueItem( filename, FALSE ) );
161
BibTeX::Value * value = new BibTeX::Value();
162
value->items.append( new BibTeX::PlainText( filename ) );
169
163
m_fieldLineEditLocalFile->setValue( value );
173
167
void EntryWidgetExternal::updateGUI()
175
169
BibTeX::Value * value = m_fieldLineEditURL->value();
176
if ( value != NULL && value->count() == 1 && !value->first() ->isStringKey() )
178
KURL url( value->plainString() );
179
m_pushButtonOpenURL->setEnabled( url.isValid() );
182
m_pushButtonOpenURL->setEnabled( FALSE );
170
m_pushButtonOpenURL->setEnabled( value != NULL && Settings::locateFile( value->text(), m_bibtexfile->fileName, this ).isValid() );
184
172
value = m_fieldLineEditLocalFile->value();
185
if ( value != NULL && value->count() == 1 && !value->first() ->isStringKey() )
187
KURL url( value->plainString() );
188
m_pushButtonOpenLocalFile->setEnabled( url.isValid() );
191
m_pushButtonOpenLocalFile->setEnabled( FALSE );
173
m_pushButtonOpenLocalFile->setEnabled( value != NULL && Settings::locateFile( value->text(), m_bibtexfile->fileName, this ).isValid() );
193
175
value = m_fieldLineEditDoi->value();
195
if ( value != NULL && value->count() == 1 && !value->first() ->isStringKey() )
197
KURL url = Settings::doiURL( value->plainString() );
198
m_pushButtonOpenDoi->setEnabled( url.isValid() );
201
m_pushButtonOpenDoi->setEnabled( FALSE );
176
m_pushButtonOpenDoi->setEnabled( value != NULL && Settings::doiURL( value->text() ).isValid() );
204
179
void EntryWidgetExternal::setupGUI()