[KBear-cvs] kbear/kbear/plugins/dirsynchplugin dirsynchlocaldirlister.cpp,1.1,1.2 dirsynchtreebranch
Brought to you by:
kbjorn
|
From: <fri...@us...> - 2003-08-30 21:41:06
|
Update of /cvsroot/kbear/kbear/kbear/plugins/dirsynchplugin
In directory sc8-pr-cvs1:/tmp/cvs-serv18557/kbear/plugins/dirsynchplugin
Modified Files:
dirsynchlocaldirlister.cpp dirsynchtreebranch.cpp
dirsynchtreebranch.h dirsynchtreeview.cpp dirsynchwidget.cpp
dirsynchwidget.h kbeardirsynchplugin.desktop
Log Message:
basic synch functionality
Index: dirsynchlocaldirlister.cpp
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/plugins/dirsynchplugin/dirsynchlocaldirlister.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dirsynchlocaldirlister.cpp 27 Aug 2003 20:01:28 -0000 1.1
--- dirsynchlocaldirlister.cpp 30 Aug 2003 21:41:01 -0000 1.2
***************
*** 32,35 ****
--- 32,36 ----
connect( m_dirLister, SIGNAL( started( const KURL& ) ), SIGNAL( started() ) );
connect( m_dirLister, SIGNAL( completed() ), SIGNAL(finishedLoading() ) );
+ // connect( m_dirLister, SIGNAL( completed( const KURL& ) ), SIGNAL( completed( const KURL& ) ) );
connect( m_dirLister, SIGNAL( canceled() ), SIGNAL(finishedLoading() ) );
connect( m_dirLister, SIGNAL( percent( int ) ), SIGNAL( progress( int ) ) );
Index: dirsynchtreebranch.cpp
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/plugins/dirsynchplugin/dirsynchtreebranch.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dirsynchtreebranch.cpp 27 Aug 2003 20:01:28 -0000 1.1
--- dirsynchtreebranch.cpp 30 Aug 2003 21:41:01 -0000 1.2
***************
*** 41,45 ****
if( !m_dirLister )
return false;
- // kdDebug()<<"DirSynchTreeBranch::openURL url="<<url.prettyURL()<<endl;
m_dirLister->openURL( url, true );
return true;
--- 41,44 ----
***************
*** 57,61 ****
bool DirSynchTreeBranch::populate( const KURL& url, KFileTreeViewItem *currItem ) {
bool ret = KFileTreeBranch::populate( url, currItem);
- // kdDebug()<<"DirSynchTreeBranch::populate url="<<url.prettyURL()<<endl;
return ret;
}
--- 56,59 ----
***************
*** 63,73 ****
void DirSynchTreeBranch::slotPopulateFinished( KFileTreeViewItem* currItem ) {
currItem->setListed( true );
- #warning TODO: Find out why DirSynchTreeBranch::slotPopulateFinished is not called!
- kdDebug()<<"DirSynchTreeBranch::slotPopulateFinished"<<endl;
emit finishedLoading( this );
}
//-----------------------------------------------
KFileTreeViewItem* DirSynchTreeBranch::findTVIByURL( const KURL& url ) {
- // kdDebug()<<"DirSynchTreeBranch::findTVIByURL="<<url.prettyURL()<<endl;
KFileTreeViewItem* item = KFileTreeBranch::findTVIByURL( url );
if( ! item ) {
--- 61,68 ----
***************
*** 100,108 ****
this, SIGNAL( redirection( const KURL& , const KURL& ) ) );
connect( m_dirLister, SIGNAL( completed(const KURL& )),
! this, SIGNAL( completed(const KURL& )));
connect( m_dirLister, SIGNAL( started()),
this, SIGNAL( started()));
! /* connect( m_dirLister, SIGNAL( connected() ),
! this, SIGNAL( connected() ) );*/
connect( m_dirLister, SIGNAL( progress( int ) ),
this, SIGNAL( progress( int ) ) );
--- 95,104 ----
this, SIGNAL( redirection( const KURL& , const KURL& ) ) );
connect( m_dirLister, SIGNAL( completed(const KURL& )),
! this, SLOT( slotCompleted(const KURL& )));
connect( m_dirLister, SIGNAL( started()),
this, SIGNAL( started()));
! connect( m_dirLister, SIGNAL( refreshItems( const KFileItemList& ) ),
! this, SLOT( slotRefreshItems( const KFileItemList& ) ) );
! connect( m_dirLister, SIGNAL( deleteItem( KFileItem* ) ), SIGNAL( deleteItem( KFileItem* ) ) );
connect( m_dirLister, SIGNAL( progress( int ) ),
this, SIGNAL( progress( int ) ) );
***************
*** 119,120 ****
--- 115,122 ----
}
//-----------------------------------------------
+ void DirSynchTreeBranch::slotCompleted( const KURL &url ) {
+ kdDebug()<<"DirSynchTreeBranch::slotCompleted"<<endl;
+ updateDirectory( rootUrl() );
+ }
+ //-----------------------------------------------
+
Index: dirsynchtreebranch.h
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/plugins/dirsynchplugin/dirsynchtreebranch.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dirsynchtreebranch.h 27 Aug 2003 20:01:28 -0000 1.1
--- dirsynchtreebranch.h 30 Aug 2003 21:41:01 -0000 1.2
***************
*** 51,56 ****
void progress( int );
private slots:
! void slotPopulateFinished( KFileTreeViewItem* currItem );
void slotFinishedLoading();
private:
void createDirLister(bool local);
--- 51,57 ----
void progress( int );
private slots:
! void slotPopulateFinished( KFileTreeViewItem* );
void slotFinishedLoading();
+ void slotCompleted( const KURL& );
private:
void createDirLister(bool local);
Index: dirsynchtreeview.cpp
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/plugins/dirsynchplugin/dirsynchtreeview.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dirsynchtreeview.cpp 27 Aug 2003 20:01:28 -0000 1.1
--- dirsynchtreeview.cpp 30 Aug 2003 21:41:01 -0000 1.2
***************
*** 36,44 ****
m_branch = new DirSynchTreeBranch( this, path, name, pix, showHidden );
connect( m_branch, SIGNAL( finishedLoading(KFileTreeBranch*) ), this, SLOT( slotStop() ) );
! // connect( newBranch, SIGNAL( finishedLoading(KFileTreeBranch*) ), this, SIGNAL( finishedLoading() ) );
return KFileTreeView::addBranch( m_branch );
}
//-----------------------------------------------
void DirSynchTreeView::slotStop() {
if( currentKFileTreeViewItem() )
stopAnimation(currentKFileTreeViewItem());
--- 36,45 ----
m_branch = new DirSynchTreeBranch( this, path, name, pix, showHidden );
connect( m_branch, SIGNAL( finishedLoading(KFileTreeBranch*) ), this, SLOT( slotStop() ) );
!
return KFileTreeView::addBranch( m_branch );
}
//-----------------------------------------------
void DirSynchTreeView::slotStop() {
+ kdDebug()<<"DirSynchTreeView::slotStop"<<endl;
if( currentKFileTreeViewItem() )
stopAnimation(currentKFileTreeViewItem());
Index: dirsynchwidget.cpp
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/plugins/dirsynchplugin/dirsynchwidget.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dirsynchwidget.cpp 27 Aug 2003 20:01:28 -0000 1.1
--- dirsynchwidget.cpp 30 Aug 2003 21:41:01 -0000 1.2
***************
*** 166,169 ****
--- 166,170 ----
m_localBranch = static_cast<DirSynchTreeBranch*>(m_localView->addBranch( KURL(dir), dir ) );
m_localBranch->setChildRecurse();
+ m_localBranch->setAutoUpdate( true );
static_cast<DirSynchTreeBranch*>(m_localBranch)->setLocal( true );
if( m_remoteBranch )
***************
*** 173,176 ****
--- 174,178 ----
url.setPass( "anonymous@" );
m_remoteBranch = static_cast<DirSynchTreeBranch*>(m_remoteView->addBranch( url, view->currentURL() ) );
+ m_remoteBranch->setAutoUpdate( true );
static_cast<DirSynchTreeBranch*>(m_remoteBranch)->setLocal( false );
static_cast<DirSynchTreeBranch*>(m_remoteBranch)->setSiteInfo( m_remoteSiteInfo );
***************
*** 264,271 ****
if( branch == m_localBranch ) {
m_localBranchFinished = true;
if( m_localView->currentURL().isValid() )
! m_localDirLabel->setText( m_localView->currentURL().path() );
else
! m_localDirLabel->setText( m_localBranch->rootUrl().path() );
}
else if( branch == m_remoteBranch ) {
--- 266,275 ----
if( branch == m_localBranch ) {
m_localBranchFinished = true;
+ KURL curUrl;
if( m_localView->currentURL().isValid() )
! curUrl = m_localView->currentURL().path();
else
! curUrl = m_localBranch->rootUrl().path();
! m_localDirLabel->setText( curUrl.path() );
}
else if( branch == m_remoteBranch ) {
***************
*** 273,287 ****
slotConnected();
m_remoteBranchFinished = true;
if( m_remoteView->currentURL().isValid() )
! m_remoteDirLabel->setText( m_remoteView->currentURL().path() );
else
! m_remoteDirLabel->setText( m_remoteBranch->rootUrl().path() );
}
if( m_localBranchFinished && m_remoteBranchFinished ) {
// we now need to find out the difference between the two views
! checkDiff();
slotProgress( 100 );
QApplication::restoreOverrideCursor();
slotSetStatusBarText( i18n( "No Operation in Progress" ) );
}
}
--- 277,295 ----
slotConnected();
m_remoteBranchFinished = true;
+ KURL curUrl;
if( m_remoteView->currentURL().isValid() )
! curUrl = m_remoteView->currentURL().path();
else
! curUrl = m_remoteBranch->rootUrl().path();
! m_remoteDirLabel->setText( curUrl.path() );
}
if( m_localBranchFinished && m_remoteBranchFinished ) {
// we now need to find out the difference between the two views
! kdDebug()<<"DirSynchWidget::slotFinishedLoading: Before checkDiff"<<endl;
! // checkDiff();
slotProgress( 100 );
QApplication::restoreOverrideCursor();
slotSetStatusBarText( i18n( "No Operation in Progress" ) );
+ kdDebug()<<"DirSynchWidget::slotFinishedLoading: After checkDiff"<<endl;
}
}
***************
*** 289,293 ****
void DirSynchWidget::checkDiff() {
if( ! m_localView || ! m_remoteView )
! return;
slotSetStatusBarText( i18n("Looking for differences...") );
if( m_localView->firstChild() ) {
--- 297,302 ----
void DirSynchWidget::checkDiff() {
if( ! m_localView || ! m_remoteView )
! return;
!
slotSetStatusBarText( i18n("Looking for differences...") );
if( m_localView->firstChild() ) {
***************
*** 330,334 ****
branch = dynamic_cast<DirSynchTreeBranch*>(m_localBranch);
}
- // kdDebug()<<"DirSynchWidget::findCorrespondingItem 111"<<endl;
if( item->path().isEmpty() ) {
kdDebug()<<"DirSynchWidget::findCorrespondingItem url is empty!"<<endl;
--- 339,342 ----
***************
*** 336,342 ****
}
kdDebug()<<item->path()<<endl;
- // kdDebug()<<"DirSynchWidget::findCorrespondingItem 222"<<endl;
QString relURL = item->url().url(-1);
relURL = relURL.remove( 0, rootURL.length() );
KURL url( branch->rootUrl().url(+1) + relURL );
return dynamic_cast<DirSynchTreeViewItem*>( branch->findTVIByURL( url ) );
--- 344,353 ----
}
kdDebug()<<item->path()<<endl;
QString relURL = item->url().url(-1);
relURL = relURL.remove( 0, rootURL.length() );
+ if( relURL.endsWith( ".part" ) ) {
+ relURL = relURL.left( relURL.length() - 5 );
+ kdDebug()<< "findCorrespondingItem: new filename: "<<relURL<<endl;
+ }
KURL url( branch->rootUrl().url(+1) + relURL );
return dynamic_cast<DirSynchTreeViewItem*>( branch->findTVIByURL( url ) );
***************
*** 346,357 ****
KURL src = m_remoteView->currentURL();
KURL dest;
! if( m_localView->currentURL().isValid() )
if( m_localView->currentKFileTreeViewItem()->fileItem()->isDir() )
dest = m_localView->currentURL().path();
else
dest = m_localView->currentURL().directory();
! else
dest = m_localBranch->rootUrl();
! synch( m_remoteSiteInfo.ID(), -1, src, dest );
}
//-----------------------------------------------
--- 357,369 ----
KURL src = m_remoteView->currentURL();
KURL dest;
! /* if( m_localView->currentURL().isValid() )
if( m_localView->currentKFileTreeViewItem()->fileItem()->isDir() )
dest = m_localView->currentURL().path();
else
dest = m_localView->currentURL().directory();
! else */
dest = m_localBranch->rootUrl();
! KURL root = m_remoteBranch->rootUrl();
! synch( m_remoteSiteInfo.ID(), -1, src, dest, root );
}
//-----------------------------------------------
***************
*** 359,370 ****
KURL src = m_localView->currentURL();
KURL dest;
! if( m_remoteView->currentURL().isValid() )
if( m_remoteView->currentKFileTreeViewItem()->fileItem()->isDir() )
dest = m_remoteView->currentURL().path();
else
dest = m_remoteView->currentURL().directory();
! else
dest = m_remoteBranch->rootUrl();
! synch( -1, -1, src, dest );
}
//-----------------------------------------------
--- 371,383 ----
KURL src = m_localView->currentURL();
KURL dest;
! /* if( m_remoteView->currentURL().isValid() )
if( m_remoteView->currentKFileTreeViewItem()->fileItem()->isDir() )
dest = m_remoteView->currentURL().path();
else
dest = m_remoteView->currentURL().directory();
! else */
dest = m_remoteBranch->rootUrl();
! KURL root = m_localBranch->rootUrl();
! synch( -1, -1, src, dest, root );
}
//-----------------------------------------------
***************
*** 373,376 ****
--- 386,390 ----
src.adjustPath(+1);
KURL dest;
+ KURL root = m_remoteBranch->rootUrl();
if( m_localView->currentKFileTreeViewItem() ) {
if( m_localView->currentKFileTreeViewItem()->fileItem()->isDir() )
***************
*** 379,383 ****
dest = m_localView->currentURL().directory();
}
! synch( m_remoteSiteInfo.ID(), -1, src, dest, true );
}
//-----------------------------------------------
--- 393,397 ----
dest = m_localView->currentURL().directory();
}
! synch( m_remoteSiteInfo.ID(), -1, src, dest, root );
}
//-----------------------------------------------
***************
*** 386,389 ****
--- 400,404 ----
src.adjustPath(+1);
KURL dest;
+ KURL root = m_localBranch->rootUrl();
if( m_remoteView->currentKFileTreeViewItem() ) {
if( m_remoteView->currentKFileTreeViewItem()->fileItem()->isDir() )
***************
*** 392,402 ****
dest = m_remoteView->currentURL().directory();
}
! synch( -1, -1, src, dest, true );
}
//-----------------------------------------------
! void DirSynchWidget::synch( int srcID, int destID, KURL src, KURL dest, bool srcIsRoot ) {
if( src.isValid() && dest.isValid() ) {
! KBearSynchJob *job = new KBearSynchJob( srcID, destID, src, dest);
! connect( job, SIGNAL( totalSizem_remoteSiteInfo.ID()( KIO::Job*, KIO::filesize_t ) ),
this, SLOT( slotTotalSize( KIO::Job*, KIO::filesize_t ) ) );
connect( job, SIGNAL( processedSize( KIO::Job*, KIO::filesize_t ) ),
--- 407,417 ----
dest = m_remoteView->currentURL().directory();
}
! synch( -1, -1, src, dest, root );
}
//-----------------------------------------------
! void DirSynchWidget::synch( int srcID, int destID, KURL src, KURL dest, KURL srcRootUrl ) {
if( src.isValid() && dest.isValid() ) {
! KBearSynchJob *job = new KBearSynchJob( srcID, destID, src, dest, srcRootUrl );
! connect( job, SIGNAL( totalSize( KIO::Job*, KIO::filesize_t ) ),
this, SLOT( slotTotalSize( KIO::Job*, KIO::filesize_t ) ) );
connect( job, SIGNAL( processedSize( KIO::Job*, KIO::filesize_t ) ),
***************
*** 406,410 ****
connect( job, SIGNAL( processedFiles( KIO::Job*, unsigned long ) ),
this, SLOT( slotProcessedFiles( KIO::Job*, unsigned long ) ) );
! // job->slotStart();
slotSetStatusBarText( i18n("Preparing for synchronisation ...") );
}
--- 421,426 ----
connect( job, SIGNAL( processedFiles( KIO::Job*, unsigned long ) ),
this, SLOT( slotProcessedFiles( KIO::Job*, unsigned long ) ) );
! job->slotStart();
! delete job;
slotSetStatusBarText( i18n("Preparing for synchronisation ...") );
}
Index: dirsynchwidget.h
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/plugins/dirsynchplugin/dirsynchwidget.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** dirsynchwidget.h 27 Aug 2003 20:01:28 -0000 1.1
--- dirsynchwidget.h 30 Aug 2003 21:41:01 -0000 1.2
***************
*** 70,74 ****
void setupConnections();
void checkDiff();
! void synch( int srcID, int destID, KURL src, KURL dest, bool srcIsRoot = false );
DirSynchTreeViewItem* findCorrespondingItem( DirSynchTreeViewItem * );
private:
--- 70,74 ----
void setupConnections();
void checkDiff();
! void synch( int srcID, int destID, KURL src, KURL dest, KURL srcRootUrl );
DirSynchTreeViewItem* findCorrespondingItem( DirSynchTreeViewItem * );
private:
Index: kbeardirsynchplugin.desktop
===================================================================
RCS file: /cvsroot/kbear/kbear/kbear/plugins/dirsynchplugin/kbeardirsynchplugin.desktop,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** kbeardirsynchplugin.desktop 27 Aug 2003 20:01:28 -0000 1.1
--- kbeardirsynchplugin.desktop 30 Aug 2003 21:41:01 -0000 1.2
***************
*** 9,11 ****
GenericName[de]=Verzeichnis-Synchronisationsplugin
Comment=Lets you synchronise the contents of a remote and a local directory.
! Comment[de]=Ermöglicht Ihnen, den Inhalt eines entfernten und eines lokalen Verzeichnisses zu synchronisieren.
--- 9,11 ----
GenericName[de]=Verzeichnis-Synchronisationsplugin
Comment=Lets you synchronise the contents of a remote and a local directory.
! Comment[de]=Ermöglicht Ihnen, den Inhalt eines entfernten und eines lokalen Verzeichnisses zu synchronisieren.
|