[KBear-cvs] kbear/kbear/plugins/filediff kbearfilediffplugin.cpp,1.7,1.8 kbearfilediffplugin.h,1.4,1
Brought to you by:
kbjorn
|
From: <kb...@us...> - 2003-07-23 18:38:02
|
Update of /cvsroot/kbear/kbear/kbear/plugins/filediff
In directory sc8-pr-cvs1:/tmp/cvs-serv13799/kbear/plugins/filediff
Modified Files:
kbearfilediffplugin.cpp kbearfilediffplugin.h
Log Message:
Bugfixes and feature improvements
Index: kbearfilediffplugin.cpp
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/plugins/filediff/kbearfilediffplugin.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** kbearfilediffplugin.cpp 17 Jul 2003 20:21:02 -0000 1.7
--- kbearfilediffplugin.cpp 23 Jul 2003 18:27:26 -0000 1.8
***************
*** 115,119 ****
m_toggleHighlight->setChecked( highlight );
- searchForExternalParts();
}
//-----------------------------------------------
--- 115,118 ----
***************
*** 219,222 ****
--- 218,229 ----
m_diffProcess = 0L;
}
+
+ // we need to clean up these files after us
+ if( QFile::exists( m_sourceTmpURL.path() ) )
+ QFile::remove( m_sourceTmpURL.path() );
+
+ if( QFile::exists( m_destTmpURL.path() ) )
+ QFile::remove( m_destTmpURL.path() );
+
m_diffEdit->hide();
m_sourceFinished = false;
***************
*** 233,236 ****
--- 240,251 ----
void KBearFileDiffPlugin::slotInit() {
mainWindow()->embedOutputPluginView( m_outputWidget, i18n( "File Difference" ), i18n( "Display the difference of two files." ) );
+ // search all parts that can handle text/x-diff
+ KTrader::OfferList offers = KTrader::self()->query("text/x-diff", "'KParts/ReadOnlyPart' in ServiceTypes");
+ KTrader::OfferList::const_iterator it;
+ for( it = offers.begin(); it != offers.end(); ++it ) {
+ KService::Ptr ptr = (*it);
+ s_externalParts << ptr->name();
+ }
+
}
//-----------------------------------------------
***************
*** 320,329 ****
Transfer* transfer = 0L;
! if( urls.first().protocol() == "file" ) {
url = tmpURL = urls.first();
}
else {
url = urls.first();
! tmpURL = locateLocal( "tmp", url.fileName() );
sourceMeta.insert("Action", "copy" );
sourceMeta.insert("DestID", QString::number(-1) );
--- 335,348 ----
Transfer* transfer = 0L;
! if( urls.first().protocol() == QString::fromLatin1("file") ) {
url = tmpURL = urls.first();
}
else {
url = urls.first();
! int count = 0;
! do {
! ++count;
! tmpURL = locateLocal( "tmp", url.fileName() + "-" + QString::number( count ) );
! } while( QFile::exists( tmpURL.path() ) );
sourceMeta.insert("Action", "copy" );
sourceMeta.insert("DestID", QString::number(-1) );
***************
*** 411,414 ****
--- 430,440 ----
*stream << m_stdOut;
+ // we need to clean up these files after us
+ if( QFile::exists( m_sourceTmpURL.path() ) )
+ QFile::remove( m_sourceTmpURL.path() );
+
+ if( QFile::exists( m_destTmpURL.path() ) )
+ QFile::remove( m_destTmpURL.path() );
+
showDiff();
return;
***************
*** 437,457 ****
m_stdErr += QString::fromLocal8Bit( buffer, length );
- }
- //-----------------------------------------------
- void KBearFileDiffPlugin::searchForExternalParts() {
- // only execute once
- static bool init = false;
- if ( init )
- return;
- init = true;
-
- // search all parts that can handle text/x-diff
- KTrader::OfferList offers = KTrader::self()->query("text/x-diff", "'KParts/ReadOnlyPart' in ServiceTypes");
- KTrader::OfferList::const_iterator it;
- for( it = offers.begin(); it != offers.end(); ++it ) {
- KService::Ptr ptr = (*it);
- s_externalParts << ptr->name();
- }
- return;
}
//-----------------------------------------------
--- 463,466 ----
Index: kbearfilediffplugin.h
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/plugins/filediff/kbearfilediffplugin.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** kbearfilediffplugin.h 16 Jul 2003 00:03:06 -0000 1.4
--- kbearfilediffplugin.h 23 Jul 2003 18:27:26 -0000 1.5
***************
*** 70,74 ****
void execDiff();
void showDiff();
- void searchForExternalParts();
private:
QToolButton* m_resetButton;
--- 70,73 ----
|