more windows code remove

This commit is contained in:
Ivailo Monev 2014-11-19 15:19:19 +00:00
parent c3f3bcb965
commit b99fa1400b
50 changed files with 3 additions and 737 deletions

View file

@ -205,11 +205,6 @@ QString KConfigPrivate::expandString(const QString& value)
}
QString env;
if (!aVarName.isEmpty()) {
#ifdef Q_OS_WIN
if (aVarName == QLatin1String("HOME"))
env = QDir::homePath();
else
#endif
{
QByteArray pEnv = qgetenv( aVarName.toLatin1() );
if( !pEnv.isEmpty() )
@ -566,11 +561,7 @@ void KConfigPrivate::changeFileName(const QString& name, const char* type)
return;
}
#ifndef Q_OS_WIN
bSuppressGlobal = (file == sGlobalFileName);
#else
bSuppressGlobal = (file.compare(sGlobalFileName, Qt::CaseInsensitive) == 0);
#endif
if (bDynamicBackend || !mBackend) // allow dynamic changing of backend
mBackend = KConfigBackend::create(componentData, file);
@ -626,11 +617,7 @@ void KConfigPrivate::parseGlobalFiles()
const QByteArray utf8Locale = locale.toUtf8();
foreach(const QString& file, globalFiles) {
KConfigBackend::ParseOptions parseOpts = KConfigBackend::ParseGlobal|KConfigBackend::ParseExpansions;
#ifndef Q_OS_WIN
if (file != sGlobalFileName)
#else
if (file.compare(sGlobalFileName, Qt::CaseInsensitive) != 0)
#endif
parseOpts |= KConfigBackend::ParseDefaults;
KSharedPtr<KConfigBackend> backend = KConfigBackend::create(componentData, file);
@ -665,11 +652,7 @@ void KConfigPrivate::parseConfigFiles()
const QByteArray utf8Locale = locale.toUtf8();
foreach(const QString& file, files) {
#ifndef Q_OS_WIN
if (file == mBackend->filePath()) {
#else
if (file.compare(mBackend->filePath(), Qt::CaseInsensitive) == 0) {
#endif
switch (mBackend->parseConfig(utf8Locale, entryMap, KConfigBackend::ParseExpansions)) {
case KConfigBackend::ParseOk:
break;

View file

@ -153,11 +153,7 @@ bool KDesktopFile::isAuthorizedDesktopFile(const QString& path)
// Check if the .desktop file is installed as part of KDE or XDG.
foreach (const QString &prefix, kdePrefixes) {
#ifndef Q_OS_WIN
if (realPath.startsWith(prefix))
#else
if (realPath.startsWith(prefix, Qt::CaseInsensitive))
#endif
return true;
}

View file

@ -44,9 +44,6 @@
#include <ksystemtimezone.h>
#include <kdebug.h>
#ifdef Q_OS_WIN
#include <windows.h> // SYSTEMTIME
#endif
static const char shortDay[][4] = {
@ -1240,18 +1237,9 @@ KDateTime KDateTime::currentLocalDateTime()
KDateTime KDateTime::currentUtcDateTime()
{
KDateTime result;
#ifdef Q_OS_WIN
SYSTEMTIME st;
memset(&st, 0, sizeof(SYSTEMTIME));
GetSystemTime(&st);
result = KDateTime(QDate(st.wYear, st.wMonth, st.wDay),
QTime(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds),
UTC);
#else
time_t t;
::time(&t);
result.setTime_t(static_cast<qint64>(t));
#endif
#ifndef NDEBUG
return result.addSecs(KDateTimePrivate::currentDateTimeOffset);
#else

View file

@ -57,9 +57,6 @@
#include <kdebug.h>
#include <kconfiggroup.h>
#include "ktzfiletimezone.h"
#ifdef Q_OS_WIN
#include "ktimezone_win.h"
#endif
#define KTIMEZONED_DBUS_IFACE "org.kde.KTimeZoned"
@ -121,14 +118,7 @@ public:
static void setLocalZone();
static void cleanup();
static void readConfig(bool init);
#ifdef Q_OS_WIN
static void updateTimezoneInformation()
{
instance()->updateTimezoneInformation(true);
}
#else
static void updateZonetab() { instance()->readZoneTab(true); }
#endif
static KTimeZone m_localZone;
static QString m_localZoneName;
@ -139,12 +129,8 @@ public:
private:
KSystemTimeZonesPrivate() {}
#ifdef Q_OS_WIN
void updateTimezoneInformation(bool update);
#else
void readZoneTab(bool update);
static float convertCoordinate(const QString &coordinate);
#endif
static KSystemTimeZones *m_parent;
static KSystemTimeZonesPrivate *m_instance;
@ -267,13 +253,11 @@ void KSystemTimeZones::configChanged()
void KSystemTimeZones::zonetabChanged(const QString &zonetab)
{
Q_UNUSED(zonetab)
#ifndef Q_OS_WIN
kDebug(161) << "KSystemTimeZones::zonetabChanged()";
KSystemTimeZonesPrivate::m_ktimezonedError = false;
// Re-read zone.tab and update our collection, removing any deleted
// zones and adding any new zones.
KSystemTimeZonesPrivate::updateZonetab();
#endif
}
void KSystemTimeZones::zoneDefinitionChanged(const QString &zone)
@ -313,15 +297,9 @@ kDebug(161)<<"instance(): ... initialised";
readConfig(true);
// Go read the database.
#ifdef Q_OS_WIN
// On Windows, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
// is the place to look. The TZI binary value is the TIME_ZONE_INFORMATION structure.
m_instance->updateTimezoneInformation(false);
#else
// For Unix, read zone.tab.
if (!m_zonetab.isEmpty())
m_instance->readZoneTab(false);
#endif
setLocalZone();
if (!m_localZone.isValid())
m_localZone = KTimeZone::utc(); // ensure a time zone is always returned
@ -393,44 +371,6 @@ void KSystemTimeZonesPrivate::cleanup()
delete m_tzfileSource;
}
#ifdef Q_OS_WIN
void KSystemTimeZonesPrivate::updateTimezoneInformation(bool update)
{
if (!m_source)
m_source = new KSystemTimeZoneSourceWindows;
QStringList newZones;
Q_FOREACH(const QString & tz, KSystemTimeZoneWindows::listTimeZones())
{
// const std::wstring wstr = tz.toStdWString();
// const KTimeZone info = make_time_zone( wstr.c_str() );
KSystemTimeZoneWindows stz(m_source, tz);
if (update)
{
// Update the existing collection with the new zone definition
newZones += stz.name();
KTimeZone oldTz = zone(stz.name());
if (oldTz.isValid())
oldTz.updateBase(stz); // the zone previously existed, so update its definition
else
add(stz); // the zone didn't previously exist, so add it
}
else
add(stz);
}
if (update)
{
// Remove any zones from the collection which no longer exist
const ZoneMap oldZones = zones();
for (ZoneMap::const_iterator it = oldZones.begin(); it != oldZones.end(); ++it)
{
if (newZones.indexOf(it.key()) < 0)
remove(it.value());
}
}
}
#else
/*
* Find the location of the zoneinfo files and store in mZoneinfoDir.
* Parse zone.tab and for each time zone, create a KSystemTimeZone instance.
@ -537,7 +477,6 @@ float KSystemTimeZonesPrivate::convertCoordinate(const QString &coordinate)
value = degrees * 3600 + minutes * 60 + seconds;
return value / 3600.0;
}
#endif
/******************************************************************************/

View file

@ -650,10 +650,8 @@ struct KDebugPrivate
case Unknown: // should not happen
default: // QtOutput
s = setupQtWriter(type);
#ifndef Q_OS_WIN
//only color if the debug goes to a tty, unless env_colors_on_any_fd is set too.
colored = env_colored && (env_colors_on_any_fd || isatty(fileno(stderr)));
#endif
break;
}

View file

@ -838,12 +838,7 @@ void KDirWatchPrivate::addEntry(KDirWatch* instance, const QString& _path,
watchModes = KDirWatch::WatchDirOnly;
}
#ifdef Q_OS_WIN
// ctime is the 'creation time' on windows - use mtime instead
e->m_ctime = stat_buf.st_mtime;
#else
e->m_ctime = stat_buf.st_ctime;
#endif
e->m_status = Normal;
e->m_nlink = stat_buf.st_nlink;
e->m_ino = stat_buf.st_ino;
@ -1143,12 +1138,7 @@ bool KDirWatchPrivate::restartEntryScan( KDirWatch* instance, Entry* e,
KDE_struct_stat stat_buf;
bool exists = (KDE::stat(e->path, &stat_buf) == 0);
if (exists) {
#ifdef Q_OS_WIN
// ctime is the 'creation time' on windows - use mtime instead
e->m_ctime = stat_buf.st_mtime;
#else
e->m_ctime = stat_buf.st_ctime;
#endif
e->m_status = Normal;
if (s_verboseDebug) {
kDebug(7001) << "Setting status to Normal for" << e << e->path;

View file

@ -22,7 +22,6 @@
#include <QDebug>
//#include <errno.h>
#ifndef Q_OS_WIN
inline KFileSystemType::Type kde_typeFromName(const char *name)
{
if (qstrncmp(name, "nfs", 3) == 0
@ -128,12 +127,6 @@ KFileSystemType::Type determineFileSystemTypeImpl(const QByteArray& path)
#endif
}
#endif
#else
KFileSystemType::Type determineFileSystemTypeImpl(const QByteArray& path)
{
return KFileSystemType::Unknown;
}
#endif
KFileSystemType::Type KFileSystemType::fileSystemType(const QString& path)
{

View file

@ -29,11 +29,7 @@
#include "kstandarddirs.h"
#ifdef Q_OS_WIN
static Qt::CaseSensitivity cs = Qt::CaseInsensitive;
#else
static Qt::CaseSensitivity cs = Qt::CaseSensitive;
#endif
#ifdef HAVE_VOLMGT
#include <volmgt.h>

View file

@ -23,23 +23,14 @@
#include <kstandarddirs.h>
#include <kshell.h>
#ifdef Q_OS_WIN
# include <kshell_p.h>
#endif
#include <qfile.h>
#ifdef Q_OS_WIN
# include <windows.h>
#else
# include <unistd.h>
# include <errno.h>
#endif
#ifndef Q_OS_WIN
# define STD_OUTPUT_HANDLE 1
# define STD_ERROR_HANDLE 2
#endif
#ifdef _WIN32_WCE
#include <stdio.h>
@ -47,17 +38,6 @@
void KProcessPrivate::writeAll(const QByteArray &buf, int fd)
{
#ifdef Q_OS_WIN
#ifndef _WIN32_WCE
HANDLE h = GetStdHandle(fd);
if (h) {
DWORD wr;
WriteFile(h, buf.data(), buf.size(), &wr, 0);
}
#else
fwrite(buf.data(), 1, buf.size(), (FILE*)fd);
#endif
#else
int off = 0;
do {
int ret = ::write(fd, buf.data() + off, buf.size() - off);
@ -68,7 +48,6 @@ void KProcessPrivate::writeAll(const QByteArray &buf, int fd)
off += ret;
}
} while (off < buf.size());
#endif
}
void KProcessPrivate::forwardStd(KProcess::ProcessChannel good, int fd)
@ -212,9 +191,6 @@ void KProcess::setProgram(const QString &exe, const QStringList &args)
d->prog = exe;
d->args = args;
#ifdef Q_OS_WIN
setNativeArguments(QString());
#endif
}
void KProcess::setProgram(const QStringList &argv)
@ -224,9 +200,6 @@ void KProcess::setProgram(const QStringList &argv)
Q_ASSERT( !argv.isEmpty() );
d->args = argv;
d->prog = d->args.takeFirst();
#ifdef Q_OS_WIN
setNativeArguments(QString());
#endif
}
KProcess &KProcess::operator<<(const QString &arg)
@ -257,9 +230,6 @@ void KProcess::clearProgram()
d->prog.clear();
d->args.clear();
#ifdef Q_OS_WIN
setNativeArguments(QString());
#endif
}
void KProcess::setShellCommand(const QString &cmd)
@ -273,9 +243,6 @@ void KProcess::setShellCommand(const QString &cmd)
d->prog = KStandardDirs::findExe(d->args[0]);
if (!d->prog.isEmpty()) {
d->args.removeFirst();
#ifdef Q_OS_WIN
setNativeArguments(QString());
#endif
return;
}
}

View file

@ -622,11 +622,7 @@ void KUrl::setFileName( const QString& _txt )
QString path = this->path();
if ( path.isEmpty() )
#ifdef Q_OS_WIN
path = isLocalFile() ? QDir::rootPath() : QLatin1String("/");
#else
path = QDir::rootPath();
#endif
else
{
int lastSlash = path.lastIndexOf( QLatin1Char('/') );
@ -702,18 +698,7 @@ void KUrl::adjustPath( AdjustPathOption trailing )
QString KUrl::encodedPathAndQuery( AdjustPathOption trailing , const EncodedPathAndQueryOptions &options) const
{
QString encodedPath;
#ifdef Q_OS_WIN
// see KUrl::path()
if (isLocalFile()) {
// ### this is probably broken
encodedPath = trailingSlash(trailing, QUrl::toLocalFile());
encodedPath = QString::fromLatin1(QUrl::toPercentEncoding(encodedPath, "!$&'()*+,;=:@/"));
} else {
encodedPath = trailingSlash(trailing, QString::fromLatin1(QUrl::encodedPath()));
}
#else
encodedPath = trailingSlash(trailing, QString::fromLatin1(QUrl::encodedPath()));
#endif
if ((options & AvoidEmptyPath) && encodedPath.isEmpty()) {
encodedPath.append(QLatin1Char('/'));
@ -1296,11 +1281,7 @@ bool KUrl::cd( const QString& _dir )
}
// absolute path ?
#ifdef Q_OS_WIN
if ( !QFileInfo(_dir).isRelative() )
#else
if ( _dir[0] == QLatin1Char('/') )
#endif
{
//m_strPath_encoded.clear();
setPath( _dir );

View file

@ -1334,11 +1334,7 @@ int main( int argc, char **argv )
parseArgs(app.arguments(), directoryName, inputFilename, codegenFilename);
QString baseDir = directoryName;
#ifdef Q_OS_WIN
if (!baseDir.endsWith('/') && !baseDir.endsWith('\\'))
#else
if (!baseDir.endsWith('/'))
#endif
baseDir.append("/");
if (!codegenFilename.endsWith(QLatin1String(".kcfgc")))

View file

@ -143,12 +143,8 @@ void KComponentDataPrivate::lazyInit(const KComponentData &component)
sharedConfig->reparseConfiguration();
}
#ifdef Q_OS_WIN
if (QCoreApplication::instance() && dirs && kdeLibraryPathsAdded != KdeLibraryPathsAddedDone) {
#else
// the first KComponentData sets the KDE Qt plugin paths
if (dirs && kdeLibraryPathsAdded != KdeLibraryPathsAddedDone) {
#endif
kdeLibraryPathsAdded = KdeLibraryPathsAddedDone;
const QStringList &plugins = dirs->resourceDirs("qtplugins");
QStringList::ConstIterator it = plugins.begin();

View file

@ -61,11 +61,7 @@
#include <QtCore/QFileInfo>
#include <QtCore/QSettings>
#ifdef Q_OS_WIN
static Qt::CaseSensitivity cs = Qt::CaseInsensitive;
#else
static Qt::CaseSensitivity cs = Qt::CaseSensitive;
#endif
class KStandardDirs::KStandardDirsPrivate
{
@ -461,12 +457,6 @@ QString KStandardDirs::findResource( const char *type,
#endif
QString filename(_filename);
#ifdef Q_OS_WIN
if(strcmp(type, "exe") == 0) {
if(!filename.endsWith(QLatin1String(".exe"), Qt::CaseInsensitive))
filename += QLatin1String(".exe");
}
#endif
const QString dir = findResourceDir(type, filename);
if (dir.isEmpty())
return dir;
@ -549,12 +539,6 @@ QString KStandardDirs::findResourceDir( const char *type,
#endif
QString filename(_filename);
#ifdef Q_OS_WIN
if(strcmp(type, "exe") == 0) {
if(!filename.endsWith(QLatin1String(".exe"), Qt::CaseInsensitive))
filename += QLatin1String(".exe");
}
#endif
const QStringList candidates = d->resourceDirs(type, filename);
for (QStringList::ConstIterator it = candidates.begin();
@ -574,14 +558,6 @@ QString KStandardDirs::findResourceDir( const char *type,
bool KStandardDirs::exists(const QString &fullPath)
{
#ifdef Q_OS_WIN
// access() and stat() give a stupid error message to the user
// if the path is not accessible at all (e.g. no disk in A:/ and
// we do stat("A:/.directory")
if (fullPath.endsWith(QLatin1Char('/')))
return QDir(fullPath).exists();
return QFileInfo(fullPath).exists();
#else
KDE_struct_stat buff;
QByteArray cFullPath = QFile::encodeName(fullPath);
if (access(cFullPath, R_OK) == 0 && KDE_stat( cFullPath, &buff ) == 0) {
@ -593,7 +569,6 @@ bool KStandardDirs::exists(const QString &fullPath)
return true;
}
return false;
#endif
}
static void lookupDirectory(const QString& path, const QString &relPart,
@ -786,13 +761,8 @@ KStandardDirs::findAllResources( const char *type,
QStringList candidates;
if ( !QDir::isRelativePath(filter) ) // absolute path
{
#ifdef Q_OS_WIN
candidates << filterPath.left(3); //e.g. "C:\"
filterPath = filterPath.mid(3);
#else
candidates << QString::fromLatin1("/");
filterPath = filterPath.mid(1);
#endif
}
else
{
@ -1105,21 +1075,6 @@ QStringList KStandardDirs::KStandardDirsPrivate::resourceDirs(const char* type,
return candidates;
}
#ifdef Q_OS_WIN
static QStringList executableExtensions()
{
QStringList ret = QString::fromLocal8Bit(qgetenv("PATHEXT")).split(QLatin1Char(';'));
if (!ret.contains(QLatin1String(".exe"), Qt::CaseInsensitive)) {
// If %PATHEXT% does not contain .exe, it is either empty, malformed, or distorted in ways that we cannot support, anyway.
ret.clear();
ret << QLatin1String(".exe")
<< QLatin1String(".com")
<< QLatin1String(".bat")
<< QLatin1String(".cmd");
}
return ret;
}
#endif
QStringList KStandardDirs::systemPaths( const QString& pstr )
{
@ -1220,19 +1175,6 @@ QString KStandardDirs::findExe( const QString& appname,
{
//kDebug(180) << "findExe(" << appname << ", pstr, " << ignoreExecBit << ") called";
#ifdef Q_OS_WIN
QStringList executable_extensions = executableExtensions();
if (!executable_extensions.contains(appname.section(QLatin1Char('.'), -1, -1, QString::SectionIncludeLeadingSep), Qt::CaseInsensitive)) {
QString found_exe;
foreach (const QString& extension, executable_extensions) {
found_exe = findExe(appname + extension, pstr, options);
if (!found_exe.isEmpty()) {
return found_exe;
}
}
return QString();
}
#endif
QFileInfo info;
// absolute or relative path?
@ -1286,16 +1228,6 @@ QString KStandardDirs::findExe( const QString& appname,
int KStandardDirs::findAllExe( QStringList& list, const QString& appname,
const QString& pstr, SearchOptions options )
{
#ifdef Q_OS_WIN
QStringList executable_extensions = executableExtensions();
if (!executable_extensions.contains(appname.section(QLatin1Char('.'), -1, -1, QString::SectionIncludeLeadingSep), Qt::CaseInsensitive)) {
int total = 0;
foreach (const QString& extension, executable_extensions) {
total += findAllExe (list, appname + extension, pstr, options);
}
return total;
}
#endif
QFileInfo info;
QString p;
list.clear();

View file

@ -114,32 +114,6 @@ static KMimeType::Ptr findFromMode( const QString& path /*only used if is_local_
return KMimeType::mimeType( QLatin1String("inode/fifo") );
if ( S_ISSOCK( mode ) )
return KMimeType::mimeType( QLatin1String("inode/socket") );
#ifdef Q_OS_WIN
// FIXME: distinguish between mounted & unmounted
int size = path.size();
if ( size == 2 || size == 3 ) {
//GetDriveTypeW is not defined in wince
#ifndef _WIN32_WCE
unsigned int type = GetDriveTypeW( (LPCWSTR) path.utf16() );
switch( type ) {
case DRIVE_REMOVABLE:
return KMimeType::mimeType( QLatin1String("media/floppy_mounted") );
case DRIVE_FIXED:
return KMimeType::mimeType( QLatin1String("media/hdd_mounted") );
case DRIVE_REMOTE:
return KMimeType::mimeType( QLatin1String("media/smb_mounted") );
case DRIVE_CDROM:
return KMimeType::mimeType( QLatin1String("media/cdrom_mounted") );
case DRIVE_RAMDISK:
return KMimeType::mimeType( QLatin1String("media/hdd_mounted") );
default:
break;
};
#else
return KMimeType::mimeType( QLatin1String("media/hdd_mounted") );
#endif
}
#endif
// remote executable file? stop here (otherwise findFromContent can do that better for local files)
if ( !is_local_file && S_ISREG( mode ) && ( mode & ( S_IXUSR | S_IXGRP | S_IXOTH ) ) )
return KMimeType::mimeType( QLatin1String("application/x-executable") );

View file

@ -636,7 +636,6 @@ void KMimeTypeRepository::checkEssentialMimeTypes()
if (!KMimeType::mimeType(QLatin1String("inode/directory")))
missingMimeTypes.append(QLatin1String("inode/directory"));
#ifndef Q_OS_WIN
//if (!KMimeType::mimeType(QLatin1String("inode/directory-locked")))
// missingMimeTypes.append(QLatin1String("inode/directory-locked"));
if (!KMimeType::mimeType(QLatin1String("inode/blockdevice")))
@ -647,7 +646,6 @@ void KMimeTypeRepository::checkEssentialMimeTypes()
missingMimeTypes.append(QLatin1String("inode/socket"));
if (!KMimeType::mimeType(QLatin1String("inode/fifo")))
missingMimeTypes.append(QLatin1String("inode/fifo"));
#endif
if (!KMimeType::mimeType(QLatin1String("application/x-shellscript")))
missingMimeTypes.append(QLatin1String("application/x-shellscript"));
if (!KMimeType::mimeType(QLatin1String("application/x-executable")))

View file

@ -91,15 +91,7 @@ KSycocaPrivate::KSycocaPrivate()
m_mmapFile(0),
m_device(0)
{
#ifdef Q_OS_WIN
/*
on windows we use KMemFile (QSharedMemory) to avoid problems
with mmap (can't delete a mmap'd file)
*/
m_sycocaStrategy = StrategyMemFile;
#else
m_sycocaStrategy = StrategyMmap;
#endif
KConfigGroup config(KGlobal::config(), "KSycoca");
setStrategyFromString(config.readEntry("strategy"));
}

View file

@ -71,9 +71,7 @@ class KSycocaFileDevice : public KSycocaAbstractDevice
public:
KSycocaFileDevice(const QString& path) {
m_database = new QFile(path);
#ifndef Q_OS_WIN
(void)fcntl(m_database->handle(), F_SETFD, FD_CLOEXEC);
#endif
}
~KSycocaFileDevice() {
delete m_database;

View file

@ -30,10 +30,8 @@
#include <kdebug.h>
#include <kfilterdev.h>
#include <ktempdir.h>
#ifndef Q_OS_WIN
#include <unistd.h> // symlink
#include <errno.h>
#endif
QTEST_KDEMAIN_CORE( KArchiveTest )
@ -79,10 +77,8 @@ static void writeTestFilesToArchive( KArchive* archive )
// Now an empty directory
QVERIFY( archive->writeDir( "aaaemptydir", "user", "group" ) );
#ifndef Q_OS_WIN
// Add local symlink
QVERIFY( archive->addLocalFile( "test3_symlink", "z/test3_symlink") );
#endif
}
enum { WithUserGroup = 1 }; // ListingFlags
@ -172,12 +168,10 @@ static void testFileData( KArchive* archive )
QByteArray secondLine = dev->read(100);
QCOMPARE(QString::fromLatin1(secondLine), QString::fromLatin1("David."));
delete dev;
#ifndef Q_OS_WIN
e = dir->entry( "z/test3_symlink" );
QVERIFY(e);
QVERIFY(e->isFile());
QCOMPARE(e->symLinkTarget(), QString("test3"));
#endif
// Test "./" prefix for KOffice (xlink:href="./ObjectReplacements/Object 1")
e = dir->entry( "./hugefile" );
@ -230,7 +224,6 @@ static void testCopyTo( KArchive* archive )
QVERIFY(fileInfo4.isFile());
QCOMPARE(fileInfo4.size(), Q_INT64_C(29));
#ifndef Q_OS_WIN
const QString fileName = dirName+"z/test3_symlink";
const QFileInfo fileInfo5(fileName);
QVERIFY(fileInfo5.exists());
@ -255,7 +248,6 @@ static void testCopyTo( KArchive* archive )
symLinkTarget = QFile::decodeName(s);
}
QCOMPARE(symLinkTarget, QString("test3"));
#endif
}
/**
@ -281,14 +273,12 @@ void KArchiveTest::setupData()
*/
void KArchiveTest::initTestCase()
{
#ifndef Q_OS_WIN
// Prepare local symlink
QFile::remove("test3_symlink");
if (::symlink("test3", "test3_symlink") != 0) {
qDebug() << errno;
QVERIFY(false);
}
#endif
// For better benchmarks: initialize KMimeTypeFactory magic here
KMimeType::findByContent(QByteArray("hello"));
@ -399,11 +389,9 @@ void KArchiveTest::testReadTar() // testCreateTarGz must have been run first.
QString str = listing[13];
str.replace(QRegExp("mode.*path"), "path" );
QCOMPARE( str, QString("path=z/test3 type=file size=13") );
#ifndef Q_OS_WIN
str = listing[14];
str.replace(QRegExp("mode.*path"), "path" );
QCOMPARE( str, QString("path=z/test3_symlink type=file size=0 symlink=test3") );
#endif
QVERIFY( tar.close() );
@ -771,11 +759,9 @@ void KArchiveTest::testReadZip()
QString str = listing[14];
str.replace(QRegExp("mode.*path"), "path" );
QCOMPARE( str, QString("path=z/test3 type=file size=13") );
#ifndef Q_OS_WIN
str = listing[15];
str.replace(QRegExp("mode.*path"), "path" );
QCOMPARE( str, QString("path=z/test3_symlink type=file size=5 symlink=test3") );
#endif
QVERIFY( zip.close() );
}
@ -940,7 +926,5 @@ void KArchiveTest::cleanupTestCase()
QFile::remove(s_zipMaxLengthFileName);
QFile::remove(s_zipFileName);
QFile::remove(s_zipLocaleFileName);
#ifndef Q_OS_WIN
QFile::remove("test3_symlink");
#endif
}

View file

@ -266,16 +266,12 @@ void KDebugTest::testNoMainComponentData()
proc.setEnv("KDE_DEBUG_NOPROCESSINFO", "1");
proc.setEnv("KDE_DEBUG_TIMESTAMP", "0");
proc.setOutputChannelMode(KProcess::OnlyStderrChannel);
#ifdef Q_OS_WIN
proc << "kdebug_qcoreapptest.exe";
#else
if (QFile::exists("./kdebug_qcoreapptest.shell"))
proc << "./kdebug_qcoreapptest.shell";
else {
QVERIFY(QFile::exists("./kdebug_qcoreapptest"));
proc << "./kdebug_qcoreapptest";
}
#endif
// kDebug() << proc.args();
const int ok = proc.execute();
QVERIFY(ok == 0);

View file

@ -141,15 +141,6 @@ KMacroExpanderTest::expandMacrosShellQuote()
list << QString("element1") << QString("'element2'") << QString("\"element3\"");
map.insert('l', list);
#ifdef Q_OS_WIN
s = "text %l %n text";
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map),
QLatin1String("text element1 'element2' \\^\"element3\\^\" \"Restaurant \"\\^\"\"Chew It\"\\^\" text"));
s = "text \"%l %n\" text";
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map),
QLatin1String("text \"element1 'element2' \"\\^\"\"element3\"\\^\"\" Restaurant \"\\^\"\"Chew It\"\\^\"\"\" text"));
#else
s = "text %l %n text";
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map),
QLatin1String("text element1 ''\\''element2'\\''' '\"element3\"' 'Restaurant \"Chew It\"' text"));
@ -157,7 +148,6 @@ KMacroExpanderTest::expandMacrosShellQuote()
s = "text \"%l %n\" text";
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map),
QLatin1String("text \"element1 'element2' \\\"element3\\\" Restaurant \\\"Chew It\\\"\" text"));
#endif
QHash<QChar,QString> map2;
map2.insert('a', "%n");
@ -165,44 +155,6 @@ KMacroExpanderTest::expandMacrosShellQuote()
map2.insert('u', "http://www.kde.org/index.html");
map2.insert('n', "Restaurant \"Chew It\"");
#ifdef Q_OS_WIN
s = "Title: %a - %f - %u - %n - %% - %VARIABLE% foo";
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("Title: %PERCENT_SIGN%n - filename.txt - http://www.kde.org/index.html - \"Restaurant \"\\^\"\"Chew It\"\\^\" - %PERCENT_SIGN% - %VARIABLE% foo"));
s = "kedit --caption %n %f";
map2.insert('n', "Restaurant 'Chew It'");
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("kedit --caption \"Restaurant 'Chew It'\" filename.txt"));
s = "kedit --caption \"%n\" %f";
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("kedit --caption \"Restaurant 'Chew It'\" filename.txt"));
map2.insert('n', "Restaurant \"Chew It\"");
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("kedit --caption \"Restaurant \"\\^\"\"Chew It\"\\^\"\"\" filename.txt"));
map2.insert('n', "Restaurant %HOME%");
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("kedit --caption \"Restaurant %PERCENT_SIGN%HOME%PERCENT_SIGN%\" filename.txt"));
s = "kedit c:\\%f";
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("kedit c:\\filename.txt"));
s = "kedit \"c:\\%f\"";
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("kedit \"c:\\filename.txt\""));
map2.insert('f', "\"filename.txt\"");
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("kedit \"c:\\\\\"\\^\"\"filename.txt\"\\^\"\"\""));
map2.insert('f', "path\\");
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("kedit \"c:\\path\\\\\"\"\""));
#else
s = "Title: %a - %f - %u - %n - %%";
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("Title: %n - filename.txt - http://www.kde.org/index.html - 'Restaurant \"Chew It\"' - %"));
@ -231,7 +183,6 @@ KMacroExpanderTest::expandMacrosShellQuote()
s = "kedit --caption \"`echo %n`\" %f";
QCOMPARE(KMacroExpander::expandMacrosShellQuote(s, map2),
QLatin1String("kedit --caption \"$( echo 'Restaurant `echo hello`')\" filename.txt"));
#endif
}
class DummyMacroExpander : public KMacroExpanderBase

View file

@ -47,30 +47,13 @@ KShellTest::tildeExpand()
QCOMPARE(KShell::tildeExpand("~/dir"), QString(QDir::homePath()+"/dir"));
QCOMPARE(KShell::tildeExpand('~' + me), QDir::homePath());
QCOMPARE(KShell::tildeExpand('~' + me + "/dir"), QString(QDir::homePath()+"/dir"));
#ifdef Q_OS_WIN
QCOMPARE(KShell::tildeExpand("^~" + me), QString('~' + me));
#else
QCOMPARE(KShell::tildeExpand("\\~" + me), QString('~' + me));
#endif
}
void
KShellTest::quoteArg()
{
#ifdef Q_OS_WIN
QCOMPARE(KShell::quoteArg("a space"), QString("\"a space\""));
QCOMPARE(KShell::quoteArg("fds\\\""), QString("fds\\\\\\^\""));
QCOMPARE(KShell::quoteArg("\\\\foo"), QString("\\\\foo"));
QCOMPARE(KShell::quoteArg("\"asdf\""), QString("\\^\"asdf\\^\""));
QCOMPARE(KShell::quoteArg("with\\"), QString("\"with\\\\\""));
QCOMPARE(KShell::quoteArg("\\\\"), QString("\"\\\\\\\\\""));
QCOMPARE(KShell::quoteArg("\"a space\\\""), QString("\\^\"\"a space\"\\\\\\^\""));
QCOMPARE(KShell::quoteArg("as df\\"), QString("\"as df\\\\\""));
QCOMPARE(KShell::quoteArg("foo bar\"\\\"bla"), QString("\"foo bar\"\\^\"\\\\\\^\"\"bla\""));
QCOMPARE(KShell::quoteArg("a % space"), QString("\"a %PERCENT_SIGN% space\""));
#else
QCOMPARE(KShell::quoteArg("a space"), QString("'a space'"));
#endif
}
void
@ -91,39 +74,6 @@ KShellTest::splitJoin()
{
KShell::Errors err = KShell::NoError;
#ifdef Q_OS_WIN
QCOMPARE(sj("\"(sulli)\" text", KShell::NoOptions, &err),
QString("\"(sulli)\" text"));
QVERIFY(err == KShell::NoError);
QCOMPARE(sj(" ha\\ lo ", KShell::NoOptions, &err),
QString("\"ha\\\\\" lo"));
QVERIFY(err == KShell::NoError);
QCOMPARE(sj("say \" error", KShell::NoOptions, &err),
QString());
QVERIFY(err == KShell::BadQuoting);
QCOMPARE(sj("no \" error\"", KShell::NoOptions, &err),
QString("no \" error\""));
QVERIFY(err == KShell::NoError);
QCOMPARE(sj("say \" still error", KShell::NoOptions, &err),
QString());
QVERIFY(err == KShell::BadQuoting);
QCOMPARE(sj("BLA;asdf sdfess d", KShell::NoOptions, &err),
QString("\"BLA;asdf\" sdfess d"));
QVERIFY(err == KShell::NoError);
QCOMPARE(sj("B\"L\"A&sdf FOO|bar sdf wer ", KShell::NoOptions, &err),
QString("\"BLA&sdf\" \"FOO|bar\" sdf wer"));
QVERIFY(err == KShell::NoError);
QCOMPARE(sj("\"\"\"just \"\" fine\"\"\"", KShell::NoOptions, &err),
QString("\\^\"\"just \"\\^\"\" fine\"\\^\""));
QVERIFY(err == KShell::NoError);
#else
QCOMPARE(sj("\"~qU4rK\" 'text' 'jo'\"jo\" $'crap' $'\\\\\\'\\e\\x21' ha\\ lo \\a", KShell::NoOptions, &err),
QString("'~qU4rK' text jojo crap '\\'\\''\x1b!' 'ha lo' a"));
QVERIFY(err == KShell::NoError);
@ -151,7 +101,6 @@ KShellTest::splitJoin()
QCOMPARE(sj("~qU4rK ~" + KUser().loginName(), KShell::TildeExpand, &err),
QString("'~qU4rK' " + QDir::homePath()));
QVERIFY(err == KShell::NoError);
#endif
}
void
@ -163,33 +112,6 @@ KShellTest::abortOnMeta()
QString("text"));
QVERIFY(err1 == KShell::NoError);
#ifdef Q_OS_WIN
QVERIFY(KShell::splitArgs("BLA & asdf sdfess d", KShell::AbortOnMeta, &err1).isEmpty());
QVERIFY(err1 == KShell::FoundMeta);
QVERIFY(KShell::splitArgs("foo %PATH% bar", KShell::AbortOnMeta, &err1).isEmpty());
QVERIFY(err1 == KShell::FoundMeta);
QCOMPARE(sj("foo %PERCENT_SIGN% bar", KShell::AbortOnMeta, &err1),
QString("foo %PERCENT_SIGN% bar"));
QVERIFY(err1 == KShell::NoError);
QCOMPARE(sj("@foo ^& bar", KShell::AbortOnMeta, &err1),
QString("foo \"&\" bar"));
QVERIFY(err1 == KShell::NoError);
QCOMPARE(sj("\"BLA|asdf\" sdfess d", KShell::AbortOnMeta, &err1),
QString("\"BLA|asdf\" sdfess d"));
QVERIFY(err1 == KShell::NoError);
QCOMPARE(sj("B\"L\"A\"|\"sdf \"FOO | bar\" sdf wer", KShell::AbortOnMeta, &err1),
QString("\"BLA|sdf\" \"FOO | bar\" sdf wer"));
QVERIFY(err1 == KShell::NoError);
QCOMPARE(sj("b-q me \\\\^|\\\\\\^\"", KShell::AbortOnMeta, &err1),
QString("b-q me \"\\\\|\"\\\\\\^\""));
QVERIFY(err1 == KShell::NoError);
#else
QCOMPARE(sj("say \" error", KShell::NoOptions, &err1),
QString());
QVERIFY(err1 != KShell::NoError);
@ -209,7 +131,6 @@ KShellTest::abortOnMeta()
QVERIFY(sj("B\"L\"A=say FOO=bar echo meta", KShell::NoOptions, &err1) ==
sj("B\"L\"A=say FOO=bar echo meta", KShell::AbortOnMeta, &err2));
QVERIFY(err1 == err2);
#endif
}
QTEST_KDEMAIN_CORE(KShellTest)

