From kde-commits Mon Sep 03 15:05:00 2018 From: Michael Reeves Date: Mon, 03 Sep 2018 15:05:00 +0000 To: kde-commits Subject: [kdiff3] src: remove pointless windows only code Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=153598711203183 Git commit b5a1c87657eb05900e72f8a74a34a7334edaaeac by Michael Reeves. Committed on 01/09/2018 at 00:20. Pushed by mreeves into branch 'master'. remove pointless windows only code M +3 -66 src/fileaccess.cpp https://commits.kde.org/kdiff3/b5a1c87657eb05900e72f8a74a34a7334edaaeac diff --git a/src/fileaccess.cpp b/src/fileaccess.cpp index e650e27..05e6aa1 100644 --- a/src/fileaccess.cpp +++ b/src/fileaccess.cpp @@ -1235,7 +1235,6 @@ bool FileAccessJobHandler::listDir(t_DirectoryList* p= DirList, bool bRecursive, b m_bSuccess =3D QDir::setCurrent(m_pFileAccess->absoluteFilePath()); if(m_bSuccess) { -#ifndef Q_OS_WIN m_bSuccess =3D true; QDir dir("."); = @@ -1252,6 +1251,9 @@ bool FileAccessJobHandler::listDir(t_DirectoryList* p= DirList, bool bRecursive, b { foreach(const QFileInfo& fi, fiList) // for each file... { + if(pp.wasCancelled()) + break; + = if(fi.fileName() =3D=3D "." || fi.fileName() =3D=3D ".= .") continue; = @@ -1260,71 +1262,6 @@ bool FileAccessJobHandler::listDir(t_DirectoryList* = pDirList, bool bRecursive, b pDirList->push_back(fa); } } -#else - QString pattern =3D "*.*"; - WIN32_FIND_DATA findData; - - Qt::HANDLE searchHandle =3D FindFirstFileW((const wchar_t*)pat= tern.utf16(), &findData); - - if(searchHandle !=3D INVALID_HANDLE_VALUE) - { - QString absPath =3D m_pFileAccess->absoluteFilePath(); - QString relPath =3D m_pFileAccess->filePath(); - bool bFirst =3D true; - while(!pp.wasCancelled()) - { - if(!bFirst) - { - if(!FindNextFileW(searchHandle, &findData)) - break; - } - bFirst =3D false; - FileAccess fa; - - fa.m_filePath =3D QString::fromUtf16((const ushort*)fi= ndData.cFileName); - if(fa.m_filePath !=3D "." && fa.m_filePath !=3D "..") - {//TODO:Use setFile here instead of duplicating code - fa.m_size =3D (qint64(findData.nFileSizeHigh) << 3= 2) + findData.nFileSizeLow; - - FILETIME ft; - SYSTEMTIME t; - FileTimeToLocalFileTime(&findData.ftLastWriteTime,= &ft); - FileTimeToSystemTime(&ft, &t); - fa.m_modificationTime =3D QDateTime(QDate(t.wYear,= t.wMonth, t.wDay), QTime(t.wHour, t.wMinute, t.wSecond)); - //FileTimeToLocalFileTime( &findData.ftLastAccessT= ime, &ft ); FileTimeToSystemTime(&ft,&t); - //fa.m_accessTime =3D QDateTime( QDate(t.wYe= ar, t.wMonth, t.wDay), QTime(t.wHour, t.wMinute, t.wSecond) ); - //FileTimeToLocalFileTime( &findData.ftCreationTim= e, &ft ); FileTimeToSystemTime(&ft,&t); - //fa.m_creationTime =3D QDateTime( QDate(t.wYe= ar, t.wMonth, t.wDay), QTime(t.wHour, t.wMinute, t.wSecond) ); - - int a =3D findData.dwFileAttributes; - fa.m_bWritable =3D (a & FILE_ATTRIBUTE_READONLY) = =3D=3D 0; - fa.m_bDir =3D (a & FILE_ATTRIBUTE_DIRECTORY) !=3D = 0; - fa.m_bFile =3D !fa.m_bDir; - fa.m_bHidden =3D (a & FILE_ATTRIBUTE_HIDDEN) !=3D = 0; - - //fa.m_bExecutable =3D false; // Useless on windows - fa.m_bExists =3D true; - //fa.m_bReadable =3D true; - //fa.m_bValidData =3D true; - fa.m_bSymLink =3D false; - //fa.m_fileType =3D 0; - - //fa.m_filePath =3D fa.m_name; - //fa.m_absoluteFilePath =3D absPath + "/" + fa.m_n= ame; - //fa.m_url.setPath( fa.m_absoluteFilePath ); - fa.m_pData->m_pParent =3D m_pFileAccess; - = - pDirList->push_back(fa); - } - } - FindClose(searchHandle); - } - else - { - QDir::setCurrent(currentPath); // restore current path - return false; - } -#endif } QDir::setCurrent(currentPath); // restore current path }