~ubuntu-branches/ubuntu/jaunty/kde4libs/jaunty

« back to all changes in this revision

Viewing changes to kio/kio/kdirlister.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Wenning, Jonathan Thomas, Andreas Wenning
  • Date: 2009-04-01 05:55:52 UTC
  • mfrom: (1.1.29 upstream)
  • Revision ID: james.westby@ubuntu.com-20090401055552-uel5di5f3xiftax3
Tags: 4:4.2.2-0ubuntu1
[ Jonathan Thomas ]
* New upstream release (LP: #344709, #348823):
  - Bump upstreamversion and runtimedeps in debian/rules
  - Remove kubuntu_65_kcmdlineargs_decoding_svn934640.diff, applied upstream

[ Andreas Wenning ]
* Remove patch kubuntu_69_do_not_show_plasma_popups_over_screensaver.diff,
  applied upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
859
859
  printDebug();
860
860
#endif
861
861
 
862
 
  KUrl oldurl( src );
863
 
  oldurl.adjustPath( KUrl::RemoveTrailingSlash );
864
 
  KFileItem *fileitem = findByUrl( 0, oldurl );
 
862
    KUrl oldurl(src);
 
863
    oldurl.adjustPath( KUrl::RemoveTrailingSlash );
 
864
    KFileItem *fileitem = findByUrl(0, oldurl);
 
865
    if (!fileitem) {
 
866
        kDebug(7004) << "Item not found:" << oldurl;
 
867
        return;
 
868
    }
 
869
 
 
870
    // Dest already exists? Was overwritten then (testcase: #151851)
 
871
    // We better emit it as deleted -before- doing the renaming, otherwise
 
872
    // the "update" mechanism will emit the old one as deleted and
 
873
    // kdirmodel will delete the new (renamed) one!
 
874
    KFileItem* existingDestItem = findByUrl(0, dst);
 
875
    if (existingDestItem) {
 
876
        //kDebug() << dst << "already existed, let's delete it";
 
877
        slotFilesRemoved(dst);
 
878
    }
865
879
 
866
880
  // If the item had a UDS_URL as well as UDS_NAME set, the user probably wants
867
881
  // to be updating the name only (since they can't see the URL).
868
882
  // Check to see if a URL exists, and if so, if only the file part has changed,
869
883
  // only update the name and not the underlying URL.
870
 
  bool nameOnly = fileitem && !fileitem->entry().stringValue( KIO::UDSEntry::UDS_URL ).isEmpty();
 
884
  bool nameOnly = !fileitem->entry().stringValue( KIO::UDSEntry::UDS_URL ).isEmpty();
871
885
  nameOnly &= src.directory( KUrl::IgnoreTrailingSlash | KUrl::AppendTrailingSlash ) ==
872
886
              dst.directory( KUrl::IgnoreTrailingSlash | KUrl::AppendTrailingSlash );
873
887
 
874
 
    if (!nameOnly && (!fileitem || fileitem->isDir())) {
 
888
    if (!nameOnly && fileitem->isDir()) {
875
889
        renameDir( src, dst );
876
890
        // #172945 - if the fileitem was the root item of a DirItem that was just removed from the cache,
877
891
        // then it's a dangling pointer now...
878
892
        fileitem = findByUrl( 0, oldurl );
879
893
    }
880
894
 
881
 
  // Now update the KFileItem representing that file or dir (not exclusive with the above!)
882
 
  if ( fileitem )
883
 
  {
 
895
    // Now update the KFileItem representing that file or dir (not exclusive with the above!)
884
896
    if ( !fileitem->isLocalFile() && !fileitem->localPath().isEmpty() ) // it uses UDS_LOCAL_PATH? ouch, needs an update then
885
897
        slotFilesChanged( QStringList() << src.url() );
886
898
    else
887
899
    {
888
 
        // Dest already exists? Was overwritten then (testcase: #151851)
889
 
        // We better emit it as deleted -before- doing the renaming, otherwise
890
 
        // the "update" mechanism will emit the old one as deleted and
891
 
        // kdirmodel will delete the new (renamed) one!
892
 
        KFileItem* existingDestItem = findByUrl(0, dst);
893
 
        if (existingDestItem) {
894
 
            //kDebug() << dst << "already existed, let's delete it";
895
 
            slotFilesRemoved(dst);
896
 
        }
897
 
 
898
900
        aboutToRefreshItem( *fileitem );
899
901
        const KFileItem oldItem = *fileitem;
900
902
        if( nameOnly )
905
907
        fileitem->determineMimeType();
906
908
        emitRefreshItem( oldItem, *fileitem );
907
909
    }
908
 
  }
 
910
 
909
911
#ifdef DEBUG_CACHE
910
 
  printDebug();
 
912
    printDebug();
911
913
#endif
912
914
}
913
915