View file

@ -34,13 +34,8 @@ QTEST_KDEMAIN_CORE( KStandarddirsTest )
#include <config.h>
// we need case-insensitive comparison of file paths on windows
#ifdef Q_OS_WIN
#define QCOMPARE_PATHS(x,y) QCOMPARE(QString(x).toLower(), QString(y).toLower())
#define PATH_SENSITIVITY Qt::CaseInsensitive
#else
#define QCOMPARE_PATHS(x,y) QCOMPARE(QString(x), QString(y))
#define PATH_SENSITIVITY Qt::CaseSensitive
#endif
void KStandarddirsTest::initTestCase()
{
@ -425,7 +420,6 @@ void KStandarddirsTest::testRestrictedResources()
void KStandarddirsTest::testSymlinkResolution()
{
#ifndef Q_OS_WIN
// This makes the save location for the david resource, "$HOME/.kde-unit-test/symlink/test/"
// where symlink points to "real", and the subdir test will be created later
// This used to confuse KStandardDirs and make it return unresolved paths,
@ -458,7 +452,6 @@ void KStandarddirsTest::testSymlinkResolution()
QCOMPARE(KStandardDirs::realPath(QString("/")), QString("/"));
QCOMPARE(KStandardDirs::realPath(QString("/does_not_exist/")), QString("/does_not_exist/"));
#endif
}
#include <QThreadPool>

View file

@ -719,10 +719,6 @@ void KUrlTest::testSetFileName() // and addPath
QCOMPARE( singleFile.pathOrUrl(), QString("foo.txt") );
QString pre;
#ifdef Q_OS_WIN
// On Windows we explicitly prepend a slash, see KUrl::setPath
pre = '/';
#endif
singleFile.setFileName( "bar.bin" );
QCOMPARE( singleFile.path(), QString(pre + "bar.bin") );
QCOMPARE( singleFile.pathOrUrl(), QString(pre + "bar.bin") );

View file

@ -61,24 +61,6 @@ extern QString makeLibName( const QString &libname );
extern QString findLibrary(const QString &name, const KComponentData &cData);
#ifdef Q_OS_WIN
// removes "lib" prefix, if present
QString fixLibPrefix(const QString& libname)
{
int pos = libname.lastIndexOf( QLatin1Char('/') );
if ( pos >= 0 )
{
QString file = libname.mid( pos + 1 );
QString path = libname.left( pos );
if( !file.startsWith( QLatin1String("lib") ) )
return libname;
return path + QLatin1Char('/') + file.mid( 3 );
}
if( !libname.startsWith( QLatin1String("lib") ) )
return libname;
return libname.mid( 3 );
}
#endif
//static
QString KLibLoader::findLibrary(const QString &_name, const KComponentData &cData)

View file

@ -39,33 +39,6 @@ int kLibraryDebugArea() {
QString findLibrary(const QString &name, const KComponentData &cData)
{
QString libname = findLibraryInternal(name, cData);
#ifdef Q_OS_WIN
// we don't have 'lib' prefix on windows -> remove it and try again
if( libname.isEmpty() )
{
libname = name;
QString file, path;
int pos = libname.lastIndexOf( QLatin1Char('/') );
if ( pos >= 0 )
{
file = libname.mid( pos + 1 );
path = libname.left( pos );
libname = path + QLatin1Char('/') + file.mid( 3 );
}
else
{
file = libname;
libname = file.mid( 3 );
}
if( !file.startsWith( QLatin1String("lib") ) )
return file;
libname = findLibraryInternal(libname, cData);
if( libname.isEmpty() )
libname = name;
}
#endif
return libname;
}
@ -112,11 +85,6 @@ static KPluginFactory* kde3Factory(KLibrary *lib, const QByteArray &factoryname)
t_func func = reinterpret_cast<t_func>(lib->resolveFunction( symname ));
if ( !func )
{
#ifdef Q_OS_WIN
// a backup for cases when developer has set lib prefix for a plugin name (she should not...)
if (!factoryname.startsWith(QByteArray("lib")))
return kde3Factory(lib, QByteArray("lib")+symname.mid(5 /*"init_"*/));
#endif
kDebug(kLibraryDebugArea()) << "The library" << lib->fileName() << "does not offer an"
<< symname << "function.";
return 0;

View file

@ -76,9 +76,6 @@ inline QString makeLibName( const QString &libname )
#endif
}
#ifdef Q_OS_WIN
extern QString fixLibPrefix(const QString& libname);
#endif
QString findLibraryInternal(const QString &name, const KComponentData &cData)
{

View file

@ -46,11 +46,7 @@ QString KShell::joinArgs( const QStringList &args )
return ret;
}
#ifdef Q_OS_WIN
# define ESCAPE '^'
#else
# define ESCAPE '\\'
#endif
QString KShell::tildeExpand( const QString &fname )
{

View file

@ -32,16 +32,11 @@ class QString;
class QStringList;
template <class T> class QList;
#ifdef Q_OS_WIN
typedef void *K_UID;
typedef void *K_GID;
#else
#include <sys/types.h>
typedef uid_t K_UID;
typedef gid_t K_GID;
struct passwd;
struct group;
#endif
/**
@ -103,7 +98,6 @@ public:
*/
explicit KUser(const char* name);
#ifndef Q_OS_WIN
/**
* Creates an object from a passwd structure.
* If the pointer is null isValid() will return false.
@ -111,7 +105,6 @@ public:
* @param p the passwd structure to create the user from
*/
explicit KUser(const passwd *p);
#endif
/**
* Creates an object from another KUser object
@ -151,13 +144,11 @@ public:
*/
K_UID uid() const;
#ifndef Q_OS_WIN
/**
* Returns the group id of the user.
* @return the id of the group or -1 if user is invalid
*/
K_GID gid() const;
#endif
/**
* Checks whether the user is the super user (root).
@ -277,7 +268,6 @@ public:
*/
explicit KUserGroup(const char *name);
#ifndef Q_OS_WIN
/**
* Create an object from the group of the current user.
* @param mode if #KUser::UseEffectiveUID is passed the effective user
@ -303,7 +293,6 @@ public:
* @param g the group structure to create the group from.
*/
explicit KUserGroup(const group *g);
#endif
/**
* Creates a new KUserGroup instance from another KUserGroup object
@ -340,13 +329,11 @@ public:
*/
bool isValid() const;
#ifndef Q_OS_WIN
/**
* Returns the group id of the group.
* @return the group id of the group or -1 if the group is invalid
*/
K_GID gid() const;
#endif
/**
* The name of the group.

View file

@ -95,11 +95,7 @@ QStringList VFolderMenu::allDirectories()
QString previous = *it++;
for(;it != m_allDirectories.end();)
{
#ifndef Q_OS_WIN
if ((*it).startsWith(previous))
#else
if ((*it).startsWith(previous, Qt::CaseInsensitive))
#endif
{
it = m_allDirectories.erase(it);
}
@ -1272,11 +1268,7 @@ kDebug(7021) << "Processing KDE Legacy dirs for <KDE>";
QString prefix = e.attributes().namedItem("prefix").toAttr().value();
#ifndef Q_OS_WIN
if (m_defaultLegacyDirs.contains(dir))
#else
if (m_defaultLegacyDirs.contains(dir, Qt::CaseInsensitive))
#endif
{
if (!kdeLegacyDirsDone)
{

View file

@ -30,9 +30,6 @@
#include <QtCore/QFile>
#include <QtGui/QDesktopWidget>
#ifdef Q_OS_WIN
#include <QtCore/QDir>
#endif
#include <kconfig.h>
#include <kconfiggroup.h>
@ -160,21 +157,12 @@ void KRecentFilesAction::addUrl( const KUrl& _url, const QString& name )
if ( url.isLocalFile() && KGlobal::dirs()->relativeLocation("tmp", url.toLocalFile()) != url.toLocalFile() )
return;
const QString tmpName = name.isEmpty() ? url.fileName() : name;
#ifdef Q_OS_WIN
const QString file = url.isLocalFile() ? QDir::toNativeSeparators( url.pathOrUrl() ) : url.pathOrUrl();
#else
const QString file = url.pathOrUrl();
#endif
// remove file if already in list
foreach (QAction* action, selectableActionGroup()->actions())
{
#ifdef Q_OS_WIN
const QString tmpFileName = url.isLocalFile() ? QDir::toNativeSeparators( d->m_urls[action].pathOrUrl() ) : d->m_urls[action].pathOrUrl();
if ( tmpFileName.endsWith(file, Qt::CaseInsensitive) )
#else
if ( d->m_urls[action].pathOrUrl().endsWith(file) )
#endif
{
removeAction(action)->deleteLater();
break;
@ -295,11 +283,6 @@ void KRecentFilesAction::loadEntries( const KConfigGroup& _config)
if (d->m_urls.values().contains(url))
continue;
#ifdef Q_OS_WIN
// convert to backslashes
if ( url.isLocalFile() )
value = QDir::toNativeSeparators( value );
#endif
nameKey = QString( "Name%1" ).arg( i );
nameValue = cg.readPathEntry( nameKey, url.fileName() );

View file

@ -63,16 +63,12 @@ void KGlobalSettingsTest::initTestCase()
static void callClient( const QString& opt, const char* signalToWaitFor ) {
KProcess proc;
#ifdef Q_OS_WIN
proc << "kglobalsettingsclient.exe";
#else
if (QFile::exists("./kglobalsettingsclient.shell"))
proc << "./kglobalsettingsclient.shell";
else {
QVERIFY(QFile::exists("./kglobalsettingsclient"));
proc << "./kglobalsettingsclient";
}
#endif
proc << opt;
// kDebug() << proc.args();
int ok = proc.execute();

View file

@ -42,16 +42,12 @@ private Q_SLOTS:
// Duplicated from kglobalsettingstest.cpp - make a shared helper method?
KProcess* proc = new KProcess(this);
const QString appName = "kuniqueapptest";
#ifdef Q_OS_WIN
(*proc) << appName + ".exe";
#else
if (QFile::exists(appName+".shell"))
(*proc) << "./" + appName+".shell";
else {
Q_ASSERT(QFile::exists(appName));
(*proc) << "./" + appName;
}
#endif
proc->start();
}
private:

View file

@ -73,9 +73,6 @@
#include <ucontext.h>
#endif
#if defined(Q_OS_WIN)
# include <windows.h>
#endif
static KCrash::HandlerType s_emergencySaveFunction = 0;
static KCrash::HandlerType s_crashHandler = 0;
@ -92,9 +89,6 @@ namespace KCrash
{
void startProcess(int argc, const char *argv[], bool waitAndExit);
#if defined(Q_OS_WIN)
LONG WINAPI win32UnhandledExceptionFilter(_EXCEPTION_POINTERS *exceptionInfo);
#endif
}
void
@ -226,16 +220,6 @@ bool KCrash::isDrKonqiEnabled()
void
KCrash::setCrashHandler (HandlerType handler)
{
#if defined(Q_OS_WIN)
static LPTOP_LEVEL_EXCEPTION_FILTER s_previousExceptionFilter = NULL;
if (handler && !s_previousExceptionFilter) {
s_previousExceptionFilter = SetUnhandledExceptionFilter(KCrash::win32UnhandledExceptionFilter);
} else if (!handler && s_previousExceptionFilter) {
SetUnhandledExceptionFilter(s_previousExceptionFilter);
s_previousExceptionFilter = NULL;
}
#else
if (!handler)
handler = SIG_DFL;
@ -264,7 +248,6 @@ KCrash::setCrashHandler (HandlerType handler)
#endif
sigprocmask(SIG_UNBLOCK, &mask, 0);
#endif
s_crashHandler = handler;
}
@ -293,10 +276,8 @@ KCrash::defaultCrashHandler (int sig)
static int crashRecursionCounter = 0;
crashRecursionCounter++; // Nothing before this, please !
#if !defined(Q_OS_WIN)
signal(SIGALRM, SIG_DFL);
alarm(3); // Kill me... (in case we deadlock in malloc)
#endif
#ifdef Q_OS_SOLARIS
(void) printstack(2 /* stderr, assuming it's still open. */);
@ -348,9 +329,7 @@ KCrash::defaultCrashHandler (int sig)
if (!s_launchDrKonqi) {
setCrashHandler(0);
#if !defined(Q_OS_WIN)
raise(sig); // dump core, or whatever is the default action for this signal.
#endif
return;
}
@ -428,12 +407,6 @@ KCrash::defaultCrashHandler (int sig)
if ((s_flags & AutoRestart) && s_autoRestartCommand)
argv[i++] = "--restarted"; //tell drkonqi if the app has been restarted
#if defined(Q_OS_WIN)
char threadId[8] = { 0 };
sprintf( threadId, "%d", GetCurrentThreadId() );
argv[i++] = "--thread";
argv[i++] = threadId;
#endif
// NULL terminated list
argv[i] = NULL;
@ -449,67 +422,6 @@ KCrash::defaultCrashHandler (int sig)
_exit(255);
}
#if defined(Q_OS_WIN)
void KCrash::startProcess(int argc, const char *argv[], bool waitAndExit)
{
QString cmdLine;
for(int i=0; i<argc; ++i) {
cmdLine.append('\"');
cmdLine.append(QFile::decodeName(argv[i]));
cmdLine.append("\" ");
}
PROCESS_INFORMATION procInfo;
STARTUPINFOW startupInfo = { sizeof( STARTUPINFO ), 0, 0, 0,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
(ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
bool success = CreateProcess(0, (wchar_t*) cmdLine.utf16(), NULL, NULL,
false, CREATE_UNICODE_ENVIRONMENT, NULL, NULL,
&startupInfo, &procInfo);
if (success && waitAndExit) {
// wait for child to exit
WaitForSingleObject(procInfo.hProcess, INFINITE);
_exit(253);
}
}
//glue function for calling the unix signal handler from the windows unhandled exception filter
LONG WINAPI KCrash::win32UnhandledExceptionFilter(_EXCEPTION_POINTERS *exceptionInfo)
{
// kdbgwin needs the context inside exceptionInfo because if getting the context after the
// exception happened, it will walk down the stack and will stop at KiUserEventDispatch in
// ntdll.dll, which is supposed to dispatch the exception from kernel mode back to user mode
// so... let's create some shared memory
HANDLE hMapFile = NULL;
hMapFile = CreateFileMapping(
INVALID_HANDLE_VALUE,
NULL,
PAGE_READWRITE,
0,
sizeof(CONTEXT),
TEXT("Local\\KCrashShared"));
LPCTSTR pBuf = NULL;
pBuf = (LPCTSTR) MapViewOfFile(
hMapFile,
FILE_MAP_ALL_ACCESS,
0,
0,
sizeof(CONTEXT));
CopyMemory((PVOID) pBuf, exceptionInfo->ContextRecord, sizeof(CONTEXT));
if (s_crashHandler) {
s_crashHandler(exceptionInfo->ExceptionRecord->ExceptionCode);
}
CloseHandle(hMapFile);
return EXCEPTION_EXECUTE_HANDLER; //allow windows to do the default action (terminate)
}
#else
static bool startProcessInternal(int argc, const char *argv[], bool waitAndExit, bool directly);
static pid_t startFromKdeinit(int argc, const char *argv[]);
@ -826,4 +738,3 @@ static int openSocket()
return s;
}
#endif // Q_OS_UNIX

View file

@ -15,12 +15,6 @@
#include <stdlib.h>
#include <stdarg.h>
#ifdef Q_OS_WIN
#include <config-kdoctools.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QHash>
#endif
#if !defined( SIMPLE_XSLT )
extern HelpProtocol *slave;

View file

@ -208,17 +208,6 @@ void KDirSelectDialog::Private::slotComboTextChanged( const QString& text )
{
m_treeView->blockSignals(true);
KUrl url( text );
#ifdef Q_OS_WIN
if( url.isLocalFile() && !m_treeView->rootUrl().isParentOf( url ) )
{
KUrl tmp = url.upUrl();
while(tmp != KUrl("file:///")) {
url = tmp;
tmp = url.upUrl();
}
m_treeView->setRootUrl( url );
}
#endif
m_treeView->setCurrentUrl( url );
m_treeView->blockSignals( false );
}

View file

@ -129,7 +129,7 @@ KFilePlacesModel::KFilePlacesModel(QObject *parent)
info.absoluteFilePath(), info.absoluteFilePath(),
KUrl(info.absoluteFilePath()), driveIcon);
}
#elif !defined(Q_OS_WIN)
#else
KFilePlacesItem::createSystemBookmark(d->bookmarkManager,
"Root", I18N_NOOP2("KFile System Bookmarks", "Root"),
KUrl("/"), "folder-red");

