fix KDE bug #195385 - Copy file after rename use old file name
This commit is contained in:
parent
229b6f2844
commit
0754b46075
|
@ -0,0 +1,69 @@
|
||||||
|
Index: kio/kio/kfileitem.cpp
|
||||||
|
===================================================================
|
||||||
|
--- kio/kio/kfileitem.cpp (revision 1012563)
|
||||||
|
+++ kio/kio/kfileitem.cpp (revision 1012564)
|
||||||
|
@@ -532,6 +532,9 @@
|
||||||
|
{
|
||||||
|
d->m_strName = name;
|
||||||
|
d->m_strText = KIO::decodeFileName( d->m_strName );
|
||||||
|
+ if (d->m_entry.contains(KIO::UDSEntry::UDS_NAME))
|
||||||
|
+ d->m_entry.insert(KIO::UDSEntry::UDS_NAME, d->m_strName); // #195385
|
||||||
|
+
|
||||||
|
}
|
||||||
|
|
||||||
|
QString KFileItem::linkDest() const
|
||||||
|
Index: kio/tests/kfileitemtest.cpp
|
||||||
|
===================================================================
|
||||||
|
--- kio/tests/kfileitemtest.cpp (revision 1012563)
|
||||||
|
+++ kio/tests/kfileitemtest.cpp (revision 1012564)
|
||||||
|
@@ -241,6 +241,21 @@
|
||||||
|
QVERIFY(fileItem.cmp(fileItem2));
|
||||||
|
}
|
||||||
|
|
||||||
|
+void KFileItemTest::testRename()
|
||||||
|
+{
|
||||||
|
+ KIO::UDSEntry entry;
|
||||||
|
+ const QString origName = QString::fromLatin1("foo");
|
||||||
|
+ entry.insert(KIO::UDSEntry::UDS_NAME, origName);
|
||||||
|
+ entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
|
||||||
|
+ KFileItem fileItem(entry, KUrl("/dir/foo"));
|
||||||
|
+ QCOMPARE(fileItem.name(), origName);
|
||||||
|
+ QCOMPARE(fileItem.text(), origName);
|
||||||
|
+ const QString newName = QString::fromLatin1("FiNeX_rocks");
|
||||||
|
+ fileItem.setName(newName);
|
||||||
|
+ QCOMPARE(fileItem.name(), newName);
|
||||||
|
+ QCOMPARE(fileItem.text(), newName);
|
||||||
|
+ QCOMPARE(fileItem.entry().stringValue(KIO::UDSEntry::UDS_NAME), newName); // #195385
|
||||||
|
+}
|
||||||
|
|
||||||
|
void KFileItemTest::testDecodeFileName_data()
|
||||||
|
{
|
||||||
|
Index: kio/tests/kdirmodeltest.cpp
|
||||||
|
===================================================================
|
||||||
|
--- kio/tests/kdirmodeltest.cpp (revision 1012563)
|
||||||
|
+++ kio/tests/kdirmodeltest.cpp (revision 1012564)
|
||||||
|
@@ -418,6 +418,12 @@
|
||||||
|
// check renaming happened
|
||||||
|
QCOMPARE( m_dirModel->itemForIndex( m_secondFileIndex ).url().url(), newUrl.url() );
|
||||||
|
|
||||||
|
+ // check that KDirLister::cachedItemForUrl won't give a bad name if copying that item (#195385)
|
||||||
|
+ KFileItem cachedItem = KDirLister::cachedItemForUrl(newUrl);
|
||||||
|
+ Q_ASSERT(!cachedItem.isNull());
|
||||||
|
+ QCOMPARE(cachedItem.name(), QString("toplevelfile_2_renamed"));
|
||||||
|
+ QCOMPARE(cachedItem.entry().stringValue(KIO::UDSEntry::UDS_NAME), QString("toplevelfile_2_renamed"));
|
||||||
|
+
|
||||||
|
// Put things back to normal
|
||||||
|
job = KIO::rename(newUrl, url, KIO::HideProgressInfo);
|
||||||
|
ok = job->exec();
|
||||||
|
Index: kio/tests/kfileitemtest.h
|
||||||
|
===================================================================
|
||||||
|
--- kio/tests/kfileitemtest.h (revision 1012563)
|
||||||
|
+++ kio/tests/kfileitemtest.h (revision 1012564)
|
||||||
|
@@ -35,6 +35,7 @@
|
||||||
|
void testHiddenFile();
|
||||||
|
void testMimeTypeOnDemand();
|
||||||
|
void testCmp();
|
||||||
|
+ void testRename();
|
||||||
|
|
||||||
|
void testDecodeFileName_data();
|
||||||
|
void testDecodeFileName();
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Summary: K Desktop Environment 4 - Libraries
|
Summary: K Desktop Environment 4 - Libraries
|
||||||
Version: 4.3.0
|
Version: 4.3.0
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
|
|
||||||
%if 0%{?fedora} > 8
|
%if 0%{?fedora} > 8
|
||||||
Name: kdelibs
|
Name: kdelibs
|
||||||
|
@ -90,6 +90,8 @@ Patch101: kdelibs-4.3.1-kdebug#199557.patch
|
||||||
Patch102: kdelibs-4.3.1-unmountfix.patch
|
Patch102: kdelibs-4.3.1-unmountfix.patch
|
||||||
# http://bugs.kde.org/170608
|
# http://bugs.kde.org/170608
|
||||||
Patch103: kdelibs-4.3.1-copyurls.patch
|
Patch103: kdelibs-4.3.1-copyurls.patch
|
||||||
|
# http://bugs.kde.org/195385
|
||||||
|
Patch104: kdelibs-4.3.1-copyrename.patch
|
||||||
|
|
||||||
BuildRequires: qt4-devel >= 4.5.0
|
BuildRequires: qt4-devel >= 4.5.0
|
||||||
# qt4%{_?_isa} isn't provided yet -- Rex
|
# qt4%{_?_isa} isn't provided yet -- Rex
|
||||||
|
@ -228,6 +230,7 @@ sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanage
|
||||||
%patch101 -p4 -b .kdebug#199557
|
%patch101 -p4 -b .kdebug#199557
|
||||||
%patch102 -p0 -b .unmountfix
|
%patch102 -p0 -b .unmountfix
|
||||||
%patch103 -p0 -b .copyurls
|
%patch103 -p0 -b .copyurls
|
||||||
|
%patch104 -p0 -b .copyrename
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
|
@ -409,6 +412,9 @@ rm -rf %{buildroot}
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Aug 18 2009 Lukáš Tinkl <ltinkl@redhat.com> - 4.3.0.5
|
||||||
|
- fix KDE bug #19538, copy file after rename uses old file name
|
||||||
|
|
||||||
* Mon Aug 17 2009 Lukáš Tinkl <ltinkl@redhat.com> - 4.3.0-4
|
* Mon Aug 17 2009 Lukáš Tinkl <ltinkl@redhat.com> - 4.3.0-4
|
||||||
- fix unmounting devices
|
- fix unmounting devices
|
||||||
- fix copying URLs to clipboard (kdebug:170608)
|
- fix copying URLs to clipboard (kdebug:170608)
|
||||||
|
|
Loading…
Reference in New Issue