View file

@ -701,11 +701,7 @@ QString KUrlNavigator::Private::firstButtonText() const
if (text.isEmpty()) {
const KUrl currentUrl = q->locationUrl();
if (currentUrl.isLocalFile()) {
#ifdef Q_OS_WIN
text = currentUrl.path().length() > 1 ? currentUrl.path().left(2) : QDir::rootPath();
#else
text = m_showFullPath ? QLatin1String("/") : i18n("Custom Path");
#endif
} else {
text = currentUrl.protocol() + QLatin1Char(':');
if (!currentUrl.host().isEmpty()) {
@ -734,11 +730,7 @@ KUrl KUrlNavigator::Private::buttonUrl(int index) const
if (index == 0) {
// prevent the last "/" from being stripped
// or we end up with an empty path
#ifdef Q_OS_WIN
pathOrUrl = pathOrUrl.length() > 1 ? pathOrUrl.left(2) : QDir::rootPath();
#else
pathOrUrl = QLatin1String("/");
#endif
} else {
pathOrUrl = pathOrUrl.section('/', 0, index);
}

View file

@ -36,12 +36,7 @@
#error "TEST_DATA not set. An XML file describing a computer is required for this test"
#endif
#ifdef Q_OS_WIN
//c:\ as root for windows
#define KDE_ROOT_PATH "C:\\"
#else
#define KDE_ROOT_PATH "/"
#endif
class KFilePlacesModelTest : public QObject
{

View file

@ -29,12 +29,7 @@
#include <kmountpoint.h>
#ifdef Q_OS_WIN
#include <QtCore/QDir>
#include <windows.h>
#else
#include <sys/statvfs.h>
#endif
class KDiskFreeSpaceInfo::Private : public QSharedData
@ -116,18 +111,6 @@ KDiskFreeSpaceInfo KDiskFreeSpaceInfo::freeSpaceInfo( const QString& path )
if (mp)
info.d->mountPoint = mp->mountPoint();
#ifdef Q_OS_WIN
quint64 availUser;
QFileInfo fi(info.d->mountPoint);
QString dir = QDir::toNativeSeparators(fi.absoluteDir().canonicalPath());
if(GetDiskFreeSpaceExW((LPCWSTR)dir.utf16(),
(PULARGE_INTEGER)&availUser,
(PULARGE_INTEGER)&info.d->size,
(PULARGE_INTEGER)&info.d->available) != 0) {
info.d->valid = true;
}
#else
struct statvfs statvfs_buf;
// Prefer mountPoint if available, so that it even works with non-existing files.
@ -138,7 +121,6 @@ KDiskFreeSpaceInfo KDiskFreeSpaceInfo::freeSpaceInfo( const QString& path )
info.d->size = statvfs_buf.f_blocks * blksize;
info.d->valid = true;
}
#endif
return info;
}

View file

@ -121,9 +121,7 @@ extern "C" {
#include <kcapacitybar.h>
#include <kfileitemlistproperties.h>
#ifndef Q_OS_WIN
#include "kfilesharedialog.h"
#endif
#include "ui_kpropertiesdesktopbase.h"
#include "ui_kpropertiesdesktopadvbase.h"

View file

@ -51,10 +51,8 @@
#include <kdesktopfile.h>
#include <kmountpoint.h>
#include <kconfiggroup.h>
#ifndef Q_OS_WIN
#include <knfsshare.h>
#include <ksambashare.h>
#endif
#include <kfilesystemtype_p.h>
class KFileItemPrivate : public QSharedData
@ -976,7 +974,6 @@ QStringList KFileItem::overlays() const
names.append("hidden");
}
#ifndef Q_OS_WIN
if( S_ISDIR( d->m_fileMode ) && d->m_bIsLocalUrl)
{
if (KSambaShare::instance()->isDirectoryShared( d->m_url.toLocalFile() ) ||
@ -986,7 +983,6 @@ QStringList KFileItem::overlays() const
names.append("network-workgroup");
}
}
#endif // Q_OS_WIN
if ( d->m_pMimeType && d->m_url.fileName().endsWith( QLatin1String( ".gz" ) ) &&
d->m_pMimeType->is("application/x-gzip") ) {

View file

@ -205,9 +205,7 @@ void KMimeTypeChooserPrivate::_k_editMimeType()
q, SLOT(_k_slotSycocaDatabaseChanged(QStringList)) );
QString keditfiletype = QString::fromLatin1("keditfiletype");
KRun::runCommand( keditfiletype
#ifndef Q_OS_WIN
+ " --parent " + QString::number( (ulong)q->topLevelWidget()->winId())
#endif
+ " --caption " + KShell::quoteArg(KGlobal::caption())
+ ' ' + KShell::quoteArg(mt),
keditfiletype, keditfiletype /*unused*/, q->topLevelWidget());

View file

@ -33,9 +33,6 @@
#include <QtCore/QPair>
#include <QtCore/QStringList>
#ifdef Q_OS_WIN
#undef ERROR
#endif
class KUriFilterPrivate;
class KUriFilterDataPrivate;

View file

@ -769,9 +769,7 @@ bool KUrlCompletionPrivate::userCompletion(const KUrlCompletionPrivate::MyURL& u
// Environment variables
//
#ifndef Q_OS_WIN
extern char** environ; // Array of environment variables
#endif
bool KUrlCompletionPrivate::envCompletion(const KUrlCompletionPrivate::MyURL& url, QString* pMatch)
{

View file

@ -296,13 +296,7 @@ KOpenSSLProxy::KOpenSSLProxy()
if (!upath.isEmpty())
libpaths << upath;
#ifdef Q_OS_WIN
d->cryptoLib = new KLibrary("libeay32.dll");
if (!d->cryptoLib->load()) {
delete d->cryptoLib;
d->cryptoLib = 0;
}
#elif defined(__OpenBSD__)
#if defined(__OpenBSD__)
{
QString libname = findMostRecentLib("/usr/lib" KDELIBSUFF, "crypto");
if (!libname.isNull()) {
@ -530,13 +524,7 @@ KOpenSSLProxy::KOpenSSLProxy()
#endif
}
#ifdef Q_OS_WIN
d->sslLib = new KLibrary("ssleay32.dll");
if (!d->sslLib->load()) {
delete d->sslLib;
d->sslLib = 0;
}
#elif defined(__OpenBSD__)
#if defined(__OpenBSD__)
{
QString libname = findMostRecentLib("/usr/lib", "ssl");
if (!libname.isNull()) {

View file

@ -51,11 +51,6 @@ static void setTimeStamp( const QString& path, const QDateTime& mtime )
utbuf.modtime = utbuf.actime;
utime( QFile::encodeName( path ), &utbuf );
//qDebug( "Time changed for %s", qPrintable( path ) );
#elif defined(Q_OS_WIN)
struct _utimbuf utbuf;
utbuf.actime = mtime.toTime_t();
utbuf.modtime = utbuf.actime;
_wutime(reinterpret_cast<const wchar_t *>(path.utf16()), &utbuf);
#endif
}

View file

@ -46,11 +46,6 @@
#include <QtXml/qdom.h>
#include <QtCore/Q_PID>
#if defined(Q_OS_WIN)
#include <windows.h>
#define _WIN32_IE 0x0500
#include <shlobj.h>
#endif
using namespace KNS;

View file

@ -46,11 +46,6 @@
#include <QtXml/qdom.h>
#include <QtCore/Q_PID>
#if defined(Q_OS_WIN)
#include <windows.h>
#define _WIN32_IE 0x0500
#include <shlobj.h>
#endif
// libattica
#include <attica/providermanager.h>

View file

@ -37,10 +37,6 @@
#include "kdebug.h"
#include "core/security.h"
#ifdef Q_OS_WIN
#include <windows.h>
#include <shlobj.h>
#endif
using namespace KNS3;

View file

@ -50,7 +50,6 @@ namespace Solid
Networking::ManagementPolicy disconnectPolicy;
public Q_SLOTS:
uint status() const;
#ifndef Q_OS_WIN
/**
* Called on DBus signal from the network status service
*/
@ -60,16 +59,9 @@ namespace Solid
* may proceed
*/
void serviceOwnerChanged( const QString &, const QString &, const QString & );
#else
void serviceStatusChanged( bool status );
#endif
private:
void initialize();
#ifndef Q_OS_WIN
OrgKdeSolidNetworkingClientInterface * iface;
#else
QNetworkConfigurationManager *m_manager;
#endif
};
} // namespace Solid
#endif