mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
windows code remove
This commit is contained in:
parent
3b5414e018
commit
c3f3bcb965
81 changed files with 5 additions and 1410 deletions
|
@ -68,11 +68,7 @@ KConfigPrivate::KConfigPrivate(const KComponentData &componentData_, KConfig::Op
|
|||
if (use_etc_kderc) {
|
||||
|
||||
etc_kderc =
|
||||
#ifdef Q_WS_WIN
|
||||
QFile::decodeName( qgetenv("WINDIR") + "/kde4rc" );
|
||||
#else
|
||||
QLatin1String("/etc/kde4rc");
|
||||
#endif
|
||||
if (!KStandardDirs::checkAccess(etc_kderc, R_OK)) {
|
||||
etc_kderc.clear();
|
||||
}
|
||||
|
|
|
@ -372,19 +372,11 @@ QVariant KConfigGroup::convertToQVariant(const char *pKey, const QByteArray& val
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
# include <QtCore/QDir>
|
||||
#endif
|
||||
|
||||
static bool cleanHomeDirPath( QString &path, const QString &homeDir )
|
||||
{
|
||||
#ifdef Q_WS_WIN //safer
|
||||
if (!QDir::convertSeparators(path).startsWith(QDir::convertSeparators(homeDir)))
|
||||
return false;
|
||||
#else
|
||||
if (!path.startsWith(homeDir))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
int len = homeDir.length();
|
||||
// replace by "$HOME" if possible
|
||||
|
|
|
@ -33,16 +33,8 @@
|
|||
#include "kdebug.h"
|
||||
#include <QThreadStorage>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <fcntl.h>
|
||||
#include <windows.h>
|
||||
#ifndef _WIN32_WCE
|
||||
#include <wincon.h>
|
||||
#endif
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
#undef kDebug
|
||||
|
|
|
@ -765,10 +765,8 @@ void KDirWatchPrivate::addEntry(KDirWatch* instance, const QString& _path,
|
|||
{
|
||||
QString path (_path);
|
||||
if (path.isEmpty()
|
||||
#ifndef Q_WS_WIN
|
||||
|| path == QLatin1String("/dev")
|
||||
|| (path.startsWith(QLatin1String("/dev/")) && !path.startsWith(QLatin1String("/dev/.")))
|
||||
#endif
|
||||
)
|
||||
return; // Don't even go there.
|
||||
|
||||
|
@ -1320,9 +1318,6 @@ void KDirWatchPrivate::emitEvent(const Entry* e, int event, const QString &fileN
|
|||
else {
|
||||
#ifdef Q_OS_UNIX
|
||||
path += QLatin1Char('/') + fileName;
|
||||
#elif defined(Q_WS_WIN)
|
||||
//current drive is passed instead of /
|
||||
path += QDir::currentPath().left(2) + QLatin1Char('/') + fileName;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,42 +73,8 @@ class QSocketNotifier;
|
|||
#ifdef HAVE_QFILESYSTEMWATCHER
|
||||
#include <QtCore/QFileSystemWatcher>
|
||||
|
||||
#if defined Q_WS_WIN
|
||||
/* Helper implemented as a workaround for limitation on Windows:
|
||||
* the maximum number of object handles is MAXIMUM_WAIT_OBJECTS (64) per thread.
|
||||
*
|
||||
* From http://msdn.microsoft.com/en-us/library/ms687025(VS.85).aspx
|
||||
* "To wait on more than MAXIMUM_WAIT_OBJECTS handles, create a thread to wait
|
||||
* on MAXIMUM_WAIT_OBJECTS handles, then wait on that thread plus the other handles.
|
||||
* Use this technique to break the handles into groups of MAXIMUM_WAIT_OBJECTS."
|
||||
*
|
||||
* QFileSystemWatcher is implemented as thread, so KFileSystemWatcher
|
||||
* allocates more QFileSystemWatcher instances on demand (and deallocates them later).
|
||||
*/
|
||||
class KFileSystemWatcher : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KFileSystemWatcher();
|
||||
~KFileSystemWatcher();
|
||||
void addPath(const QString &file);
|
||||
void removePath(const QString &file);
|
||||
|
||||
Q_SIGNALS:
|
||||
void fileChanged(const QString &path);
|
||||
void directoryChanged(const QString &path);
|
||||
|
||||
private:
|
||||
QFileSystemWatcher* availableWatcher();
|
||||
QFileSystemWatcher* m_recentWatcher;
|
||||
QList<QFileSystemWatcher*> m_watchers;
|
||||
QHash<QFileSystemWatcher*, uint> m_usedObjects;
|
||||
QHash<QString,QFileSystemWatcher*> m_paths;
|
||||
};
|
||||
#else
|
||||
typedef QFileSystemWatcher KFileSystemWatcher;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* KDirWatchPrivate is a singleton and does the watching
|
||||
* for every KDirWatch instance in the application.
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
|
||||
#include "kstandarddirs.h"
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <windows.h>
|
||||
#include <QDir>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
static Qt::CaseSensitivity cs = Qt::CaseInsensitive;
|
||||
|
@ -207,9 +203,6 @@ void KMountPoint::Private::finalizeCurrentMountPoint(DetailsNeededFlags infoNeed
|
|||
|
||||
KMountPoint::List KMountPoint::possibleMountPoints(DetailsNeededFlags infoNeeded)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return KMountPoint::currentMountPoints(infoNeeded);
|
||||
#endif
|
||||
|
||||
KMountPoint::List result;
|
||||
|
||||
|
@ -400,22 +393,6 @@ KMountPoint::List KMountPoint::currentMountPoints(DetailsNeededFlags infoNeeded)
|
|||
}
|
||||
|
||||
free( mntctl_buffer );
|
||||
#elif defined(Q_WS_WIN) && !defined(_WIN32_WCE)
|
||||
//nothing fancy with infoNeeded but it gets the job done
|
||||
DWORD bits = GetLogicalDrives();
|
||||
if(!bits)
|
||||
return result;
|
||||
|
||||
for(int i = 0; i < 26; i++)
|
||||
{
|
||||
if(bits & (1 << i))
|
||||
{
|
||||
Ptr mp(new KMountPoint);
|
||||
mp->d->mountPoint = QString(QLatin1Char('A' + i) + QLatin1String(":/"));
|
||||
result.append(mp);
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(_WIN32_WCE)
|
||||
Ptr mp(new KMountPoint);
|
||||
mp->d->mountPoint = QString("/");
|
||||
|
@ -501,12 +478,8 @@ static bool pathsAreParentAndChildOrEqual(const QString& parent, const QString&
|
|||
|
||||
KMountPoint::Ptr KMountPoint::List::findByPath(const QString& path) const
|
||||
{
|
||||
#ifndef Q_WS_WIN
|
||||
/* If the path contains symlinks, get the real name */
|
||||
const QString realname = KStandardDirs::realFilePath(path);
|
||||
#else
|
||||
const QString realname = QDir::fromNativeSeparators(QDir(path).absolutePath());
|
||||
#endif
|
||||
|
||||
int max = 0;
|
||||
KMountPoint::Ptr result;
|
||||
|
|
|
@ -50,12 +50,6 @@
|
|||
#include <kdebug.h>
|
||||
#include "kde_file.h"
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <QtCore/QVarLengthArray>
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
extern QString mkdtemp_QString (const QString &_template);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
#include <shellapi.h>
|
||||
|
@ -86,28 +80,6 @@ bool KTempDir::create(const QString &directoryPrefix, int mode)
|
|||
{
|
||||
(void) KRandom::random();
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
const QString nme = directoryPrefix + QLatin1String("XXXXXX");
|
||||
const QString realName = mkdtemp_QString(nme);
|
||||
if(realName.isEmpty())
|
||||
{
|
||||
kWarning(180) << "KTempDir: Error trying to create " << nme
|
||||
<< ": " << ::strerror(errno) << endl;
|
||||
d->error = errno;
|
||||
d->tmpName.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
// got a return value != 0
|
||||
d->tmpName = realName + QLatin1Char('/');
|
||||
kDebug(180) << "KTempDir: Temporary directory created :" << d->tmpName
|
||||
<< endl;
|
||||
mode_t umsk = KGlobal::umask();
|
||||
KDE::chmod(nme, mode&(~umsk));
|
||||
|
||||
// Success!
|
||||
d->exists = true;
|
||||
#else
|
||||
QByteArray nme = QFile::encodeName(directoryPrefix) + "XXXXXX";
|
||||
char *realName;
|
||||
if((realName=mkdtemp(nme.data())) == 0)
|
||||
|
@ -147,7 +119,6 @@ bool KTempDir::create(const QString &directoryPrefix, int mode)
|
|||
<< ":" << ::strerror(errno);
|
||||
}
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -195,7 +166,6 @@ void KTempDir::unlink()
|
|||
d->exists=false;
|
||||
}
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
// Auxiliary recursive function for removeDirs
|
||||
static bool rmtree(const QByteArray& name)
|
||||
{
|
||||
|
@ -254,7 +224,6 @@ static bool rmtree(const QByteArray& name)
|
|||
return ! ::unlink( name );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool KTempDir::removeDir( const QString& path )
|
||||
{
|
||||
|
@ -262,29 +231,7 @@ bool KTempDir::removeDir( const QString& path )
|
|||
if ( !QFile::exists( path ) )
|
||||
return true; // The goal is that there is no directory
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
QVarLengthArray<WCHAR, MAX_PATH> name;
|
||||
name.resize( path.length() + 2 ); // double null terminated!
|
||||
memcpy( name.data(), path.utf16(), path.length() * sizeof(WCHAR) );
|
||||
name[path.length() ] = 0;
|
||||
name[path.length() + 1 ] = 0;
|
||||
if(path.endsWith(QLatin1Char('/')) || path.endsWith(QLatin1Char('\\')))
|
||||
name[path.length() - 1 ] = 0;
|
||||
SHFILEOPSTRUCTW fileOp;
|
||||
memset(&fileOp, 0, sizeof(SHFILEOPSTRUCTW) );
|
||||
fileOp.wFunc = FO_DELETE;
|
||||
fileOp.pFrom = (LPCWSTR)name.constData();
|
||||
fileOp.fFlags = FOF_NOCONFIRMATION | FOF_SILENT;
|
||||
#ifdef _WIN32_WCE
|
||||
// FOF_NOERRORUI is not defined in wince
|
||||
#else
|
||||
fileOp.fFlags |= FOF_NOERRORUI;
|
||||
#endif
|
||||
errno = SHFileOperationW( &fileOp );
|
||||
return (errno == 0);
|
||||
#else
|
||||
const QByteArray cstr( QFile::encodeName( path ) );
|
||||
return rmtree( cstr );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -106,11 +106,6 @@ static QString cleanpath( const QString &_path, bool cleanDirSeparator, bool dec
|
|||
orig_pos = pos;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN // prepend drive letter if exists (js)
|
||||
if (orig_pos >= 2 && path[0].isLetter() && path[1] == QLatin1Char(':') ) {
|
||||
result.prepend(QString(path[0]) + QLatin1Char(':') );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( result.isEmpty() )
|
||||
result = QLatin1Char('/');
|
||||
|
@ -120,42 +115,6 @@ static QString cleanpath( const QString &_path, bool cleanDirSeparator, bool dec
|
|||
return result;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
// returns true if provided arguments desinate letter+colon or double slash
|
||||
#define IS_DRIVE_OR_DOUBLESLASH(isletter, char1, char2, colon, slash) \
|
||||
((isletter && char2 == colon) || (char1 == slash && char2 == slash))
|
||||
|
||||
// Removes file:/// or file:// or file:/ or / prefix assuming that str
|
||||
// is (nonempty) Windows absolute path with a drive letter or double slash.
|
||||
// If there was file protocol, the path is decoded from percent encoding
|
||||
static QString removeSlashOrFilePrefix(const QString& str)
|
||||
{
|
||||
// FIXME this should maybe be replaced with some (faster?)/nicer logic
|
||||
const int len = str.length();
|
||||
if (str[0]==QLatin1Char('f')) {
|
||||
if ( len > 10 && str.startsWith( QLatin1String( "file:///" ) )
|
||||
&& IS_DRIVE_OR_DOUBLESLASH(str[8].isLetter(), str[8], str[9], QLatin1Char(':'), QLatin1Char('/')) )
|
||||
return QUrl::fromPercentEncoding( str.toLatin1() ).mid(8);
|
||||
else if ( len > 9 && str.startsWith( QLatin1String( "file://" ) )
|
||||
&& IS_DRIVE_OR_DOUBLESLASH(str[7].isLetter(), str[7], str[8], QLatin1Char(':'), QLatin1Char('/')) )
|
||||
return QUrl::fromPercentEncoding( str.toLatin1() ).mid(7);
|
||||
else if ( len > 8 && str.startsWith( QLatin1String( "file:/" ) )
|
||||
&& IS_DRIVE_OR_DOUBLESLASH(str[6].isLetter(), str[6], str[7], QLatin1Char(':'), QLatin1Char('/')) )
|
||||
return QUrl::fromPercentEncoding( str.toLatin1() ).mid(6);
|
||||
}
|
||||
/* No 'else' here since there can be "f:/" path. */
|
||||
|
||||
/* '/' + drive letter or // */
|
||||
if ( len > 2 && str[0] == QLatin1Char('/')
|
||||
&& IS_DRIVE_OR_DOUBLESLASH(str[1].isLetter(), str[1], str[2], QLatin1Char(':'), QLatin1Char('/')) )
|
||||
return str.mid(1);
|
||||
/* drive letter or // */
|
||||
else if ( len >= 2 && IS_DRIVE_OR_DOUBLESLASH(str[0].isLetter(), str[0], str[1], QLatin1Char(':'), QLatin1Char('/')) )
|
||||
return str;
|
||||
return QString();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool KUrl::isRelativeUrl(const QString &_url)
|
||||
{
|
||||
|
@ -401,28 +360,6 @@ KUrl::KUrl( const QString &str )
|
|||
: QUrl(), d(0)
|
||||
{
|
||||
if ( !str.isEmpty() ) {
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef DEBUG_KURL
|
||||
kDebug(kurlDebugArea()) << "KUrl::KUrl ( const QString &str = " << str.toLatin1().data() << " )";
|
||||
#endif
|
||||
QString pathToSet;
|
||||
// when it starts with file:// it's a url and must be valid. we don't care if the
|
||||
// path exist/ is valid or not
|
||||
if (!str.startsWith(QLatin1String("file://")))
|
||||
pathToSet = removeSlashOrFilePrefix( QDir::fromNativeSeparators(str) );
|
||||
if ( !pathToSet.isEmpty() ) {
|
||||
// we have a prefix indicating this is a local URL
|
||||
// remember the possible query using _setEncodedUrl(), then set up the correct path without query protocol part
|
||||
int index = pathToSet.lastIndexOf(QLatin1Char('?'));
|
||||
if (index == -1)
|
||||
setPath( pathToSet );
|
||||
else {
|
||||
setPath( pathToSet.left( index ) );
|
||||
_setQuery( pathToSet.mid( index + 1 ) );
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if ( str[0] == QLatin1Char('/') || str[0] == QLatin1Char('~') )
|
||||
setPath( str );
|
||||
else {
|
||||
|
@ -434,29 +371,6 @@ KUrl::KUrl( const QString &str )
|
|||
KUrl::KUrl( const char * str )
|
||||
: QUrl(), d(0)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
// true if @a c is letter
|
||||
#define IS_LETTER(c) \
|
||||
((c >= QLatin1Char('A') && c <= QLatin1Char('Z')) || (c >= QLatin1Char('a') && c <= QLatin1Char('z')))
|
||||
|
||||
// like IS_DRIVE_OR_DOUBLESLASH, but slash is prepended
|
||||
#define IS_SLASH_AND_DRIVE_OR_DOUBLESLASH_0 \
|
||||
( QLatin1Char(str[0]) == QLatin1Char('/') && IS_DRIVE_OR_DOUBLESLASH(IS_LETTER(QLatin1Char(str[1])), QLatin1Char(str[1]), QLatin1Char(str[2]), QLatin1Char(':'), QLatin1Char('/')) )
|
||||
|
||||
// like IS_DRIVE_OR_DOUBLESLASH, with characters == str[0] and str[1]
|
||||
#define IS_DRIVE_OR_DOUBLESLASH_0 \
|
||||
( IS_DRIVE_OR_DOUBLESLASH(IS_LETTER(QLatin1Char(str[0])), QLatin1Char(str[0]), QLatin1Char(str[1]), QLatin1Char(':'), QLatin1Char('/')) )
|
||||
|
||||
#if defined(DEBUG_KURL)
|
||||
kDebug(kurlDebugArea()) << "KUrl::KUrl " << " " << str;
|
||||
#endif
|
||||
if ( str && str[0] && str[1] && str[2] ) {
|
||||
if ( IS_SLASH_AND_DRIVE_OR_DOUBLESLASH_0 )
|
||||
setPath( QString::fromUtf8( str+1 ) );
|
||||
else if ( IS_DRIVE_OR_DOUBLESLASH_0 )
|
||||
setPath( QString::fromUtf8( str ) );
|
||||
}
|
||||
#endif
|
||||
if ( str && str[0] ) {
|
||||
if ( str[0] == '/' || str[0] == '~' )
|
||||
setPath( QString::fromUtf8( str ) );
|
||||
|
@ -469,18 +383,8 @@ KUrl::KUrl( const QByteArray& str )
|
|||
: QUrl(), d(0)
|
||||
{
|
||||
if ( !str.isEmpty() ) {
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef DEBUG_KURL
|
||||
kDebug(kurlDebugArea()) << "KUrl::KUrl " << " " << str.data();
|
||||
#endif
|
||||
if ( IS_SLASH_AND_DRIVE_OR_DOUBLESLASH_0 )
|
||||
setPath( QString::fromUtf8( str.mid( 1 ) ) );
|
||||
else if ( IS_DRIVE_OR_DOUBLESLASH_0 )
|
||||
setPath( QString::fromUtf8( str ) );
|
||||
#else
|
||||
if ( str[0] == '/' || str[0] == '~' )
|
||||
setPath( QString::fromUtf8( str ) );
|
||||
#endif
|
||||
else
|
||||
_setEncodedUrl( str );
|
||||
}
|
||||
|
@ -489,25 +393,16 @@ KUrl::KUrl( const QByteArray& str )
|
|||
KUrl::KUrl( const KUrl& _u )
|
||||
: QUrl( _u ), d(0)
|
||||
{
|
||||
#if defined(Q_WS_WIN) && defined(DEBUG_KURL)
|
||||
kDebug(kurlDebugArea()) << "KUrl::KUrl(KUrl) " << " path " << _u.path() << " toLocalFile " << _u.toLocalFile();
|
||||
#endif
|
||||
}
|
||||
|
||||
KUrl::KUrl( const QUrl &u )
|
||||
: QUrl( u ), d(0)
|
||||
{
|
||||
#if defined(Q_WS_WIN) && defined(DEBUG_KURL)
|
||||
kDebug(kurlDebugArea()) << "KUrl::KUrl(Qurl) " << " path " << u.path() << " toLocalFile " << u.toLocalFile();
|
||||
#endif
|
||||
}
|
||||
|
||||
KUrl::KUrl( const KUrl& _u, const QString& _rel_url )
|
||||
: QUrl(), d(0)
|
||||
{
|
||||
#if defined(Q_WS_WIN) && defined(DEBUG_KURL)
|
||||
kDebug(kurlDebugArea()) << "KUrl::KUrl(KUrl,QString rel_url) " << " path " << _u.path() << " toLocalFile " << _u.toLocalFile();
|
||||
#endif
|
||||
#if 0
|
||||
if (_u.hasSubUrl()) // Operate on the last suburl, not the first
|
||||
{
|
||||
|
@ -645,15 +540,6 @@ bool KUrl::equals( const KUrl &_u, const EqualsOptions& options ) const
|
|||
path2.clear();
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
const bool bLocal1 = isLocalFile();
|
||||
const bool bLocal2 = _u.isLocalFile();
|
||||
if ( !bLocal1 && bLocal2 || bLocal1 && !bLocal2 )
|
||||
return false;
|
||||
// local files are case insensitive
|
||||
if ( bLocal1 && bLocal2 && 0 != QString::compare( path1, path2, Qt::CaseInsensitive ) )
|
||||
return false;
|
||||
#endif
|
||||
if ( path1 != path2 )
|
||||
return false;
|
||||
|
||||
|
@ -872,14 +758,7 @@ void KUrl::setEncodedPathAndQuery( const QString& _txt )
|
|||
|
||||
QString KUrl::path( AdjustPathOption trailing ) const
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef DEBUG_KURL
|
||||
kWarning() << (isLocalFile() ? "converted to local file - the related call should be converted to toLocalFile()" : "") << QUrl::path();
|
||||
#endif
|
||||
return trailingSlash( trailing, isLocalFile() ? QUrl::toLocalFile() : QUrl::path() );
|
||||
#else
|
||||
return trailingSlash( trailing, QUrl::path() );
|
||||
#endif
|
||||
}
|
||||
|
||||
QString KUrl::toLocalFile( AdjustPathOption trailing ) const
|
||||
|
@ -892,11 +771,9 @@ QString KUrl::toLocalFile( AdjustPathOption trailing ) const
|
|||
#ifdef __GNUC__
|
||||
#warning FIXME: Remove #ifdef below once upstream bug, QTBUG-20322, is fixed. Also see BR# 194746.
|
||||
#endif
|
||||
#ifndef Q_WS_WIN
|
||||
if (isLocalFile()) {
|
||||
return trailingSlash(trailing, QUrl::path());
|
||||
}
|
||||
#endif
|
||||
return trailingSlash(trailing, QUrl::toLocalFile());
|
||||
}
|
||||
|
||||
|
@ -1123,10 +1000,6 @@ QString KUrl::prettyUrl( AdjustPathOption trailing ) const
|
|||
}
|
||||
|
||||
tmp = path();
|
||||
#ifdef Q_WS_WIN
|
||||
if (isLocalFile())
|
||||
tmp.prepend(QLatin1Char('/')); // KUrl::path() returns toLocalFile() on windows so we need to add the / back to create a proper url
|
||||
#endif
|
||||
result += toPrettyPercentEncoding(tmp, false);
|
||||
|
||||
// adjust the trailing slash, if necessary
|
||||
|
@ -1154,9 +1027,6 @@ QString KUrl::prettyUrl( int _trailing, AdjustementFlags _flags) const
|
|||
QString u = prettyUrl(_trailing);
|
||||
if (_flags & StripFileProtocol && u.startsWith("file://")) {
|
||||
u.remove(0, 7);
|
||||
#ifdef Q_WS_WIN
|
||||
return QDir::convertSeparators(u);
|
||||
#endif
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
@ -1398,12 +1268,6 @@ QString KUrl::directory( const DirectoryOptions& options ) const
|
|||
return QString(QLatin1Char('/'));
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
if ( i == 2 && result[1] == QLatin1Char(':') )
|
||||
{
|
||||
return result.left(3);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( options & AppendTrailingSlash )
|
||||
result = result.left( i + 1 );
|
||||
|
@ -1771,25 +1635,11 @@ QString KUrl::relativeUrl(const KUrl &base_url, const KUrl &url)
|
|||
|
||||
void KUrl::setPath( const QString& _path )
|
||||
{
|
||||
#if defined(Q_WS_WIN) && defined(DEBUG_KURL)
|
||||
kDebug(kurlDebugArea()) << "KUrl::setPath " << " " << _path.toLatin1().data();
|
||||
#endif
|
||||
if ( scheme().isEmpty() )
|
||||
setScheme( QLatin1String( "file" ) );
|
||||
QString path = KShell::tildeExpand( _path );
|
||||
if (path.isEmpty())
|
||||
path = _path;
|
||||
#ifdef Q_WS_WIN
|
||||
const int len = path.length();
|
||||
if( len == 2 && IS_LETTER(path[0]) && path[1] == QLatin1Char(':') )
|
||||
path += QLatin1Char('/');
|
||||
//This is necessary because QUrl has the "path" part including the first slash
|
||||
//Without this QUrl doesn't understand that this is a path, and some operations fail
|
||||
//e.g. C:/blah needs to become /C:/blah
|
||||
else
|
||||
if( len > 0 && path[0] != QLatin1Char('/') && scheme() == QLatin1String( "file" ) )
|
||||
path = QLatin1Char('/') + path;
|
||||
#endif
|
||||
QUrl::setPath( path );
|
||||
}
|
||||
|
||||
|
|
|
@ -315,9 +315,7 @@ KCmdLineArgsStatic::KCmdLineArgsStatic () {
|
|||
#endif
|
||||
kde_options.add("style <style>", ki18n("sets the application GUI style"));
|
||||
kde_options.add("geometry <geometry>", ki18n("sets the client geometry of the main widget - see man X for the argument format (usually WidthxHeight+XPos+YPos)"));
|
||||
#ifndef Q_WS_WIN
|
||||
kde_options.add("smkey <sessionKey>"); // this option is obsolete and exists only to allow smooth upgrades from sessions
|
||||
#endif
|
||||
}
|
||||
|
||||
KCmdLineArgsStatic::~KCmdLineArgsStatic ()
|
||||
|
|
|
@ -54,18 +54,6 @@
|
|||
#include <dirent.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#ifdef Q_WS_WIN
|
||||
#include <windows.h>
|
||||
#ifdef _WIN32_WCE
|
||||
#include <basetyps.h>
|
||||
#endif
|
||||
#ifdef Q_WS_WIN64
|
||||
// FIXME: did not find a reliable way to fix with kdewin mingw header
|
||||
#define interface struct
|
||||
#endif
|
||||
#include <shlobj.h>
|
||||
#include <QtCore/QVarLengthArray>
|
||||
#endif
|
||||
|
||||
#include <QtCore/QMutex>
|
||||
#include <QtCore/QRegExp>
|
||||
|
@ -619,46 +607,6 @@ static void lookupDirectory(const QString& path, const QString &relPart,
|
|||
{
|
||||
if (path.isEmpty()) //for sanity
|
||||
return;
|
||||
#ifdef Q_WS_WIN
|
||||
QString path_ = path + QLatin1String( "*.*" );
|
||||
WIN32_FIND_DATA findData;
|
||||
HANDLE hFile = FindFirstFile( (LPWSTR)path_.utf16(), &findData );
|
||||
if( hFile == INVALID_HANDLE_VALUE )
|
||||
return;
|
||||
do {
|
||||
const int len = wcslen( findData.cFileName );
|
||||
if (!( findData.cFileName[0] == '.' &&
|
||||
findData.cFileName[1] == '\0' ) &&
|
||||
!( findData.cFileName[0] == '.' &&
|
||||
findData.cFileName[1] == '.' &&
|
||||
findData.cFileName[2] == '\0' ) &&
|
||||
( findData.cFileName[len-1] != '~' ) ) {
|
||||
QString fn = QString::fromUtf16( (const unsigned short*)findData.cFileName );
|
||||
if (!recursive && !regexp.exactMatch(fn))
|
||||
continue; // No match
|
||||
QString pathfn = path + fn;
|
||||
bool bIsDir = ( ( findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) == FILE_ATTRIBUTE_DIRECTORY );
|
||||
if ( recursive ) {
|
||||
if ( bIsDir ) {
|
||||
lookupDirectory(pathfn + QLatin1Char('/'),
|
||||
relPart + fn + QLatin1Char('/'),
|
||||
regexp, list, relList, recursive, unique);
|
||||
}
|
||||
if (!regexp.exactMatch(fn))
|
||||
continue; // No match
|
||||
}
|
||||
if ( !bIsDir )
|
||||
{
|
||||
if ( !unique || !relList.contains(relPart + fn, cs) )
|
||||
{
|
||||
list.append( pathfn );
|
||||
relList.append( relPart + fn );
|
||||
}
|
||||
}
|
||||
}
|
||||
} while( FindNextFile( hFile, &findData ) != 0 );
|
||||
FindClose( hFile );
|
||||
#else
|
||||
// We look for a set of files.
|
||||
DIR *dp = opendir( QFile::encodeName(path));
|
||||
if (!dp)
|
||||
|
@ -714,7 +662,6 @@ static void lookupDirectory(const QString& path, const QString &relPart,
|
|||
}
|
||||
}
|
||||
closedir( dp );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -762,39 +709,12 @@ static void lookupPrefix(const QString& prefix, const QString& relpath,
|
|||
|
||||
if (prefix.isEmpty()) //for sanity
|
||||
return;
|
||||
#ifndef Q_WS_WIN
|
||||
// what does this assert check ?
|
||||
assert(prefix.endsWith(QLatin1Char('/')));
|
||||
#endif
|
||||
if (path.contains(QLatin1Char('*')) || path.contains(QLatin1Char('?'))) {
|
||||
|
||||
QRegExp pathExp(path, Qt::CaseSensitive, QRegExp::Wildcard);
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
QString prefix_ = prefix + QLatin1String( "*.*" );
|
||||
WIN32_FIND_DATA findData;
|
||||
HANDLE hFile = FindFirstFile( (LPWSTR)prefix_.utf16(), &findData );
|
||||
if( hFile == INVALID_HANDLE_VALUE )
|
||||
return;
|
||||
do {
|
||||
const int len = wcslen( findData.cFileName );
|
||||
if (!( findData.cFileName[0] == '.' &&
|
||||
findData.cFileName[1] == '\0' ) &&
|
||||
!( findData.cFileName[0] == '.' &&
|
||||
findData.cFileName[1] == '.' &&
|
||||
findData.cFileName[2] == '\0' ) &&
|
||||
( findData.cFileName[len-1] != '~' ) ) {
|
||||
const QString fn = QString::fromUtf16( (const unsigned short*)findData.cFileName );
|
||||
if ( !pathExp.exactMatch(fn) )
|
||||
continue; // No match
|
||||
if ( ( findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) == FILE_ATTRIBUTE_DIRECTORY )
|
||||
lookupPrefix(prefix + fn + QLatin1Char('/'),
|
||||
rest, relPart + fn + QLatin1Char('/'),
|
||||
regexp, list, relList, recursive, unique);
|
||||
}
|
||||
} while( FindNextFile( hFile, &findData ) != 0 );
|
||||
FindClose( hFile );
|
||||
#else
|
||||
DIR *dp = opendir( QFile::encodeName(prefix) );
|
||||
if (!dp) {
|
||||
return;
|
||||
|
@ -834,7 +754,6 @@ static void lookupPrefix(const QString& prefix, const QString& relpath,
|
|||
}
|
||||
|
||||
closedir( dp );
|
||||
#endif
|
||||
} else {
|
||||
// Don't stat, if the dir doesn't exist we will find out
|
||||
// when we try to open it.
|
||||
|
@ -913,12 +832,6 @@ KStandardDirs::findAllResources( const char *type,
|
|||
QString
|
||||
KStandardDirs::realPath(const QString &dirname)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
const QString strRet = realFilePath(dirname);
|
||||
if (!strRet.endsWith(QLatin1Char('/')))
|
||||
return strRet + QLatin1Char('/');
|
||||
return strRet;
|
||||
#else
|
||||
if (dirname.isEmpty() || (dirname.size() == 1 && dirname.at(0) == QLatin1Char('/')))
|
||||
return dirname;
|
||||
|
||||
|
@ -961,7 +874,6 @@ KStandardDirs::realPath(const QString &dirname)
|
|||
dir = realPath(dir) + relative;
|
||||
}
|
||||
return dir;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ####### KDE4: should this be removed, in favor of QDir::canonicalPath()?
|
||||
|
@ -972,18 +884,6 @@ KStandardDirs::realPath(const QString &dirname)
|
|||
QString
|
||||
KStandardDirs::realFilePath(const QString &filename)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
LPCWSTR lpIn = (LPCWSTR)filename.utf16();
|
||||
QVarLengthArray<WCHAR, MAX_PATH> buf(MAX_PATH);
|
||||
DWORD len = GetFullPathNameW(lpIn, buf.size(), buf.data(), NULL);
|
||||
if (len > (DWORD)buf.size()) {
|
||||
buf.resize(len);
|
||||
len = GetFullPathNameW(lpIn, buf.size(), buf.data(), NULL);
|
||||
}
|
||||
if (len == 0)
|
||||
return QString();
|
||||
return QString::fromUtf16((const unsigned short*)buf.data()).replace(QLatin1Char('\\'),QLatin1Char('/'));
|
||||
#else
|
||||
char realpath_buffer[MAXPATHLEN + 1];
|
||||
memset(realpath_buffer, 0, MAXPATHLEN + 1);
|
||||
|
||||
|
@ -994,7 +894,6 @@ KStandardDirs::realFilePath(const QString &filename)
|
|||
}
|
||||
|
||||
return filename;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1032,15 +931,6 @@ void KStandardDirs::KStandardDirsPrivate::createSpecialResource(const char *type
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef Q_WS_WIN
|
||||
if (relink)
|
||||
{
|
||||
if (!makeDir(dir, 0700))
|
||||
fprintf(stderr, "failed to create \"%s\"", qPrintable(dir));
|
||||
else
|
||||
result = readlink(QFile::encodeName(dir).constData(), link, 1023);
|
||||
}
|
||||
#else //UNIX
|
||||
if (relink)
|
||||
{
|
||||
QString srv = findExe(QLatin1String("lnusertemp"), installPath("libexec"));
|
||||
|
@ -1062,7 +952,6 @@ void KStandardDirs::KStandardDirsPrivate::createSpecialResource(const char *type
|
|||
else
|
||||
dir = QDir::cleanPath(dir + QFile::decodeName(link));
|
||||
}
|
||||
#endif
|
||||
q->addResourceDir(type, dir + QLatin1Char('/'), false);
|
||||
}
|
||||
|
||||
|
@ -1438,14 +1327,6 @@ int KStandardDirs::findAllExe( QStringList& list, const QString& appname,
|
|||
|
||||
static inline QString equalizePath(QString &str)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
// filter pathes through QFileInfo to have always
|
||||
// the same case for drive letters
|
||||
QFileInfo f(str);
|
||||
if (f.isAbsolute())
|
||||
return f.absoluteFilePath();
|
||||
else
|
||||
#endif
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -1574,9 +1455,6 @@ bool KStandardDirs::makeDir(const QString& dir, int mode)
|
|||
if (QDir::isRelativePath(dir))
|
||||
return false;
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
return QDir().mkpath(dir);
|
||||
#else
|
||||
QString target = dir;
|
||||
uint len = target.length();
|
||||
|
||||
|
@ -1610,7 +1488,6 @@ bool KStandardDirs::makeDir(const QString& dir, int mode)
|
|||
i = pos + 1;
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static QString readEnvPath(const char *env)
|
||||
|
@ -1715,17 +1592,6 @@ void KStandardDirs::addKDEDefaults()
|
|||
|
||||
#if defined(Q_WS_MACX)
|
||||
localKdeDir = QDir::homePath() + QLatin1String("/Library/Preferences/KDE/");
|
||||
#elif defined(Q_WS_WIN)
|
||||
#ifndef _WIN32_WCE
|
||||
WCHAR wPath[MAX_PATH+1];
|
||||
if ( SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wPath) == S_OK) {
|
||||
localKdeDir = QDir::fromNativeSeparators(QString::fromUtf16((const ushort *) wPath)) + QLatin1Char('/') + QString::fromLatin1(KDE_DEFAULT_HOME) + QLatin1Char('/');
|
||||
} else {
|
||||
#endif
|
||||
localKdeDir = QDir::homePath() + QLatin1Char('/') + QString::fromLatin1(KDE_DEFAULT_HOME) + QLatin1Char('/');
|
||||
#ifndef _WIN32_WCE
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
localKdeDir = QDir::homePath() + QLatin1Char('/') + QString::fromLatin1(KDE_DEFAULT_HOME) + QLatin1Char('/');
|
||||
#endif
|
||||
|
@ -1769,11 +1635,7 @@ void KStandardDirs::addKDEDefaults()
|
|||
{
|
||||
xdgdirList.clear();
|
||||
xdgdirList.append(QString::fromLatin1("/etc/xdg"));
|
||||
#ifdef Q_WS_WIN
|
||||
xdgdirList.append(installPath("kdedir") + QString::fromLatin1("etc/xdg"));
|
||||
#else
|
||||
xdgdirList.append(QFile::decodeName(KDESYSCONFDIR "/xdg"));
|
||||
#endif
|
||||
}
|
||||
|
||||
QString localXdgDir = readEnvPath("XDG_CONFIG_HOME");
|
||||
|
@ -1821,10 +1683,8 @@ void KStandardDirs::addKDEDefaults()
|
|||
}
|
||||
} else {
|
||||
xdgdirList = kdedirDataDirs;
|
||||
#ifndef Q_WS_WIN
|
||||
xdgdirList.append(QString::fromLatin1("/usr/local/share/"));
|
||||
xdgdirList.append(QString::fromLatin1("/usr/share/"));
|
||||
#endif
|
||||
}
|
||||
|
||||
localXdgDir = readEnvPath("XDG_DATA_HOME");
|
||||
|
|
|
@ -291,12 +291,7 @@ void KToolInvocation::invokeHelp( const QString& anchor,
|
|||
if ( !iface->isValid() )
|
||||
{
|
||||
QString error;
|
||||
#ifdef Q_WS_WIN
|
||||
// startServiceByDesktopName() does not work yet; KRun:processDesktopExec returned 'KRun: syntax error in command "khelpcenter %u" , service "KHelpCenter" '
|
||||
if (kdeinitExec(QLatin1String("khelpcenter"), QStringList() << url.url(), &error, 0, startup_id))
|
||||
#else
|
||||
if (startServiceByDesktopName(QLatin1String("khelpcenter"), url.url(), &error, 0, 0, startup_id, false))
|
||||
#endif
|
||||
{
|
||||
KMessage::message(KMessage::Error,
|
||||
i18n("Could not launch the KDE Help Center:\n\n%1", error),
|
||||
|
@ -385,9 +380,7 @@ void KToolInvocation::startKdeinit()
|
|||
// if ( gui )
|
||||
// qApp->setOverrideCursor( Qt::WaitCursor );
|
||||
QStringList args;
|
||||
#ifndef Q_WS_WIN
|
||||
args += QString::fromLatin1("--suicide");
|
||||
#endif
|
||||
QProcess::execute(srv, args);
|
||||
// if ( gui )
|
||||
// qApp->restoreOverrideCursor();
|
||||
|
|
|
@ -39,9 +39,6 @@
|
|||
#define GUESS_JA_H
|
||||
|
||||
#include <qglobal.h>
|
||||
#ifdef Q_WS_WIN
|
||||
#undef UNICODE
|
||||
#endif
|
||||
#ifdef SOLARIS
|
||||
#undef UNICODE
|
||||
#endif
|
||||
|
|
|
@ -169,9 +169,6 @@ QString KCatalog::localeDir() const
|
|||
return QFile::decodeName(d->localeDir);
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
extern "C" int __declspec(dllimport) _nl_msg_cat_cntr;
|
||||
#endif
|
||||
|
||||
void KCatalogPrivate::setupGettextEnv ()
|
||||
{
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
*/
|
||||
|
||||
#include "klocale.h"
|
||||
#if defined Q_WS_WIN
|
||||
#include "klocale_win_p.h"
|
||||
#elif defined Q_OS_MAC
|
||||
#if defined Q_OS_MAC
|
||||
#include "klocale_mac_p.h"
|
||||
#else
|
||||
#include "klocale_unix_p.h"
|
||||
|
@ -46,9 +44,7 @@
|
|||
#include "common_helpers_p.h"
|
||||
|
||||
KLocale::KLocale(const QString &catalog, KSharedConfig::Ptr config)
|
||||
#if defined Q_WS_WIN
|
||||
: d(new KLocaleWindowsPrivate(this, catalog, config))
|
||||
#elif defined Q_OS_MAC
|
||||
#if defined Q_OS_MAC
|
||||
: d(new KLocaleMacPrivate(this, catalog, config))
|
||||
#else
|
||||
: d(new KLocaleUnixPrivate(this, catalog, config))
|
||||
|
@ -57,9 +53,7 @@ KLocale::KLocale(const QString &catalog, KSharedConfig::Ptr config)
|
|||
}
|
||||
|
||||
KLocale::KLocale(const QString& catalog, const QString &language, const QString &country, KConfig *config)
|
||||
#if defined Q_WS_WIN
|
||||
: d(new KLocaleWindowsPrivate(this, catalog, language, country, config))
|
||||
#elif defined Q_OS_MAC
|
||||
#if defined Q_OS_MAC
|
||||
: d(new KLocaleMacPrivate(this, catalog, language, country, config))
|
||||
#else
|
||||
: d(new KLocaleUnixPrivate(this, catalog, language, country, config))
|
||||
|
|
|
@ -47,9 +47,6 @@
|
|||
#include "ksycocadevices_p.h"
|
||||
|
||||
// TODO: remove mmap() from kdewin32 and use QFile::mmap() when needed
|
||||
#ifdef Q_WS_WIN
|
||||
#undef HAVE_MMAP
|
||||
#endif
|
||||
/**
|
||||
* Sycoca file version number.
|
||||
* If the existing file is outdated, it will not get read
|
||||
|
|
|
@ -381,11 +381,7 @@ void KArchiveTest::testReadTar() // testCreateTarGz must have been run first.
|
|||
|
||||
QFileInfo localFileData("test3");
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
QCOMPARE( listing.count(), 15 );
|
||||
#else
|
||||
QCOMPARE( listing.count(), 14 );
|
||||
#endif
|
||||
QCOMPARE( listing[ 0], QString("mode=40755 user=user group=group path=aaaemptydir type=dir") );
|
||||
QCOMPARE( listing[ 1], QString("mode=40777 user=%1 group=%2 path=dir type=dir").arg(localFileData.owner()).arg(localFileData.group()) );
|
||||
QCOMPARE( listing[ 2], QString("mode=40777 user=%1 group=%2 path=dir/subdir type=dir").arg(localFileData.owner()).arg(localFileData.group()) );
|
||||
|
@ -756,11 +752,7 @@ void KArchiveTest::testReadZip()
|
|||
// ZIP has no support for per-file user/group, so omit them from the listing
|
||||
const QStringList listing = recursiveListEntries( dir, "", 0 );
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
QCOMPARE( listing.count(), 16 );
|
||||
#else
|
||||
QCOMPARE( listing.count(), 15 );
|
||||
#endif
|
||||
QCOMPARE( listing[ 0], QString("mode=40755 path=aaaemptydir type=dir") );
|
||||
QCOMPARE( listing[ 1], QString("mode=40777 path=dir type=dir") );
|
||||
QCOMPARE( listing[ 2], QString("mode=40777 path=dir/subdir type=dir") );
|
||||
|
|
|
@ -77,10 +77,8 @@ main(int argc, char *argv[])
|
|||
assert(u.url() == "http://www.kde.org");
|
||||
|
||||
QFile file("a:b");
|
||||
#ifndef Q_WS_WIN
|
||||
bool ok = file.open(QIODevice::WriteOnly);
|
||||
assert(ok);
|
||||
#endif
|
||||
u = KCmdLineArgs::makeURL("a:b");
|
||||
qDebug() << u.toLocalFile();
|
||||
assert(u.isLocalFile());
|
||||
|
|
|
@ -92,9 +92,6 @@ Test_KLockFile::testLock()
|
|||
void
|
||||
Test_KLockFile::testStale()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
qDebug("unix stale lock support not implemented yet");
|
||||
#else
|
||||
QVERIFY(lockFile->isLocked());
|
||||
|
||||
const int secs = 2;
|
||||
|
@ -115,7 +112,6 @@ Test_KLockFile::testStale()
|
|||
QCOMPARE(host, QLatin1String(hostname));
|
||||
QCOMPARE(app, QLatin1String("qttest")); // this is our KComponentData name
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -130,9 +126,6 @@ Test_KLockFile::testUnlock()
|
|||
void
|
||||
Test_KLockFile::testStaleNoBlockFlag()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
QSKIP("lockfile on windows has different format",SkipSingle);
|
||||
#else
|
||||
char hostname[256];
|
||||
::gethostname(hostname, sizeof(hostname));
|
||||
|
||||
|
@ -151,7 +144,6 @@ Test_KLockFile::testStaleNoBlockFlag()
|
|||
QCOMPARE(lockFile->lock(KLockFile::NoBlockFlag|KLockFile::ForceFlag), KLockFile::LockOK);
|
||||
|
||||
QVERIFY(lockFile->isLocked());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -261,11 +261,7 @@ void KMimeTypeTest::testFindByPathUsingFileName_data()
|
|||
if ( exePath.isEmpty() )
|
||||
kWarning() << "kioexec not found";
|
||||
else {
|
||||
#ifdef Q_WS_WIN
|
||||
const QString executableType = QString::fromLatin1( "application/x-ms-dos-executable" );
|
||||
#else
|
||||
const QString executableType = QString::fromLatin1( "application/x-executable" );
|
||||
#endif
|
||||
QTest::newRow("executable") << exePath << executableType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,11 +134,9 @@ void KSaveFileTest::test_ksavefile()
|
|||
QVERIFY( QFile::exists(targetFile) );
|
||||
QFileInfo fi ( targetFile );
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
// Windows: qt_ntfs_permission_lookup is not set by default in
|
||||
// qfsfileengine_win.cpp, could change in future Qt versions.
|
||||
QVERIFY( fi.permission( QFile::ExeUser ) );
|
||||
#endif
|
||||
QVERIFY( fi.size() == 0 );
|
||||
|
||||
QTextStream ts ( &saveFile );
|
||||
|
@ -151,9 +149,7 @@ void KSaveFileTest::test_ksavefile()
|
|||
|
||||
fi.refresh();
|
||||
QVERIFY( fi.size() != 0 );
|
||||
#ifndef Q_WS_WIN
|
||||
QVERIFY( fi.permission( QFile::ExeUser ) );
|
||||
#endif
|
||||
|
||||
QFile::remove(targetFile);
|
||||
}
|
||||
|
|
|
@ -91,13 +91,8 @@ void KStandarddirsTest::testFindResource()
|
|||
if ( !isKdelibsInstalled() )
|
||||
QSKIP( "kdelibs not installed", SkipAll );
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#define EXT ".exe"
|
||||
#define KIOSLAVE "bin/kioslave.exe"
|
||||
#else
|
||||
#define EXT ""
|
||||
#define KIOSLAVE "kde4/libexec/kioslave"
|
||||
#endif
|
||||
const QString bin = KGlobal::dirs()->findResource( "exe", "kioslave" EXT );
|
||||
QVERIFY( !bin.isEmpty() );
|
||||
QVERIFY( bin.endsWith( KIOSLAVE ) );
|
||||
|
|
|
@ -182,10 +182,6 @@ void KUrlTest::testQUrl()
|
|||
{
|
||||
QUrl url1( "file:///home/dfaure/my#%2f" );
|
||||
QCOMPARE( url1.toString(), QString( "file:///home/dfaure/my#%2f" ) );
|
||||
#ifdef Q_WS_WIN
|
||||
QUrl url2( "file:///c:/home/dfaure/my#%2f" );
|
||||
QCOMPARE( url2.toString(), QString( "file:///c:/home/dfaure/my#%2f" ) );
|
||||
#endif
|
||||
|
||||
// Show how toString() is confusing
|
||||
QUrl url3 = QUrl::fromLocalFile( "/home/dfaure/hash#file" );
|
||||
|
@ -227,20 +223,11 @@ void KUrlTest::testIsLocalFile()
|
|||
KUrl local_file_4("file:///my/file");
|
||||
QVERIFY( local_file_4.isLocalFile() );
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
KUrl local_file_4a("file:///c:/my/file");
|
||||
QVERIFY( local_file_4a.isLocalFile() );
|
||||
#endif
|
||||
|
||||
KUrl local_file_5;
|
||||
local_file_5.setPath("/foo?bar");
|
||||
QCOMPARE( local_file_5.url(), QString("file:///foo%3Fbar") );
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
KUrl local_file_5a;
|
||||
local_file_5a.setPath("c:/foo?bar");
|
||||
QCOMPARE( local_file_5a.url(), QString("file:///c:/foo%3Fbar") );
|
||||
#endif
|
||||
|
||||
KUrl scummos("inf://localhost/test.txt");
|
||||
QVERIFY(!scummos.isLocalFile());
|
||||
|
@ -417,13 +404,6 @@ void KUrlTest::testSimpleMethods() // to test parsing, mostly
|
|||
KUrl percentEncodedQuery( "http://mail.yandex.ru/message_part/%D0%9A%D1%80%D0%B8%D1%82%D0%B5%D1%80%D0%B8%D0%B8%20%D0%BE%D1%86%D0%B5%D0%BD%D0%B8%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F%20%D0%BE%D1%80%D0%BB%D0%BE%D0%B2%D0%BE%D0%B9.rar?hid=1.1&mid=391.56424458.99241672611486679803334485488&name=%D0%9A%D1%80%D0%B8%D1%82%D0%B5%D1%80%D0%B8%D0%B8%20%D0%BE%D1%86%D0%B5%D0%BD%D0%B8%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F%20%D0%BE%D1%80%D0%BB%D0%BE%D0%B2%D0%BE%D0%B9.rar" );
|
||||
QCOMPARE( percentEncodedQuery.prettyUrl(), QString::fromUtf8("http://mail.yandex.ru/message_part/Критерии оценивания орловой.rar?hid=1.1&mid=391.56424458.99241672611486679803334485488&name=%D0%9A%D1%80%D0%B8%D1%82%D0%B5%D1%80%D0%B8%D0%B8%20%D0%BE%D1%86%D0%B5%D0%BD%D0%B8%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F%20%D0%BE%D1%80%D0%BB%D0%BE%D0%B2%D0%BE%D0%B9.rar"));
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef Q_CC_MSVC
|
||||
#pragma message ("port KUser")
|
||||
#else
|
||||
#warning port KUser
|
||||
#endif
|
||||
#else
|
||||
KUrl tilde;
|
||||
KUser currentUser;
|
||||
const QString userName = currentUser.loginName();
|
||||
|
@ -434,7 +414,6 @@ void KUrlTest::testSimpleMethods() // to test parsing, mostly
|
|||
tilde = KUrl("http://foo.bar/index.html");
|
||||
tilde.setPath( "~slajsjdlsjd/test.html" );
|
||||
QCOMPARE( tilde.url(), QString("http://foo.bar/~slajsjdlsjd/test.html"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void KUrlTest::testHostName()
|
||||
|
@ -1954,19 +1933,11 @@ void KUrlTest::testPathOrURL()
|
|||
QVERIFY( uloc.isValid() ); // KDE3: was invalid; same as above
|
||||
uloc = KUrl( "" );
|
||||
QVERIFY( !uloc.isValid() );
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef Q_CC_MSVC
|
||||
#pragma message ("port KUser")
|
||||
#else
|
||||
#warning port KUser
|
||||
#endif
|
||||
#else
|
||||
KUser currentUser;
|
||||
const QString userName = currentUser.loginName();
|
||||
QVERIFY( !userName.isEmpty() );
|
||||
uloc = KUrl(QString::fromUtf8("~%1/konqtests/Matériel").arg(userName));
|
||||
QCOMPARE( uloc.path(), QString::fromUtf8("%1/konqtests/Matériel").arg(currentUser.homeDir()) );
|
||||
#endif
|
||||
|
||||
// pathOrUrl tests
|
||||
uloc = KUrl( "/home/dfaure/konqtests/Mat%C3%A9riel" );
|
||||
|
@ -2012,13 +1983,6 @@ void KUrlTest::testAssignment()
|
|||
QVERIFY( uloc.isValid() );
|
||||
uloc = KUrl( "" );
|
||||
QVERIFY( !uloc.isValid() );
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef Q_CC_MSVC
|
||||
#pragma message ("port KUser")
|
||||
#else
|
||||
#warning port KUser
|
||||
#endif
|
||||
#else
|
||||
KUser currentUser;
|
||||
const QString userName = currentUser.loginName();
|
||||
QVERIFY( !userName.isEmpty() );
|
||||
|
@ -2033,7 +1997,6 @@ void KUrlTest::testAssignment()
|
|||
uloc = KUrl(qurl);
|
||||
QCOMPARE( qurl.toEncoded(), uloc.toEncoded() );
|
||||
QCOMPARE( uloc.path(), QString::fromUtf8("%1/konqtests/Matériel").arg(currentUser.homeDir()) );
|
||||
#endif
|
||||
}
|
||||
|
||||
void KUrlTest::testQueryItem()
|
||||
|
|
|
@ -175,7 +175,6 @@ namespace KDE
|
|||
KDECORE_EXPORT int stat(const QString &path, KDE_struct_stat *buf);
|
||||
/** replacement for ::utime() to handle filenames in a platform independent way */
|
||||
KDECORE_EXPORT int utime(const QString &filename, struct utimbuf *buf);
|
||||
#ifndef Q_WS_WIN
|
||||
inline int access(const QString &path, int mode)
|
||||
{
|
||||
return ::access( QFile::encodeName(path).constData(), mode );
|
||||
|
@ -212,7 +211,6 @@ namespace KDE
|
|||
{
|
||||
return ::utime( QFile::encodeName(filename).constData(), buf );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined _WIN32 || defined _WIN64
|
||||
|
|
|
@ -321,11 +321,9 @@ int KMessageBox::createKMessageBox(KDialog *dialog, const QIcon &icon,
|
|||
dialog->setButtonFocus(defaultCode);
|
||||
}
|
||||
|
||||
#ifndef Q_WS_WIN // FIXME problems with KNotify on Windows
|
||||
if ((options & KMessageBox::Notify)) {
|
||||
sendNotification(text, strlist, notifyType, dialog->topLevelWidget()->winId());
|
||||
}
|
||||
#endif
|
||||
|
||||
if (KMessageBox_queue) {
|
||||
KDialogQueue::queueDialog(dialog);
|
||||
|
|
|
@ -343,14 +343,8 @@ struct KIEImgEdit
|
|||
|
||||
static bool painterSupportsAntialiasing()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
// apparently QApplication::desktop()->paintEngine() is null on windows
|
||||
// but we can assume the paint engine supports antialiasing there, right?
|
||||
return true;
|
||||
#else
|
||||
QPaintEngine* const pe = QApplication::desktop()->paintEngine();
|
||||
return pe && pe->hasFeature(QPaintEngine::Antialiasing);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Taken from KImageEffect. We don't want to link kdecore to kdeui! As long
|
||||
|
|
|
@ -65,9 +65,7 @@
|
|||
#endif
|
||||
#include <sys/wait.h>
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
#include "kwindowsystem.h"
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h> // srand(), rand()
|
||||
|
@ -134,9 +132,6 @@ static int kde_x_errhandler( Display *dpy, XErrorEvent *err )
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
void KApplication_init_windows();
|
||||
#endif
|
||||
|
||||
/*
|
||||
Private data to make keeping binary compatibility easier
|
||||
|
@ -595,9 +590,6 @@ void KApplicationPrivate::init(bool GUIenabled)
|
|||
qRegisterMetaType<KUrl>();
|
||||
qRegisterMetaType<KUrl::List>();
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
KApplication_init_windows();
|
||||
#endif
|
||||
}
|
||||
|
||||
KApplication* KApplication::kApplication()
|
||||
|
@ -881,12 +873,10 @@ void KApplicationPrivate::parseCommandLine( )
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
if (args->isSet("smkey"))
|
||||
{
|
||||
sessionKey = args->getOption("smkey");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void kDebugCleanup();
|
||||
|
|
|
@ -51,15 +51,6 @@
|
|||
#include <QtGui/QToolTip>
|
||||
#include <QtGui/QWhatsThis>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <windows.h>
|
||||
#include <kkernel_win.h>
|
||||
|
||||
static QRgb qt_colorref2qrgb(COLORREF col)
|
||||
{
|
||||
return qRgb(GetRValue(col),GetGValue(col),GetBValue(col));
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_WS_X11
|
||||
#include <X11/Xlib.h>
|
||||
#ifdef HAVE_XCURSOR
|
||||
|
@ -316,45 +307,29 @@ int KGlobalSettings::contextMenuKey ()
|
|||
// NOTE: keep this in sync with kdebase/workspace/kcontrol/colors/colorscm.cpp
|
||||
QColor KGlobalSettings::inactiveTitleColor()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return qt_colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION));
|
||||
#else
|
||||
KConfigGroup g( KGlobal::config(), "WM" );
|
||||
return g.readEntry( "inactiveBackground", QColor(224,223,222) );
|
||||
#endif
|
||||
}
|
||||
|
||||
// NOTE: keep this in sync with kdebase/workspace/kcontrol/colors/colorscm.cpp
|
||||
QColor KGlobalSettings::inactiveTextColor()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return qt_colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT));
|
||||
#else
|
||||
KConfigGroup g( KGlobal::config(), "WM" );
|
||||
return g.readEntry( "inactiveForeground", QColor(75,71,67) );
|
||||
#endif
|
||||
}
|
||||
|
||||
// NOTE: keep this in sync with kdebase/workspace/kcontrol/colors/colorscm.cpp
|
||||
QColor KGlobalSettings::activeTitleColor()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return qt_colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION));
|
||||
#else
|
||||
KConfigGroup g( KGlobal::config(), "WM" );
|
||||
return g.readEntry( "activeBackground", QColor(48,174,232));
|
||||
#endif
|
||||
}
|
||||
|
||||
// NOTE: keep this in sync with kdebase/workspace/kcontrol/colors/colorscm.cpp
|
||||
QColor KGlobalSettings::activeTextColor()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return qt_colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT));
|
||||
#else
|
||||
KConfigGroup g( KGlobal::config(), "WM" );
|
||||
return g.readEntry( "activeForeground", QColor(255,255,255) );
|
||||
#endif
|
||||
}
|
||||
|
||||
int KGlobalSettings::contrast()
|
||||
|
@ -560,7 +535,6 @@ KGlobalSettings::KMouseSettings& KGlobalSettingsData::mouseSettings()
|
|||
mMouseSettings = new KGlobalSettings::KMouseSettings;
|
||||
KGlobalSettings::KMouseSettings& s = *mMouseSettings; // for convenience
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
KConfigGroup g( KGlobal::config(), "Mouse" );
|
||||
QString setting = g.readEntry("MouseButtonMapping");
|
||||
if (setting == "RightHanded")
|
||||
|
@ -594,19 +568,7 @@ KGlobalSettings::KMouseSettings& KGlobalSettingsData::mouseSettings()
|
|||
// FIXME: Implement on other platforms
|
||||
#endif
|
||||
}
|
||||
#endif //Q_WS_WIN
|
||||
}
|
||||
#ifdef Q_WS_WIN
|
||||
//not cached
|
||||
#ifndef _WIN32_WCE
|
||||
mMouseSettings->handed = (GetSystemMetrics(SM_SWAPBUTTON) ?
|
||||
KGlobalSettings::KMouseSettings::LeftHanded :
|
||||
KGlobalSettings::KMouseSettings::RightHanded);
|
||||
#else
|
||||
// There is no mice under wince
|
||||
mMouseSettings->handed =KGlobalSettings::KMouseSettings::RightHanded;
|
||||
#endif
|
||||
#endif
|
||||
return *mMouseSettings;
|
||||
}
|
||||
// KDE5: make this a const return?
|
||||
|
@ -617,10 +579,8 @@ KGlobalSettings::KMouseSettings & KGlobalSettings::mouseSettings()
|
|||
|
||||
void KGlobalSettingsData::dropMouseSettingsCache()
|
||||
{
|
||||
#ifndef Q_WS_WIN
|
||||
delete mMouseSettings;
|
||||
mMouseSettings = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
QString KGlobalSettings::desktopPath()
|
||||
|
@ -654,7 +614,6 @@ QString KGlobalSettings::downloadPath()
|
|||
// Qt 4.x does not have QDesktopServices::DownloadLocation, so we do our own xdg reading.
|
||||
QString defaultDownloadPath = QDir::homePath() + "/Downloads";
|
||||
QString downloadPath = defaultDownloadPath;
|
||||
#ifndef Q_WS_WIN
|
||||
const QString xdgUserDirs = KGlobal::dirs()->localxdgconfdir() + QLatin1String( "user-dirs.dirs" );
|
||||
if( QFile::exists( xdgUserDirs ) ) {
|
||||
KConfig xdgUserConf( xdgUserDirs, KConfig::SimpleConfig );
|
||||
|
@ -664,7 +623,6 @@ QString KGlobalSettings::downloadPath()
|
|||
downloadPath = defaultDownloadPath;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
downloadPath = QDir::cleanPath( downloadPath );
|
||||
QDir().mkpath(downloadPath);
|
||||
if ( !downloadPath.endsWith( '/' ) ) {
|
||||
|
@ -693,15 +651,11 @@ QString KGlobalSettings::musicPath()
|
|||
|
||||
bool KGlobalSettings::isMultiHead()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return GetSystemMetrics(SM_CMONITORS) > 1;
|
||||
#else
|
||||
QByteArray multiHead = qgetenv("KDE_MULTIHEAD");
|
||||
if (!multiHead.isEmpty()) {
|
||||
return (multiHead.toLower() == "true");
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool KGlobalSettings::wheelMouseZooms()
|
||||
|
@ -1138,16 +1092,12 @@ void KGlobalSettings::Private::applyCursorTheme()
|
|||
void KGlobalSettings::Private::propagateQtSettings()
|
||||
{
|
||||
KConfigGroup cg( KGlobal::config(), "KDE" );
|
||||
#ifndef Q_WS_WIN
|
||||
int num = cg.readEntry("CursorBlinkRate", QApplication::cursorFlashTime());
|
||||
if ((num != 0) && (num < 200))
|
||||
num = 200;
|
||||
if (num > 2000)
|
||||
num = 2000;
|
||||
QApplication::setCursorFlashTime(num);
|
||||
#else
|
||||
int num;
|
||||
#endif
|
||||
num = cg.readEntry("DoubleClickInterval", QApplication::doubleClickInterval());
|
||||
QApplication::setDoubleClickInterval(num);
|
||||
num = cg.readEntry("StartDragTime", QApplication::startDragTime());
|
||||
|
|
|
@ -47,11 +47,6 @@ public:
|
|||
{
|
||||
return macEvent(caller, event);
|
||||
}
|
||||
#elif defined(Q_WS_WIN)
|
||||
bool publicWinEvent(MSG *message, long *result)
|
||||
{
|
||||
return winEvent(message, result);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -116,19 +111,6 @@ bool KSystemEventFilterPrivate::filterEvent(void *message)
|
|||
}
|
||||
}
|
||||
}*/
|
||||
#elif defined(Q_WS_WIN)
|
||||
// FIXME: untested
|
||||
|
||||
/* MSG *msg = static_cast<MSG*>(message);
|
||||
long ret; // widget filter returns are discarded!
|
||||
// pass the event as long as it's not consumed
|
||||
Q_FOREACH (const QWeakPointer<QWidget> &wp, m_filters) {
|
||||
if (QWidget *w = wp.data()) {
|
||||
if (static_cast<KEventHackWidget*>(w)->publicWinEvent(msg, &ret)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -74,12 +74,6 @@ bool KUniqueApplication::Private::s_nofork = false;
|
|||
bool KUniqueApplication::Private::s_multipleInstances = false;
|
||||
bool s_kuniqueapplication_startCalled = false;
|
||||
bool KUniqueApplication::Private::s_handleAutoStarted = false;
|
||||
#ifdef Q_WS_WIN
|
||||
/* private helpers from kapplication_win.cpp */
|
||||
#ifndef _WIN32_WCE
|
||||
void KApplication_activateWindowForProcess( const QString& executableName );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void
|
||||
KUniqueApplication::addCmdLineOptions()
|
||||
|
@ -158,9 +152,6 @@ KUniqueApplication::start(StartFlags flags)
|
|||
{
|
||||
kError() << "KUniqueApplication: Can't setup D-Bus service. Probably already running."
|
||||
<< endl;
|
||||
#if defined(Q_WS_WIN) && !defined(_WIN32_WCE)
|
||||
KApplication_activateWindowForProcess(KCmdLineArgs::aboutData()->appName());
|
||||
#endif
|
||||
::exit(255);
|
||||
}
|
||||
|
||||
|
@ -174,7 +165,6 @@ KUniqueApplication::start(StartFlags flags)
|
|||
|
||||
}
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
int fd[2];
|
||||
signed char result;
|
||||
if (0 > pipe(fd))
|
||||
|
@ -266,7 +256,6 @@ KUniqueApplication::start(StartFlags flags)
|
|||
if (result != 0)
|
||||
::exit(result); // Error occurred in child.
|
||||
|
||||
#endif
|
||||
QDBusConnectionInterface* dbusService = tryToInitDBusConnection();
|
||||
if (!dbusService->isServiceRegistered(appName))
|
||||
{
|
||||
|
@ -300,11 +289,9 @@ KUniqueApplication::start(StartFlags flags)
|
|||
<< "Error message was: " << err.name() << ": \"" << err.message() << "\"" << endl;
|
||||
::exit(255);
|
||||
}
|
||||
#ifndef Q_WS_WIN
|
||||
::exit(reply);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return false; // make insure++ happy
|
||||
}
|
||||
|
||||
|
@ -404,9 +391,6 @@ int KUniqueApplication::newInstance()
|
|||
// is called for the first time, like here).
|
||||
KStartupInfo::setNewStartupId(mainWindow, startupId());
|
||||
#endif
|
||||
#ifdef Q_WS_WIN
|
||||
KWindowSystem::forceActiveWindow( mainWindow->winId() );
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -594,21 +594,7 @@ void KStatusNotifierItem::activate(const QPoint &pos)
|
|||
|
||||
bool KStatusNotifierItemPrivate::checkVisibility(QPoint pos, bool perform)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
#if 0
|
||||
// the problem is that we lose focus when the systray icon is activated
|
||||
// and we don't know the former active window
|
||||
// therefore we watch for activation event and use our stopwatch :)
|
||||
if(GetTickCount() - dwTickCount < 300) {
|
||||
// we were active in the last 300ms -> hide it
|
||||
minimizeRestore(false);
|
||||
emit activateRequested(false, pos);
|
||||
} else {
|
||||
minimizeRestore(true);
|
||||
emit activateRequested(true, pos);
|
||||
}
|
||||
#endif
|
||||
#elif defined(Q_WS_X11)
|
||||
#if defined(Q_WS_X11)
|
||||
KWindowInfo info1 = KWindowSystem::windowInfo(associatedWidget->winId(), NET::XAWMState | NET::WMState | NET::WMDesktop);
|
||||
// mapped = visible (but possibly obscured)
|
||||
bool mapped = (info1.mappingState() == NET::Visible) && !info1.isMinimized();
|
||||
|
|
|
@ -35,9 +35,6 @@
|
|||
#ifdef Q_WS_X11
|
||||
#include <QX11Info>
|
||||
#endif
|
||||
#ifdef Q_WS_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <kiconloader.h>
|
||||
#include <kapplication.h>
|
||||
|
@ -48,11 +45,7 @@
|
|||
#include <QMovie>
|
||||
#include <QPointer>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
class KSystemTrayIconPrivate : public QObject
|
||||
#else
|
||||
class KSystemTrayIconPrivate
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
KSystemTrayIconPrivate(KSystemTrayIcon* trayIcon, QWidget* parent)
|
||||
|
@ -63,20 +56,10 @@ public:
|
|||
onAllDesktops = false;
|
||||
window = parent;
|
||||
movie = 0;
|
||||
#ifdef Q_WS_WIN
|
||||
if ( window ) {
|
||||
window->installEventFilter( this );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
~KSystemTrayIconPrivate()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
if ( window ) {
|
||||
window->removeEventFilter( this );
|
||||
}
|
||||
#endif
|
||||
delete actionCollection;
|
||||
delete menu;
|
||||
}
|
||||
|
@ -87,16 +70,6 @@ public:
|
|||
q->setIcon(QIcon(movie->currentPixmap()));
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
bool eventFilter(QObject *obj, QEvent *ev)
|
||||
{
|
||||
if(ev->type() == QEvent::ActivationChange) {
|
||||
dwTickCount = GetTickCount();
|
||||
}
|
||||
return QObject::eventFilter(obj, ev);
|
||||
}
|
||||
DWORD dwTickCount;
|
||||
#endif
|
||||
|
||||
KSystemTrayIcon* q;
|
||||
KActionCollection* actionCollection;
|
||||
|
@ -267,17 +240,7 @@ void KSystemTrayIcon::activateOrHide( QSystemTrayIcon::ActivationReason reasonCa
|
|||
{
|
||||
return;
|
||||
}
|
||||
#ifdef Q_WS_WIN
|
||||
// the problem is that we lose focus when the systray icon is activated
|
||||
// and we don't know the former active window
|
||||
// therefore we watch for activation event and use our stopwatch :)
|
||||
if( GetTickCount() - d->dwTickCount < 300 ) {
|
||||
// we were active in the last 300ms -> hide it
|
||||
minimizeRestore( false );
|
||||
} else {
|
||||
minimizeRestore( true );
|
||||
}
|
||||
#elif defined(Q_WS_X11)
|
||||
#if defined(Q_WS_X11)
|
||||
KWindowInfo info1 = KWindowSystem::windowInfo( pw->winId(), NET::XAWMState | NET::WMState );
|
||||
// mapped = visible (but possibly obscured)
|
||||
bool mapped = (info1.mappingState() == NET::Visible) && !info1.isMinimized();
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#include "kkeyserver_x11.h"
|
||||
#elif defined Q_WS_MACX
|
||||
#include "kkeyserver_mac.h"
|
||||
#elif defined Q_WS_WIN
|
||||
#include "kkeyserver_win.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -254,11 +254,7 @@ void KCharSelectTablePrivate::_k_resizeCells()
|
|||
}
|
||||
|
||||
hv = q->verticalHeader();
|
||||
#ifdef Q_WS_WIN
|
||||
int new_h = QFontMetrics(font).lineSpacing() + 1;
|
||||
#else
|
||||
int new_h = QFontMetrics(font).xHeight() * 3;
|
||||
#endif
|
||||
if (new_h < 5 || new_h < 4 + QFontMetrics(font).height()) {
|
||||
new_h = qMax(5, 4 + QFontMetrics(font).height());
|
||||
}
|
||||
|
|
|
@ -247,9 +247,6 @@ bool KCompletionBox::eventFilter( QObject *o, QEvent *e )
|
|||
} else if ( type == QEvent::FocusOut ) {
|
||||
QFocusEvent* event = static_cast<QFocusEvent*>( e );
|
||||
if (event->reason() != Qt::PopupFocusReason
|
||||
#ifdef Q_WS_WIN
|
||||
&& (event->reason() != Qt::ActiveWindowFocusReason || QApplication::activeWindow() != this)
|
||||
#endif
|
||||
)
|
||||
hide();
|
||||
}
|
||||
|
|
|
@ -479,17 +479,6 @@ void KKeySequenceWidgetPrivate::doneRecording(bool validate)
|
|||
|
||||
bool KKeySequenceWidgetPrivate::conflictWithGlobalShortcuts(const QKeySequence &keySequence)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
//on windows F12 is reserved by the debugger at all times, so we can't use it for a global shortcut
|
||||
if (KKeySequenceWidget::GlobalShortcuts && keySequence.toString().contains("F12")) {
|
||||
QString title = i18n("Reserved Shortcut");
|
||||
QString message = i18n("The F12 key is reserved on Windows, so cannot be used for a global shortcut.\n"
|
||||
"Please choose another one.");
|
||||
|
||||
KMessageBox::sorry(q, message, title);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!(checkAgainstShortcutTypes & KKeySequenceWidget::GlobalShortcuts)) {
|
||||
return false;
|
||||
|
|
|
@ -812,49 +812,6 @@ void KMainWindow::applyMainWindowSettings(const KConfigGroup &cg, bool force)
|
|||
d->letDirtySettings = oldLetDirtySettings;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
/*
|
||||
The win32 implementation for restoring/savin windows size differs
|
||||
from the unix/max implementation in three topics:
|
||||
|
||||
1. storing and restoring the position, which may not work on x11
|
||||
see http://doc.trolltech.com/4.3/geometry.html#x11-peculiarities
|
||||
2. using QWidget::saveGeometry() and QWidget::restoreGeometry()
|
||||
this would probably be usable on x11 and/or on mac, but I'm unable to
|
||||
check this on unix/mac, so I leave this fix to the x11/mac experts.
|
||||
3. store geometry separately for each resolution -> on unix/max the size
|
||||
and with of the window are already saved separately on non windows
|
||||
system although not using ...Geometry functions -> could also be
|
||||
fixed by x11/mac experts.
|
||||
*/
|
||||
void KMainWindow::restoreWindowSize( const KConfigGroup & _cg )
|
||||
{
|
||||
K_D(KMainWindow);
|
||||
|
||||
int scnum = QApplication::desktop()->screenNumber(window());
|
||||
QRect desk = QApplication::desktop()->screenGeometry(scnum);
|
||||
|
||||
QString geometryKey = QString::fromLatin1("geometry-%1-%2").arg(desk.width()).arg(desk.height());
|
||||
QByteArray geometry = _cg.readEntry( geometryKey, QByteArray() );
|
||||
// if first time run, center window
|
||||
if (!restoreGeometry( QByteArray::fromBase64(geometry) ))
|
||||
move( (desk.width()-width())/2, (desk.height()-height())/2 );
|
||||
}
|
||||
|
||||
void KMainWindow::saveWindowSize( const KConfigGroup & _cg ) const
|
||||
{
|
||||
K_D(const KMainWindow);
|
||||
int scnum = QApplication::desktop()->screenNumber(window());
|
||||
QRect desk = QApplication::desktop()->screenGeometry(scnum);
|
||||
|
||||
// geometry is saved separately for each resolution
|
||||
QString geometryKey = QString::fromLatin1("geometry-%1-%2").arg(desk.width()).arg(desk.height());
|
||||
QByteArray geometry = saveGeometry();
|
||||
KConfigGroup cg(_cg);
|
||||
cg.writeEntry( geometryKey, geometry.toBase64() );
|
||||
}
|
||||
#else
|
||||
void KMainWindow::saveWindowSize( const KConfigGroup & _cg ) const
|
||||
{
|
||||
K_D(const KMainWindow);
|
||||
|
@ -932,7 +889,6 @@ void KMainWindow::restoreWindowSize( const KConfigGroup & config )
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool KMainWindow::initialGeometrySet() const
|
||||
{
|
||||
|
@ -1020,9 +976,6 @@ bool KMainWindow::event( QEvent* ev )
|
|||
{
|
||||
K_D(KMainWindow);
|
||||
switch( ev->type() ) {
|
||||
#ifdef Q_WS_WIN
|
||||
case QEvent::Move:
|
||||
#endif
|
||||
case QEvent::Resize:
|
||||
d->setSizeDirty();
|
||||
break;
|
||||
|
|
|
@ -160,11 +160,7 @@ QString HelpProtocol::lookupFile(const QString &fname,
|
|||
|
||||
void HelpProtocol::unicodeError( const QString &t )
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
QString encoding = "UTF-8";
|
||||
#else
|
||||
QString encoding = QTextCodec::codecForLocale()->name();
|
||||
#endif
|
||||
data(fromUnicode( QString(
|
||||
"<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=%1\"></head>\n"
|
||||
"%2</html>" ).arg( encoding, Qt::escape(t) ) ) );
|
||||
|
@ -282,16 +278,7 @@ void HelpProtocol::get( const KUrl& url )
|
|||
mParsed = transform(file, KStandardDirs::locate("dtd", "customization/kde-chunk.xsl"));
|
||||
if ( !mParsed.isEmpty() ) {
|
||||
infoMessage( i18n( "Saving to cache" ) );
|
||||
#ifdef Q_WS_WIN
|
||||
QFileInfo fi(file);
|
||||
// make sure filenames do not contain the base path, otherwise
|
||||
// accessing user data from another location invalids cached files
|
||||
// Accessing user data under a different path is possible
|
||||
// when using usb sticks - this may affect unix/mac systems also
|
||||
QString cache = '/' + fi.absolutePath().remove(KStandardDirs::installPath("html"),Qt::CaseInsensitive).replace('/','_') + '_' + fi.baseName() + '.';
|
||||
#else
|
||||
QString cache = file.left( file.length() - 7 );
|
||||
#endif
|
||||
saveToCache( mParsed, KStandardDirs::locateLocal( "cache",
|
||||
"kio_help" + cache +
|
||||
"cache.bz2" ) );
|
||||
|
@ -394,45 +381,6 @@ void HelpProtocol::get_file( const KUrl& url )
|
|||
{
|
||||
kDebug( 7119 ) << "get_file " << url.url();
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
QFile f( url.toLocalFile() );
|
||||
if ( !f.exists() ) {
|
||||
error( KIO::ERR_DOES_NOT_EXIST, url.url() );
|
||||
return;
|
||||
}
|
||||
if ( !f.open(QIODevice::ReadOnly) ) {
|
||||
error( KIO::ERR_CANNOT_OPEN_FOR_READING, url.path() );
|
||||
return;
|
||||
}
|
||||
int processed_size = 0;
|
||||
totalSize( f.size() );
|
||||
|
||||
QByteArray array;
|
||||
array.resize(MAX_IPC_SIZE);
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
qint64 n = f.read(array.data(),array.size());
|
||||
if (n == -1) {
|
||||
error( KIO::ERR_COULD_NOT_READ, url.path());
|
||||
f.close();
|
||||
return;
|
||||
}
|
||||
if (n == 0)
|
||||
break; // Finished
|
||||
|
||||
data( array );
|
||||
|
||||
processed_size += n;
|
||||
processedSize( processed_size );
|
||||
}
|
||||
|
||||
data( QByteArray() );
|
||||
f.close();
|
||||
|
||||
processedSize( f.size() );
|
||||
finished();
|
||||
#else
|
||||
QByteArray _path( QFile::encodeName(url.path()));
|
||||
KDE_struct_stat buff;
|
||||
if ( KDE_stat( _path.data(), &buff ) == -1 ) {
|
||||
|
@ -493,5 +441,4 @@ void HelpProtocol::get_file( const KUrl& url )
|
|||
processedSize( buff.st_size );
|
||||
|
||||
finished();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -72,11 +72,7 @@ void doOutput(QString output, bool usingStdOut, bool usingOutput, const QString
|
|||
file.open(QIODevice::WriteOnly);
|
||||
}
|
||||
if (replaceCharset) replaceCharsetHeader( output );
|
||||
#ifdef Q_WS_WIN
|
||||
QByteArray data = output.toUtf8();
|
||||
#else
|
||||
QByteArray data = output.toLocal8Bit();
|
||||
#endif
|
||||
file.write(data.data(), data.length());
|
||||
file.close();
|
||||
} else {
|
||||
|
|
|
@ -42,90 +42,6 @@ int closeQString(void * context) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined (SIMPLE_XSLT) && defined(Q_WS_WIN)
|
||||
|
||||
#define MAX_PATHS 64
|
||||
xmlExternalEntityLoader defaultEntityLoader = NULL;
|
||||
static xmlChar *paths[MAX_PATHS + 1];
|
||||
static int nbpaths = 0;
|
||||
static QHash<QString,QString> replaceURLList;
|
||||
|
||||
/*
|
||||
* Entity loading control and customization.
|
||||
* taken from xsltproc.c
|
||||
*/
|
||||
static xmlParserInputPtr xsltprocExternalEntityLoader(const char *_URL, const char *ID,xmlParserCtxtPtr ctxt)
|
||||
{
|
||||
xmlParserInputPtr ret;
|
||||
warningSAXFunc warning = NULL;
|
||||
|
||||
// use local available dtd versions instead of fetching it everytime from the internet
|
||||
QString url = QLatin1String(_URL);
|
||||
QHash<QString, QString>::const_iterator i;
|
||||
for(i = replaceURLList.constBegin(); i != replaceURLList.constEnd(); i++)
|
||||
{
|
||||
if (url.startsWith(i.key()))
|
||||
{
|
||||
url.replace(i.key(),i.value());
|
||||
qDebug() << "converted" << _URL << "to" << url;
|
||||
}
|
||||
}
|
||||
char URL[1024];
|
||||
strcpy(URL,url.toLatin1().constData());
|
||||
|
||||
const char *lastsegment = URL;
|
||||
const char *iter = URL;
|
||||
|
||||
if (nbpaths > 0) {
|
||||
while (*iter != 0) {
|
||||
if (*iter == '/')
|
||||
lastsegment = iter + 1;
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((ctxt != NULL) && (ctxt->sax != NULL)) {
|
||||
warning = ctxt->sax->warning;
|
||||
ctxt->sax->warning = NULL;
|
||||
}
|
||||
|
||||
if (defaultEntityLoader != NULL) {
|
||||
ret = defaultEntityLoader(URL, ID, ctxt);
|
||||
if (ret != NULL) {
|
||||
if (warning != NULL)
|
||||
ctxt->sax->warning = warning;
|
||||
qDebug() << "Loaded URL=\"" << URL << "\" ID=\"" << ID << "\"";
|
||||
return(ret);
|
||||
}
|
||||
}
|
||||
for (int i = 0;i < nbpaths;i++) {
|
||||
xmlChar *newURL;
|
||||
|
||||
newURL = xmlStrdup((const xmlChar *) paths[i]);
|
||||
newURL = xmlStrcat(newURL, (const xmlChar *) "/");
|
||||
newURL = xmlStrcat(newURL, (const xmlChar *) lastsegment);
|
||||
if (newURL != NULL) {
|
||||
ret = defaultEntityLoader((const char *)newURL, ID, ctxt);
|
||||
if (ret != NULL) {
|
||||
if (warning != NULL)
|
||||
ctxt->sax->warning = warning;
|
||||
qDebug() << "Loaded URL=\"" << newURL << "\" ID=\"" << ID << "\"";
|
||||
xmlFree(newURL);
|
||||
return(ret);
|
||||
}
|
||||
xmlFree(newURL);
|
||||
}
|
||||
}
|
||||
if (warning != NULL) {
|
||||
ctxt->sax->warning = warning;
|
||||
if (URL != NULL)
|
||||
warning(ctxt, "failed to load external entity \"%s\"\n", URL);
|
||||
else if (ID != NULL)
|
||||
warning(ctxt, "failed to load external entity \"%s\"\n", ID);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
QString transform( const QString &pat, const QString& tss,
|
||||
const QVector<const char *> ¶ms )
|
||||
|
@ -133,16 +49,6 @@ QString transform( const QString &pat, const QString& tss,
|
|||
QString parsed;
|
||||
|
||||
INFO(i18n("Parsing stylesheet"));
|
||||
#if defined (SIMPLE_XSLT) && defined(Q_WS_WIN)
|
||||
// prepare use of local available dtd versions instead of fetching everytime from the internet
|
||||
// this approach is url based
|
||||
if (!defaultEntityLoader) {
|
||||
defaultEntityLoader = xmlGetExternalEntityLoader();
|
||||
xmlSetExternalEntityLoader(xsltprocExternalEntityLoader);
|
||||
|
||||
replaceURLList[QLatin1String("http://www.oasis-open.org/docbook/xml/4.2")] = QString("file:///%1").arg(DOCBOOK_XML_CURRDTD);
|
||||
}
|
||||
#endif
|
||||
|
||||
xsltStylesheetPtr style_sheet =
|
||||
xsltParseStylesheetFile((const xmlChar *)QFile::encodeName(tss).constData());
|
||||
|
@ -289,9 +195,6 @@ QString splitOut(const QString &parsed, int index)
|
|||
|
||||
QByteArray fromUnicode( const QString &data )
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return data.toUtf8();
|
||||
#else
|
||||
QTextCodec *locale = QTextCodec::codecForLocale();
|
||||
QByteArray result;
|
||||
char buffer[30000];
|
||||
|
@ -334,22 +237,13 @@ QByteArray fromUnicode( const QString &data )
|
|||
offset += part_len;
|
||||
}
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
void replaceCharsetHeader( QString &output )
|
||||
{
|
||||
QString name;
|
||||
#ifdef Q_WS_WIN
|
||||
name = "utf-8";
|
||||
// may be required for all xml output
|
||||
if (output.contains("<table-of-contents>"))
|
||||
output.replace( QString( "<?xml version=\"1.0\"?>" ),
|
||||
QString( "<?xml version=\"1.0\" encoding=\"%1\"?>").arg( name ) );
|
||||
#else
|
||||
name = QTextCodec::codecForLocale()->name();
|
||||
name.replace( QString( "ISO " ), "iso-" );
|
||||
output.replace( QString( "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" ),
|
||||
QString( "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%1\">" ).arg( name ) );
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -82,14 +82,6 @@ QString lookForCache( const QString &filename )
|
|||
QString output;
|
||||
if ( readCache( filename, cache + "cache.bz2", output) )
|
||||
return output;
|
||||
#ifdef Q_WS_WIN
|
||||
QFileInfo fi(filename);
|
||||
// make sure filenames do not contain the base path, otherwise
|
||||
// accessing user data from another location invalids cached files.
|
||||
// Accessing user data under a different path is possible
|
||||
// when using usb sticks - this may affect unix/mac systems also
|
||||
cache = '/' + fi.absolutePath().remove(KStandardDirs::installPath("html"),Qt::CaseInsensitive).replace('/','_') + '_' + fi.baseName() + '.';
|
||||
#endif
|
||||
if ( readCache( filename,
|
||||
KStandardDirs::locateLocal( "cache",
|
||||
"kio_help" + cache +
|
||||
|
|
|
@ -445,14 +445,6 @@ QDir::SortFlags KDirOperator::sorting() const
|
|||
|
||||
bool KDirOperator::isRoot() const
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
if (url().isLocalFile()) {
|
||||
const QString path = url().toLocalFile();
|
||||
if (path.length() == 3)
|
||||
return (path[0].isLetter() && path[1] == ':' && path[2] == '/');
|
||||
return false;
|
||||
} else
|
||||
#endif
|
||||
return url().path() == QString(QLatin1Char('/'));
|
||||
}
|
||||
|
||||
|
@ -2626,11 +2618,7 @@ bool KDirOperator::Private::isReadable(const KUrl& url)
|
|||
return true; // what else can we say?
|
||||
|
||||
KDE_struct_stat buf;
|
||||
#ifdef Q_WS_WIN
|
||||
QString ts = url.toLocalFile();
|
||||
#else
|
||||
QString ts = url.path(KUrl::AddTrailingSlash);
|
||||
#endif
|
||||
bool readable = (KDE::stat(ts, &buf) == 0);
|
||||
if (readable) { // further checks
|
||||
DIR *test;
|
||||
|
|
|
@ -271,11 +271,7 @@ void KDirSelectDialog::Private::slotProperties()
|
|||
|
||||
KDirSelectDialog::KDirSelectDialog(const KUrl &startDir, bool localOnly,
|
||||
QWidget *parent)
|
||||
#ifdef Q_WS_WIN
|
||||
: KDialog( parent , Qt::WindowMinMaxButtonsHint),
|
||||
#else
|
||||
: KDialog( parent ),
|
||||
#endif
|
||||
d( new Private( localOnly, this ) )
|
||||
{
|
||||
setCaption( i18nc("@title:window","Select Folder") );
|
||||
|
|
|
@ -359,20 +359,10 @@ KFileWidget::KFileWidget( const KUrl& _startDir, QWidget *parent )
|
|||
|
||||
KUrl u;
|
||||
KUrlComboBox *pathCombo = d->urlNavigator->editor();
|
||||
#ifdef Q_WS_WIN
|
||||
foreach( const QFileInfo &drive,QFSFileEngine::drives() )
|
||||
{
|
||||
u.setPath( drive.filePath() );
|
||||
pathCombo->addDefaultUrl(u,
|
||||
KIO::pixmapForUrl( u, 0, KIconLoader::Small ),
|
||||
i18n("Drive: %1", u.toLocalFile()));
|
||||
}
|
||||
#else
|
||||
u.setPath(QDir::rootPath());
|
||||
pathCombo->addDefaultUrl(u,
|
||||
KIO::pixmapForUrl(u, 0, KIconLoader::Small),
|
||||
u.toLocalFile());
|
||||
#endif
|
||||
|
||||
u.setPath(QDir::homePath());
|
||||
pathCombo->addDefaultUrl(u, KIO::pixmapForUrl(u, 0, KIconLoader::Small),
|
||||
|
|
|
@ -117,8 +117,6 @@ static char sock_file[MAX_SOCK_FILE];
|
|||
#define DISPLAY "QWS_DISPLAY"
|
||||
#elif defined(Q_WS_MACX)
|
||||
#define DISPLAY "MAC_DISPLAY"
|
||||
#elif defined(Q_WS_WIN)
|
||||
#define DISPLAY "WIN_DISPLAY"
|
||||
#else
|
||||
#error Use QT/X11 or QT/Embedded
|
||||
#endif
|
||||
|
|
|
@ -39,18 +39,12 @@
|
|||
#include <QtCore/QDir>
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/QStringList>
|
||||
#ifdef Q_WS_WIN
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#endif
|
||||
#include "kstandarddirs.h"
|
||||
#endif
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
/* These are to link libkio even if 'smart' linker is used */
|
||||
#include <kio/authinfo.h>
|
||||
extern "C" KIO::AuthInfo* _kioslave_init_kio() { return new KIO::AuthInfo(); }
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -117,38 +111,6 @@ int main(int argc, char **argv)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
// enter debugger in case debugging is actived
|
||||
QString slaveDebugWait( QString::fromLocal8Bit( qgetenv("KDE_SLAVE_DEBUG_WAIT") ) );
|
||||
if (slaveDebugWait == QLatin1String("all") || slaveDebugWait == argv[2])
|
||||
{
|
||||
# ifdef Q_CC_MSVC
|
||||
// msvc debugger or windbg supports jit debugging, the latter requires setting up windbg jit with windbg -i
|
||||
DebugBreak();
|
||||
# else
|
||||
// gdb does not support win32 jit debug support, so implement it by ourself
|
||||
WCHAR buf[1024];
|
||||
GetModuleFileName(NULL,buf, 1024);
|
||||
QStringList params;
|
||||
params << QString::fromUtf16((const unsigned short*)buf);
|
||||
params << QString::number(GetCurrentProcessId());
|
||||
QProcess::startDetached("gdb",params);
|
||||
Sleep(1000);
|
||||
# endif
|
||||
}
|
||||
# if defined(Q_CC_MSVC) && !defined(_WIN32_WCE)
|
||||
else {
|
||||
QString slaveDebugPopup( QString::fromLocal8Bit( qgetenv("KDE_SLAVE_DEBUG_POPUP") ) );
|
||||
if (slaveDebugPopup == QLatin1String("all") || slaveDebugPopup == argv[2]) {
|
||||
// A workaround for OSes where DebugBreak() does not work in administrative mode (actually Vista with msvc 2k5)
|
||||
// - display a native message box so developer can attach the debugger to the KIO slave process and click OK.
|
||||
MessageBoxA(NULL,
|
||||
QString("Please attach the debugger to process #%1 (%2)").arg(getpid()).arg(argv[0]).toLatin1(),
|
||||
QString("\"%1\" KIO Slave Debugging").arg(argv[2]).toLatin1(), MB_OK|MB_ICONINFORMATION|MB_TASKMODAL);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif // Q_WS_WIN
|
||||
|
||||
int (*func)(int, char *[]) = (int (*)(int, char *[])) sym;
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ static void sig_handler(int sig_num)
|
|||
|
||||
extern "C" KDE_EXPORT int kdemain( int argc, char**argv )
|
||||
{
|
||||
#ifndef Q_WS_WIN
|
||||
// Started via kdeinit.
|
||||
int launcherFd;
|
||||
if (argc != 2 || memcmp(argv[1], "--fd=", 5) || !(launcherFd = atoi(argv[1] + 5)))
|
||||
|
@ -63,7 +62,6 @@ extern "C" KDE_EXPORT int kdemain( int argc, char**argv )
|
|||
"klauncher: It is started automatically by kdeinit4.\n").toLocal8Bit().data());
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_DARWIN) || defined (Q_OS_MAC)
|
||||
mac_initialize_dbus();
|
||||
|
|
|
@ -252,11 +252,7 @@ bool KFileDialogPrivate::Native::s_allowNative = true;
|
|||
|
||||
KFileDialog::KFileDialog( const KUrl& startDir, const QString& filter,
|
||||
QWidget *parent, QWidget* customWidget)
|
||||
#ifdef Q_WS_WIN
|
||||
: KDialog( parent , Qt::WindowMinMaxButtonsHint),
|
||||
#else
|
||||
: KDialog( parent ),
|
||||
#endif
|
||||
d( new KFileDialogPrivate )
|
||||
|
||||
{
|
||||
|
@ -961,103 +957,8 @@ KAbstractFileWidget* KFileDialog::fileWidget()
|
|||
return d->w;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
int KFileDialog::exec()
|
||||
{
|
||||
if (!d->native || !KFileDialogPrivate::Native::s_allowNative) {
|
||||
KFileDialogPrivate::Native::s_allowNative = true;
|
||||
return KDialog::exec();
|
||||
}
|
||||
|
||||
// not clear here to let KFileDialogPrivate::Native::startDir() return a useful value
|
||||
// d->native->selectedUrls.clear();
|
||||
int res = QDialog::Rejected;
|
||||
switch (d->native->operationMode) {
|
||||
case KAbstractFileWidget::Opening:
|
||||
case KAbstractFileWidget::Other:
|
||||
if (d->native->mode & KFile::File) {
|
||||
KUrl url( KFileDialogPrivate::getOpenUrl(
|
||||
d->native->startDir(), d->native->filter, parentWidget(), windowTitle(), &d->native->selectedFilter ) );
|
||||
if (url.isEmpty() || !url.isValid()) {
|
||||
res = QDialog::Rejected;
|
||||
break;
|
||||
}
|
||||
d->native->selectedUrls.clear();
|
||||
d->native->selectedUrls.append(url);
|
||||
res = QDialog::Accepted;
|
||||
break;
|
||||
}
|
||||
else if (d->native->mode & KFile::Files) {
|
||||
KUrl::List urls( KFileDialogPrivate::getOpenUrls(
|
||||
d->native->startDir(), d->native->filter, parentWidget(), windowTitle(), &d->native->selectedFilter ) );
|
||||
if (urls.isEmpty()) {
|
||||
res = QDialog::Rejected;
|
||||
break;
|
||||
}
|
||||
d->native->selectedUrls = urls;
|
||||
res = QDialog::Accepted;
|
||||
break;
|
||||
}
|
||||
else if (d->native->mode & KFile::Directory) {
|
||||
KUrl url( KFileDialog::getExistingDirectoryUrl(
|
||||
d->native->startDir(), parentWidget(), windowTitle()) );
|
||||
if (url.isEmpty() || !url.isValid()) {
|
||||
res = QDialog::Rejected;
|
||||
break;
|
||||
}
|
||||
d->native->selectedUrls.clear();
|
||||
d->native->selectedUrls.append(url);
|
||||
res = QDialog::Accepted;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case KAbstractFileWidget::Saving:
|
||||
if (d->native->mode & KFile::File) {
|
||||
KUrl url( KFileDialogPrivate::getSaveUrl(
|
||||
d->native->startDir(), d->native->filter, parentWidget(), windowTitle(), Options(0), &d->native->selectedFilter ) );
|
||||
if (url.isEmpty() || !url.isValid()) {
|
||||
res = QDialog::Rejected;
|
||||
break;
|
||||
}
|
||||
d->native->selectedUrls.clear();
|
||||
d->native->selectedUrls.append(url);
|
||||
res = QDialog::Accepted;
|
||||
break;
|
||||
}
|
||||
else if (d->native->mode & KFile::Directory) {
|
||||
KUrl url( KFileDialog::getExistingDirectoryUrl(
|
||||
d->native->startDir(), parentWidget(), windowTitle()) );
|
||||
if (url.isEmpty() || !url.isValid()) {
|
||||
res = QDialog::Rejected;
|
||||
break;
|
||||
}
|
||||
d->native->selectedUrls.clear();
|
||||
d->native->selectedUrls.append(url);
|
||||
res = QDialog::Accepted;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
||||
setResult(res);
|
||||
emit finished();
|
||||
|
||||
if (res == QDialog::Accepted) {
|
||||
emit accepted();
|
||||
} else {
|
||||
emit rejected();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif // Q_WS_WIN
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#define KF_EXTERN extern __declspec(dllimport)
|
||||
#else
|
||||
#define KF_EXTERN extern
|
||||
#endif
|
||||
|
||||
typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption,
|
||||
const QString &dir,
|
||||
|
|
|
@ -749,10 +749,6 @@ public:
|
|||
*/
|
||||
static void setStartDir( const KUrl& directory );
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
public Q_SLOTS:
|
||||
int exec();
|
||||
#endif
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
|
|
|
@ -134,12 +134,6 @@ extern "C" {
|
|||
#include <kbuildsycocaprogressdialog.h>
|
||||
#include <kmimetypechooser.h>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
# include <kkernel_win.h>
|
||||
#ifdef __GNUC__
|
||||
# warning TODO: port completely to win32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
using namespace KDEPrivate;
|
||||
|
||||
|
@ -283,11 +277,6 @@ bool KPropertiesDialog::showDialog(const KFileItem& item, QWidget* parent,
|
|||
{
|
||||
// TODO: do we really want to show the win32 property dialog?
|
||||
// This means we lose metainfo, support for .desktop files, etc. (DF)
|
||||
#ifdef Q_WS_WIN
|
||||
QString localPath = item.localPath();
|
||||
if (!localPath.isEmpty())
|
||||
return showWin32FilePropertyDialog(localPath);
|
||||
#endif
|
||||
KPropertiesDialog* dlg = new KPropertiesDialog(item, parent);
|
||||
if (modal) {
|
||||
dlg->exec();
|
||||
|
@ -301,10 +290,6 @@ bool KPropertiesDialog::showDialog(const KFileItem& item, QWidget* parent,
|
|||
bool KPropertiesDialog::showDialog(const KUrl& _url, QWidget* parent,
|
||||
bool modal)
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
if (_url.isLocalFile())
|
||||
return showWin32FilePropertyDialog( _url.toLocalFile() );
|
||||
#endif
|
||||
KPropertiesDialog* dlg = new KPropertiesDialog(_url, parent);
|
||||
if (modal) {
|
||||
dlg->exec();
|
||||
|
@ -735,11 +720,6 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
|
|||
if ( magicMimeType->name() != KMimeType::defaultMimeType() )
|
||||
magicMimeComment = magicMimeType->comment();
|
||||
}
|
||||
#ifdef Q_WS_WIN
|
||||
if ( isReallyLocal ) {
|
||||
directory = QDir::toNativeSeparators( directory.mid( 1 ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
// Those things only apply to 'single file' mode
|
||||
QString filename;
|
||||
|
|
|
@ -557,11 +557,7 @@ ConnectionServer::~ConnectionServer()
|
|||
|
||||
void ConnectionServer::listenForRemote()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
d->backend = new SocketConnectionBackend(SocketConnectionBackend::TcpSocketMode, this);
|
||||
#else
|
||||
d->backend = new SocketConnectionBackend(SocketConnectionBackend::LocalSocketMode, this);
|
||||
#endif
|
||||
if (!d->backend->listenForRemote()) {
|
||||
delete d->backend;
|
||||
d->backend = 0;
|
||||
|
|
|
@ -287,11 +287,7 @@ void DeleteJobPrivate::deleteNextFile()
|
|||
}
|
||||
// Normal deletion
|
||||
// If local file, try do it directly
|
||||
#ifdef Q_WS_WIN
|
||||
if ( (*it).isLocalFile() && DeleteFileW( (LPCWSTR)(*it).toLocalFile().utf16() ) != 0 ) {
|
||||
#else
|
||||
if ( (*it).isLocalFile() && unlink( QFile::encodeName((*it).toLocalFile()) ) == 0 ) {
|
||||
#endif
|
||||
//kdDebug(7007) << "DeleteJob deleted" << (*it).toLocalFile();
|
||||
job = 0;
|
||||
m_processedFiles++;
|
||||
|
@ -333,11 +329,7 @@ void DeleteJobPrivate::deleteNextDir()
|
|||
// Take first dir to delete out of list - last ones first !
|
||||
KUrl::List::iterator it = --dirs.end();
|
||||
// If local dir, try to rmdir it directly
|
||||
#ifdef Q_WS_WIN
|
||||
if ( (*it).isLocalFile() && RemoveDirectoryW( (LPCWSTR)(*it).toLocalFile().utf16() ) != 0 ) {
|
||||
#else
|
||||
if ( (*it).isLocalFile() && ::rmdir( QFile::encodeName((*it).toLocalFile()) ) == 0 ) {
|
||||
#endif
|
||||
m_processedDirs++;
|
||||
if ( m_processedDirs % 100 == 1 ) { // update progress info every 100 dirs
|
||||
m_currentURL = *it;
|
||||
|
|
|
@ -3085,11 +3085,7 @@ QString CacheInfo::cachedFileName()
|
|||
|
||||
QFile *CacheInfo::cachedFile()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
const char *mode = (readWrite ? "rb+" : "rb");
|
||||
#else
|
||||
const char *mode = (readWrite ? "r+" : "r");
|
||||
#endif
|
||||
|
||||
FILE *fs = KDE::fopen(CEF, mode); // Open for reading and writing
|
||||
if (!fs)
|
||||
|
|
|
@ -109,9 +109,7 @@ static bool runFSDevice( const KUrl& _url, const KDesktopFile &cfg )
|
|||
if ( fstype == "Default" ) // KDE-1 thing
|
||||
fstype.clear();
|
||||
QString point = cg.readEntry( "MountPoint" );
|
||||
#ifndef Q_WS_WIN
|
||||
(void) new KAutoMount( ro, fstype.toLatin1(), dev, point, _url.toLocalFile() );
|
||||
#endif
|
||||
retval = false;
|
||||
}
|
||||
|
||||
|
@ -318,17 +316,13 @@ void KDesktopFileActions::executeService( const KUrl::List& urls, const KService
|
|||
if ( fstype == "Default" ) // KDE-1 thing
|
||||
fstype.clear();
|
||||
QString point = group.readEntry( "MountPoint" );
|
||||
#ifndef Q_WS_WIN
|
||||
(void)new KAutoMount( ro, fstype.toLatin1(), dev, point, path, false );
|
||||
#endif
|
||||
} else if ( actionData == ST_UNMOUNT ) {
|
||||
// Not mounted? Strange, but who knows ...
|
||||
if ( !mp )
|
||||
return;
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
(void)new KAutoUnmount( mp->mountPoint(), path );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifndef KIO_NO_SOLID
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
class KDirModelNode;
|
||||
class KDirModelDirNode;
|
||||
|
@ -715,24 +712,6 @@ QVariant KDirModel::data( const QModelIndex & index, int role ) const
|
|||
// slow
|
||||
// QDir dir(path);
|
||||
// count = dir.entryList(QDir::AllEntries|QDir::NoDotAndDotDot|QDir::System).count();
|
||||
#ifdef Q_WS_WIN
|
||||
QString s = path + QLatin1String( "\\*.*" );
|
||||
s.replace('/', '\\');
|
||||
count = 0;
|
||||
WIN32_FIND_DATA findData;
|
||||
HANDLE hFile = FindFirstFile( (LPWSTR)s.utf16(), &findData );
|
||||
if( hFile != INVALID_HANDLE_VALUE ) {
|
||||
do {
|
||||
if (!( findData.cFileName[0] == '.' &&
|
||||
findData.cFileName[1] == '\0' ) &&
|
||||
!( findData.cFileName[0] == '.' &&
|
||||
findData.cFileName[1] == '.' &&
|
||||
findData.cFileName[2] == '\0' ) )
|
||||
++count;
|
||||
} while( FindNextFile( hFile, &findData ) != 0 );
|
||||
FindClose( hFile );
|
||||
}
|
||||
#else
|
||||
DIR* dir = ::opendir(QFile::encodeName(path));
|
||||
if (dir) {
|
||||
count = 0;
|
||||
|
@ -748,7 +727,6 @@ QVariant KDirModel::data( const QModelIndex & index, int role ) const
|
|||
}
|
||||
::closedir(dir);
|
||||
}
|
||||
#endif
|
||||
//kDebug(7008) << "child count for " << path << ":" << count;
|
||||
dirNode->setChildCount(count);
|
||||
}
|
||||
|
|
|
@ -690,11 +690,6 @@ QString KFileItemPrivate::user() const
|
|||
{
|
||||
QString userName = m_entry.stringValue(KIO::UDSEntry::UDS_USER);
|
||||
if (userName.isEmpty() && m_bIsLocalUrl) {
|
||||
#ifdef Q_WS_WIN
|
||||
QFileInfo a(m_url.toLocalFile( KUrl::RemoveTrailingSlash ));
|
||||
userName = a.owner();
|
||||
m_entry.insert( KIO::UDSEntry::UDS_USER, userName );
|
||||
#else
|
||||
KDE_struct_stat buff;
|
||||
if ( KDE::lstat( m_url.toLocalFile( KUrl::RemoveTrailingSlash ), &buff ) == 0) // get uid/gid of the link, if it's a link
|
||||
{
|
||||
|
@ -704,7 +699,6 @@ QString KFileItemPrivate::user() const
|
|||
m_entry.insert( KIO::UDSEntry::UDS_USER, userName );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return userName;
|
||||
}
|
||||
|
@ -722,11 +716,6 @@ QString KFileItemPrivate::group() const
|
|||
QString groupName = m_entry.stringValue( KIO::UDSEntry::UDS_GROUP );
|
||||
if (groupName.isEmpty() && m_bIsLocalUrl )
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
QFileInfo a(m_url.toLocalFile( KUrl::RemoveTrailingSlash ));
|
||||
groupName = a.group();
|
||||
m_entry.insert( KIO::UDSEntry::UDS_GROUP, groupName );
|
||||
#else
|
||||
KDE_struct_stat buff;
|
||||
if ( KDE::lstat( m_url.toLocalFile( KUrl::RemoveTrailingSlash ), &buff ) == 0) // get uid/gid of the link, if it's a link
|
||||
{
|
||||
|
@ -740,7 +729,6 @@ QString KFileItemPrivate::group() const
|
|||
groupName.sprintf("%d",buff.st_gid);
|
||||
m_entry.insert( KIO::UDSEntry::UDS_GROUP, groupName );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return groupName;
|
||||
}
|
||||
|
@ -1254,11 +1242,9 @@ QString KFileItem::getToolTipText(int maxcount) const
|
|||
|
||||
tip += start + i18n("Modified:") + mid +
|
||||
timeString( KFileItem::ModificationTime ) + end
|
||||
#ifndef Q_WS_WIN //TODO: show win32-specific permissions
|
||||
+start + i18n("Owner:") + mid + user() + " - " + group() + end +
|
||||
start + i18n("Permissions:") + mid +
|
||||
permissionsString() + end
|
||||
#endif
|
||||
;
|
||||
|
||||
if (info.isValid())
|
||||
|
|
|
@ -49,9 +49,7 @@ static QString findExe( const char* exeName )
|
|||
// Normally fileshareset and filesharelist are installed in kde4/libexec;
|
||||
// allow distributions to move it somewhere else in the PATH or in /usr/sbin.
|
||||
QString path = QString::fromLocal8Bit(qgetenv("PATH"));
|
||||
#ifndef Q_WS_WIN
|
||||
path += QLatin1String(":/usr/sbin");
|
||||
#endif
|
||||
QString exe = KStandardDirs::findExe( exeName, path );
|
||||
if (exe.isEmpty())
|
||||
kError() << exeName << "not found in" << path;
|
||||
|
|
|
@ -653,8 +653,6 @@ static QString platform()
|
|||
return QL1S("X11");
|
||||
#elif defined(Q_WS_MAC)
|
||||
return QL1S("Macintosh");
|
||||
#elif defined(Q_WS_WIN)
|
||||
return QL1S("Windows");
|
||||
#elif defined(Q_WS_S60)
|
||||
return QL1S("Symbian");
|
||||
#endif
|
||||
|
@ -863,28 +861,8 @@ bool KProtocolManager::getSystemNameVersionAndMachine(
|
|||
struct utsname unameBuf;
|
||||
if ( 0 != uname( &unameBuf ) )
|
||||
return false;
|
||||
#if defined(Q_WS_WIN) && !defined(_WIN32_WCE)
|
||||
// we do not use unameBuf.sysname information constructed in kdewin32
|
||||
// because we want to get separate name and version
|
||||
systemName = QL1S( "Windows" );
|
||||
OSVERSIONINFOEX versioninfo;
|
||||
ZeroMemory(&versioninfo, sizeof(OSVERSIONINFOEX));
|
||||
// try calling GetVersionEx using the OSVERSIONINFOEX, if that fails, try using the OSVERSIONINFO
|
||||
versioninfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
||||
bool ok = GetVersionEx( (OSVERSIONINFO *) &versioninfo );
|
||||
if ( !ok ) {
|
||||
versioninfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
|
||||
ok = GetVersionEx( (OSVERSIONINFO *) &versioninfo );
|
||||
}
|
||||
if ( ok ) {
|
||||
systemVersion = QString::number(versioninfo.dwMajorVersion);
|
||||
systemVersion += QL1C('.');
|
||||
systemVersion += QString::number(versioninfo.dwMinorVersion);
|
||||
}
|
||||
#else
|
||||
systemName = unameBuf.sysname;
|
||||
systemVersion = unameBuf.release;
|
||||
#endif
|
||||
machine = unameBuf.machine;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -80,8 +80,6 @@
|
|||
|
||||
#ifdef Q_WS_X11
|
||||
#include <kwindowsystem.h>
|
||||
#elif defined(Q_WS_WIN)
|
||||
#include <QDesktopServices>
|
||||
#endif
|
||||
|
||||
KRun::KRunPrivate::KRunPrivate(KRun *parent)
|
||||
|
@ -106,9 +104,6 @@ bool KRun::isExecutableFile(const KUrl& url, const QString &mimetype)
|
|||
if (file.isExecutable()) { // Got a prospective file to run
|
||||
KMimeType::Ptr mimeType = KMimeType::mimeType(mimetype, KMimeType::ResolveAliases);
|
||||
if (mimeType && (mimeType->is(QLatin1String("application/x-executable")) ||
|
||||
#ifdef Q_WS_WIN
|
||||
mimeType->is(QLatin1String("application/x-ms-dos-executable")) ||
|
||||
#endif
|
||||
mimeType->is(QLatin1String("application/x-executable-script")))
|
||||
)
|
||||
{
|
||||
|
@ -175,16 +170,10 @@ bool KRun::runUrl(const KUrl& u, const QString& _mimetype, QWidget* window, bool
|
|||
KService::Ptr offer = KMimeTypeTrader::self()->preferredService(_mimetype);
|
||||
|
||||
if (!offer) {
|
||||
#ifdef Q_WS_WIN
|
||||
// As KDE on windows doesnt know about the windows default applications offers will be empty in nearly all cases.
|
||||
// So we use QDesktopServices::openUrl to let windows decide how to open the file
|
||||
return QDesktopServices::openUrl(u);
|
||||
#else
|
||||
// Open-with dialog
|
||||
// TODO : pass the mimetype as a parameter, to show it (comment field) in the dialog !
|
||||
// Hmm, in fact KOpenWithDialog::setServiceType already guesses the mimetype from the first URL of the list...
|
||||
return displayOpenWithDialog(lst, window, tempFile, suggestedFileName, asn);
|
||||
#endif
|
||||
}
|
||||
|
||||
return KRun::run(*offer, lst, window, tempFile, suggestedFileName, asn);
|
||||
|
@ -199,13 +188,6 @@ bool KRun::displayOpenWithDialog(const KUrl::List& lst, QWidget* window, bool te
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
KConfigGroup cfgGroup(KGlobal::config(), "KOpenWithDialog Settings");
|
||||
if (cfgGroup.readEntry("Native", true)) {
|
||||
return KRun::KRunPrivate::displayNativeOpenWithDialog(lst, window, tempFiles,
|
||||
suggestedFileName, asn);
|
||||
}
|
||||
#endif
|
||||
KOpenWithDialog l(lst, i18n("Open with:"), QString(), window);
|
||||
l.setWindowModality(Qt::WindowModal);
|
||||
if (l.exec()) {
|
||||
|
|
|
@ -88,10 +88,6 @@ public:
|
|||
// starting is the only valid use of the timer in subclasses (BrowserRun, KHTMLRun and KonqRun)
|
||||
void startTimer();
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
static bool displayNativeOpenWithDialog( const KUrl::List& lst, QWidget* window, bool tempFiles,
|
||||
const QString& suggestedFileName, const QByteArray& asn );
|
||||
#endif
|
||||
bool runExecutable(const QString& _exec);
|
||||
|
||||
KRun *q;
|
||||
|
|
|
@ -61,9 +61,6 @@
|
|||
#include <sys/param.h>
|
||||
#include <kconfiggroup.h>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <kkernel_win.h>
|
||||
#endif
|
||||
|
||||
static bool expandTilde(QString&);
|
||||
static bool expandEnv(QString&);
|
||||
|
@ -1284,16 +1281,6 @@ void KUrlCompletion::postProcessMatch(QString* pMatch) const
|
|||
|
||||
expandTilde(copy);
|
||||
expandEnv(copy);
|
||||
#ifdef Q_WS_WIN
|
||||
DWORD dwAttr = GetFileAttributesW((LPCWSTR) copy.utf16());
|
||||
if (dwAttr == INVALID_FILE_ATTRIBUTES) {
|
||||
kDebug() << "Could not get file attribs ( "
|
||||
<< GetLastError()
|
||||
<< " ) for "
|
||||
<< copy;
|
||||
} else if ((dwAttr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)
|
||||
pMatch->append(QLatin1Char('/'));
|
||||
#else
|
||||
if (QDir::isRelativePath(copy))
|
||||
copy.prepend(d->cwd + QLatin1Char('/'));
|
||||
|
||||
|
@ -1309,7 +1296,6 @@ void KUrlCompletion::postProcessMatch(QString* pMatch) const
|
|||
} else {
|
||||
kDebug() << "Could not stat file" << copy;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,10 +56,8 @@ static QString destDir() { return homeTmpDir() + "destdir/"; }
|
|||
static QString srcFile() { return homeTmpDir() + "testfile"; }
|
||||
static QString destFile() { return destDir() + "testfile"; }
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
static QString srcLink() { return homeTmpDir() + "symlink"; }
|
||||
static QString destLink() { return destDir() + "symlink"; }
|
||||
#endif
|
||||
|
||||
static QString srcSubDir() { return homeTmpDir() + "subdir"; }
|
||||
static QString destSubDir() { return destDir() + "subdir"; }
|
||||
|
@ -68,9 +66,7 @@ static KUrl::List sourceList()
|
|||
{
|
||||
KUrl::List lst;
|
||||
lst << KUrl( srcFile() );
|
||||
#ifndef Q_WS_WIN
|
||||
lst << KUrl( srcLink() );
|
||||
#endif
|
||||
return lst;
|
||||
}
|
||||
|
||||
|
@ -104,9 +100,7 @@ static void checkTestDirectory( const QString& path )
|
|||
{
|
||||
QVERIFY( QFileInfo( path ).isDir() );
|
||||
QVERIFY( QFileInfo( path + "/fileindir" ).isFile() );
|
||||
#ifndef Q_WS_WIN
|
||||
QVERIFY( QFileInfo( path + "/testlink" ).isSymLink() );
|
||||
#endif
|
||||
QVERIFY( QFileInfo( path + "/dirindir" ).isDir() );
|
||||
QVERIFY( QFileInfo( path + "/dirindir/nested" ).isFile() );
|
||||
}
|
||||
|
@ -118,9 +112,7 @@ static void createTestDirectory( const QString& path )
|
|||
if ( !ok )
|
||||
kFatal() << "couldn't create " << path ;
|
||||
createTestFile( path + "/fileindir", "File in dir" );
|
||||
#ifndef Q_WS_WIN
|
||||
createTestSymlink( path + "/testlink" );
|
||||
#endif
|
||||
ok = dir.mkdir( path + "/dirindir" );
|
||||
if ( !ok )
|
||||
kFatal() << "couldn't create " << path ;
|
||||
|
@ -181,9 +173,7 @@ void FileUndoManagerTest::initTestCase()
|
|||
}
|
||||
|
||||
createTestFile( srcFile(), "Hello world" );
|
||||
#ifndef Q_WS_WIN
|
||||
createTestSymlink( srcLink() );
|
||||
#endif
|
||||
createTestDirectory( srcSubDir() );
|
||||
|
||||
QDir().mkdir( destDir() );
|
||||
|
@ -231,10 +221,8 @@ void FileUndoManagerTest::testCopyFiles()
|
|||
QVERIFY( ok );
|
||||
|
||||
QVERIFY( QFile::exists( destFile() ) );
|
||||
#ifndef Q_WS_WIN
|
||||
// Don't use QFile::exists, it's a broken symlink...
|
||||
QVERIFY( QFileInfo( destLink() ).isSymLink() );
|
||||
#endif
|
||||
|
||||
// might have to wait for dbus signal here... but this is currently disabled.
|
||||
//QTest::qWait( 20 );
|
||||
|
@ -262,10 +250,8 @@ void FileUndoManagerTest::testCopyFiles()
|
|||
|
||||
// Check that undo worked
|
||||
QVERIFY( !QFile::exists( destFile() ) );
|
||||
#ifndef Q_WS_WIN
|
||||
QVERIFY( !QFile::exists( destLink() ) );
|
||||
QVERIFY( !QFileInfo( destLink() ).isSymLink() );
|
||||
#endif
|
||||
}
|
||||
|
||||
void FileUndoManagerTest::testMoveFiles()
|
||||
|
@ -283,20 +269,16 @@ void FileUndoManagerTest::testMoveFiles()
|
|||
|
||||
QVERIFY( !QFile::exists( srcFile() ) ); // the source moved
|
||||
QVERIFY( QFile::exists( destFile() ) );
|
||||
#ifndef Q_WS_WIN
|
||||
QVERIFY( !QFileInfo( srcLink() ).isSymLink() );
|
||||
// Don't use QFile::exists, it's a broken symlink...
|
||||
QVERIFY( QFileInfo( destLink() ).isSymLink() );
|
||||
#endif
|
||||
|
||||
doUndo();
|
||||
|
||||
QVERIFY( QFile::exists( srcFile() ) ); // the source is back
|
||||
QVERIFY( !QFile::exists( destFile() ) );
|
||||
#ifndef Q_WS_WIN
|
||||
QVERIFY( QFileInfo( srcLink() ).isSymLink() );
|
||||
QVERIFY( !QFileInfo( destLink() ).isSymLink() );
|
||||
#endif
|
||||
}
|
||||
|
||||
// Testing for overwrite isn't possible, because non-interactive jobs never overwrite.
|
||||
|
@ -447,9 +429,7 @@ void FileUndoManagerTest::testTrashFiles()
|
|||
|
||||
// Check that things got removed
|
||||
QVERIFY( !QFile::exists( srcFile() ) );
|
||||
#ifndef Q_WS_WIN
|
||||
QVERIFY( !QFileInfo( srcLink() ).isSymLink() );
|
||||
#endif
|
||||
QVERIFY( !QFile::exists( srcSubDir() ) );
|
||||
|
||||
// check trash?
|
||||
|
@ -461,9 +441,7 @@ void FileUndoManagerTest::testTrashFiles()
|
|||
doUndo();
|
||||
|
||||
QVERIFY( QFile::exists( srcFile() ) );
|
||||
#ifndef Q_WS_WIN
|
||||
QVERIFY( QFileInfo( srcLink() ).isSymLink() );
|
||||
#endif
|
||||
QVERIFY( QFile::exists( srcSubDir() ) );
|
||||
|
||||
// We can't check that the trash is empty; other partitions might have their own trash
|
||||
|
|
|
@ -28,12 +28,8 @@
|
|||
|
||||
static QString otherTmpDir()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return QDir::tempPath() + "/jobtest/";
|
||||
#else
|
||||
// This one needs to be on another partition
|
||||
return "/tmp/jobtest/";
|
||||
#endif
|
||||
}
|
||||
|
||||
class JobGuiTest : public QObject
|
||||
|
|
|
@ -67,12 +67,8 @@ static QString remoteTmpDir()
|
|||
|
||||
static QString localTmpDir()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return QDir::tempPath() + "/jobremotetest/";
|
||||
#else
|
||||
// This one needs to be on another partition
|
||||
return "/tmp/jobremotetest/";
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool myExists(const QString& pathOrUrl) {
|
||||
|
|
|
@ -55,22 +55,14 @@ QTEST_KDEMAIN( JobTest, NoGUI )
|
|||
|
||||
static QString otherTmpDir()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return QDir::tempPath() + "/jobtest/";
|
||||
#else
|
||||
// This one needs to be on another partition
|
||||
return "/tmp/jobtest/";
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
static KUrl systemTmpDir()
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
return KUrl( "system:" + QDir::homePath() + "/.kde-unit-test/jobtest-system/" );
|
||||
#else
|
||||
return KUrl( "system:/home/.kde-unit-test/jobtest-system/" );
|
||||
#endif
|
||||
}
|
||||
|
||||
static QString realSystemPath()
|
||||
|
@ -252,13 +244,7 @@ void JobTest::copyLocalFile( const QString& src, const QString& dest )
|
|||
// The datapump solution ignores mtime, the app has to call FileCopyJob::setModificationTime()
|
||||
QFileInfo srcInfo( src );
|
||||
QFileInfo destInfo( dest );
|
||||
#ifdef Q_WS_WIN
|
||||
// win32 time may differs in msec part
|
||||
QCOMPARE( srcInfo.lastModified().toString("dd.MM.yyyy hh:mm"),
|
||||
destInfo.lastModified().toString("dd.MM.yyyy hh:mm") );
|
||||
#else
|
||||
QCOMPARE( srcInfo.lastModified(), destInfo.lastModified() );
|
||||
#endif
|
||||
}
|
||||
|
||||
// cleanup and retry with KIO::copy()
|
||||
|
@ -274,13 +260,7 @@ void JobTest::copyLocalFile( const QString& src, const QString& dest )
|
|||
// check that the timestamp is the same (#24443)
|
||||
QFileInfo srcInfo( src );
|
||||
QFileInfo destInfo( dest );
|
||||
#ifdef Q_WS_WIN
|
||||
// win32 time may differs in msec part
|
||||
QCOMPARE( srcInfo.lastModified().toString("dd.MM.yyyy hh:mm"),
|
||||
destInfo.lastModified().toString("dd.MM.yyyy hh:mm") );
|
||||
#else
|
||||
QCOMPARE( srcInfo.lastModified(), destInfo.lastModified() );
|
||||
#endif
|
||||
}
|
||||
QCOMPARE(spyCopyingDone.count(), 1);
|
||||
}
|
||||
|
@ -314,14 +294,12 @@ void JobTest::copyLocalDirectory( const QString& src, const QString& _dest, int
|
|||
}
|
||||
|
||||
// CopyJob::setNextDirAttribute isn't implemented for Windows currently.
|
||||
#ifndef Q_WS_WIN
|
||||
{
|
||||
// Check that the timestamp is the same (#24443)
|
||||
QFileInfo srcInfo( src );
|
||||
QFileInfo destInfo( dest );
|
||||
QCOMPARE( srcInfo.lastModified(), destInfo.lastModified() );
|
||||
}
|
||||
#endif
|
||||
|
||||
// Do it again, with Overwrite.
|
||||
// Use copyAs, we don't want a subdir inside d.
|
||||
|
@ -444,9 +422,7 @@ void JobTest::moveLocalDirectory( const QString& src, const QString& dest )
|
|||
QVERIFY( QFile::exists( src ) );
|
||||
QVERIFY( QFileInfo( src ).isDir() );
|
||||
QVERIFY( QFileInfo( src + "/testfile" ).isFile() );
|
||||
#ifndef Q_WS_WIN
|
||||
QVERIFY( QFileInfo( src + "/testlink" ).isSymLink() );
|
||||
#endif
|
||||
KUrl u;
|
||||
u.setPath( src );
|
||||
KUrl d;
|
||||
|
@ -460,9 +436,7 @@ void JobTest::moveLocalDirectory( const QString& src, const QString& dest )
|
|||
QVERIFY( QFileInfo( dest ).isDir() );
|
||||
QVERIFY( QFileInfo( dest + "/testfile" ).isFile() );
|
||||
QVERIFY( !QFile::exists( src ) ); // not there anymore
|
||||
#ifndef Q_WS_WIN
|
||||
QVERIFY( QFileInfo( dest + "/testlink" ).isSymLink() );
|
||||
#endif
|
||||
}
|
||||
|
||||
void JobTest::moveFileToSamePartition()
|
||||
|
@ -494,32 +468,25 @@ void JobTest::moveFileToOtherPartition()
|
|||
|
||||
void JobTest::moveSymlinkToOtherPartition()
|
||||
{
|
||||
#ifndef Q_WS_WIN
|
||||
kDebug() ;
|
||||
const QString filePath = homeTmpDir() + "testlink";
|
||||
const QString dest = otherTmpDir() + "testlink_moved";
|
||||
createTestSymlink( filePath );
|
||||
moveLocalSymlink( filePath, dest );
|
||||
#endif
|
||||
}
|
||||
|
||||
void JobTest::moveDirectoryToOtherPartition()
|
||||
{
|
||||
kDebug() ;
|
||||
#ifndef Q_WS_WIN
|
||||
const QString src = homeTmpDir() + "dirFromHome";
|
||||
const QString dest = otherTmpDir() + "dirFromHome_moved";
|
||||
createTestDirectory( src );
|
||||
moveLocalDirectory( src, dest );
|
||||
#endif
|
||||
}
|
||||
|
||||
void JobTest::moveFileNoPermissions()
|
||||
{
|
||||
kDebug() ;
|
||||
#ifdef Q_WS_WIN
|
||||
kDebug() << "port to win32";
|
||||
#else
|
||||
const QString src = "/etc/passwd";
|
||||
const QString dest = homeTmpDir() + "passwd";
|
||||
QVERIFY( QFile::exists( src ) );
|
||||
|
@ -541,15 +508,11 @@ void JobTest::moveFileNoPermissions()
|
|||
// destination file remains.
|
||||
//QVERIFY( QFile::exists( dest ) );
|
||||
QVERIFY( QFile::exists( src ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
void JobTest::moveDirectoryNoPermissions()
|
||||
{
|
||||
kDebug() ;
|
||||
#ifdef Q_WS_WIN
|
||||
kDebug() << "port to win32";
|
||||
#else
|
||||
|
||||
// All of /etc is a bit much, so try to find something smaller:
|
||||
QString src = "/etc/fonts";
|
||||
|
@ -572,7 +535,6 @@ void JobTest::moveDirectoryNoPermissions()
|
|||
QCOMPARE( KIO::NetAccess::lastError(), (int)KIO::ERR_ACCESS_DENIED );
|
||||
//QVERIFY( QFile::exists( dest ) ); // see moveFileNoPermissions
|
||||
QVERIFY( QFile::exists( src ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
void JobTest::listRecursive()
|
||||
|
@ -580,11 +542,9 @@ void JobTest::listRecursive()
|
|||
// Note: many other tests must have been run before since we rely on the files they created
|
||||
|
||||
const QString src = homeTmpDir();
|
||||
#ifndef Q_WS_WIN
|
||||
// Add a symlink to a dir, to make sure we don't recurse into those
|
||||
bool symlinkOk = symlink( "dirFromHome", QFile::encodeName( src + "/dirFromHome_link" ) ) == 0;
|
||||
QVERIFY( symlinkOk );
|
||||
#endif
|
||||
KIO::ListJob* job = KIO::listRecursive( KUrl(src), KIO::HideProgressInfo );
|
||||
job->setUiDelegate( 0 );
|
||||
connect( job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)),
|
||||
|
@ -594,18 +554,12 @@ void JobTest::listRecursive()
|
|||
m_names.sort();
|
||||
QByteArray ref_names = QByteArray( ".,..,"
|
||||
"dirFromHome,dirFromHome/testfile,"
|
||||
#ifndef Q_WS_WIN
|
||||
"dirFromHome/testlink,"
|
||||
#endif
|
||||
"dirFromHome_copied,"
|
||||
"dirFromHome_copied/dirFromHome,dirFromHome_copied/dirFromHome/testfile,"
|
||||
#ifndef Q_WS_WIN
|
||||
"dirFromHome_copied/dirFromHome/testlink,"
|
||||
#endif
|
||||
"dirFromHome_copied/testfile,"
|
||||
#ifndef Q_WS_WIN
|
||||
"dirFromHome_copied/testlink,dirFromHome_link,"
|
||||
#endif
|
||||
"fileFromHome,fileFromHome_copied");
|
||||
|
||||
const QString joinedNames = m_names.join( "," );
|
||||
|
@ -682,15 +636,9 @@ void JobTest::directorySize()
|
|||
kDebug() << "totalSize: " << job->totalSize();
|
||||
kDebug() << "totalFiles: " << job->totalFiles();
|
||||
kDebug() << "totalSubdirs: " << job->totalSubdirs();
|
||||
#ifdef Q_WS_WIN
|
||||
QCOMPARE(job->totalFiles(), 5ULL); // see expected result in listRecursive() above
|
||||
QCOMPARE(job->totalSubdirs(), 3ULL); // see expected result in listRecursive() above
|
||||
QVERIFY(job->totalSize() > 54);
|
||||
#else
|
||||
QCOMPARE(job->totalFiles(), 8ULL); // see expected result in listRecursive() above
|
||||
QCOMPARE(job->totalSubdirs(), 4ULL); // see expected result in listRecursive() above
|
||||
QVERIFY(job->totalSize() >= 325);
|
||||
#endif
|
||||
|
||||
qApp->sendPostedEvents(0, QEvent::DeferredDelete);
|
||||
}
|
||||
|
@ -1168,14 +1116,12 @@ void JobTest::deleteDirectory()
|
|||
// Let's put a few things in there to see if the recursive deletion works correctly
|
||||
// A hidden file:
|
||||
createTestFile(dest + "/.hidden");
|
||||
#ifndef Q_WS_WIN
|
||||
// A broken symlink:
|
||||
createTestSymlink(dest+"/broken_symlink");
|
||||
// A symlink to a dir:
|
||||
bool symlink_ok = symlink( KDESRCDIR, QFile::encodeName( dest + "/symlink_to_dir" ) ) == 0;
|
||||
if ( !symlink_ok )
|
||||
kFatal() << "couldn't create symlink: " << strerror( errno ) ;
|
||||
#endif
|
||||
|
||||
KIO::Job* job = KIO::del(KUrl(dest), KIO::HideProgressInfo);
|
||||
job->setUiDelegate(0);
|
||||
|
@ -1189,7 +1135,6 @@ void JobTest::deleteSymlink(bool using_fast_path)
|
|||
extern KIO_EXPORT bool kio_resolve_local_urls;
|
||||
kio_resolve_local_urls = !using_fast_path;
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
const QString src = homeTmpDir() + "dirFromHome";
|
||||
createTestDirectory(src);
|
||||
QVERIFY(QFile::exists(src));
|
||||
|
@ -1206,7 +1151,6 @@ void JobTest::deleteSymlink(bool using_fast_path)
|
|||
QVERIFY(ok);
|
||||
QVERIFY(!QFile::exists(dest));
|
||||
QVERIFY(QFile::exists(src));
|
||||
#endif
|
||||
|
||||
kio_resolve_local_urls = true;
|
||||
}
|
||||
|
@ -1214,10 +1158,8 @@ void JobTest::deleteSymlink(bool using_fast_path)
|
|||
|
||||
void JobTest::deleteSymlink()
|
||||
{
|
||||
#ifndef Q_WS_WIN
|
||||
deleteSymlink(true);
|
||||
deleteSymlink(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void JobTest::deleteManyDirs(bool using_fast_path)
|
||||
|
@ -1527,7 +1469,6 @@ void JobTest::moveAndOverwrite()
|
|||
QVERIFY(ok);
|
||||
QVERIFY(!QFile::exists(sourceFile)); // it was moved
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
// Now same thing when the target is a symlink to the source
|
||||
createTestFile( sourceFile );
|
||||
createTestSymlink( existingDest, QFile::encodeName(sourceFile) );
|
||||
|
@ -1558,12 +1499,10 @@ void JobTest::moveAndOverwrite()
|
|||
ok = KIO::NetAccess::synchronousRun(job, 0);
|
||||
QVERIFY(ok);
|
||||
QVERIFY(!QFile::exists(sourceFile)); // it was moved
|
||||
#endif
|
||||
}
|
||||
|
||||
void JobTest::moveOverSymlinkToSelf() // #169547
|
||||
{
|
||||
#ifndef Q_WS_WIN
|
||||
const QString sourceFile = homeTmpDir() + "fileFromHome";
|
||||
createTestFile( sourceFile );
|
||||
const QString existingDest = homeTmpDir() + "testlink";
|
||||
|
@ -1576,7 +1515,6 @@ void JobTest::moveOverSymlinkToSelf() // #169547
|
|||
QVERIFY(!ok);
|
||||
QCOMPARE(job->error(), (int)KIO::ERR_FILE_ALREADY_EXIST); // and not ERR_IDENTICAL_FILES!
|
||||
QVERIFY(QFile::exists(sourceFile)); // it not moved
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "jobtest.moc"
|
||||
|
|
|
@ -123,10 +123,6 @@ void KDirListerTest::test()
|
|||
{
|
||||
KUrl home( QDir::homePath() );
|
||||
KUrl root( QDir::rootPath() );
|
||||
#ifdef Q_WS_WIN
|
||||
lister->openUrl( home, KDirLister::Keep );
|
||||
lister->openUrl( root, KDirLister::Keep | KDirLister::Reload );
|
||||
#else
|
||||
/* lister->openUrl( home, KDirLister::Keep );
|
||||
lister->openUrl( root, KDirLister::Keep | KDirLister::Reload );
|
||||
lister->openUrl( KUrl("file:/etc"), KDirLister::Keep | KDirLister::Reload );
|
||||
|
@ -139,7 +135,6 @@ void KDirListerTest::test()
|
|||
lister->openUrl( KUrl("file:/usr/"), KDirLister::Keep | KDirLister::Reload );
|
||||
*/
|
||||
lister->openUrl( KUrl("file:/dev"), KDirLister::Keep | KDirLister::Reload );
|
||||
#endif
|
||||
}
|
||||
|
||||
void KDirListerTest::completed()
|
||||
|
|
|
@ -47,11 +47,7 @@ QTEST_KDEMAIN( KDirModelTest, NoGUI )
|
|||
|
||||
#define connect(a,b,c,d) QVERIFY(QObject::connect(a,b,c,d))
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
#define SPECIALCHARS "specialchars%:.pdf"
|
||||
#else
|
||||
#define SPECIALCHARS "specialchars%.pdf"
|
||||
#endif
|
||||
|
||||
Q_DECLARE_METATYPE(KFileItemList)
|
||||
|
||||
|
@ -700,13 +696,11 @@ void KDirModelTest::testExpandToUrl_data()
|
|||
QTest::newRow("subdir/subsubdir/testfile sync")
|
||||
<< int(NoFlag) << subsubdirfile << (QStringList()<<"subdir"<<subsubdir<<subsubdirfile);
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
// Expand a symlink to a directory (#219547)
|
||||
const QString dirlink = m_tempDir->name() + "dirlink";
|
||||
createTestSymlink(dirlink, "/");
|
||||
QTest::newRow("dirlink")
|
||||
<< int(NoFlag) << "dirlink/tmp" << (QStringList()<<"dirlink"<<"dirlink/tmp");
|
||||
#endif
|
||||
|
||||
// Do a cold-cache test too, but nowadays it doesn't change anything anymore,
|
||||
// apart from testing different code paths inside KDirLister.
|
||||
|
|
|
@ -93,13 +93,8 @@ static void createTestDirectory( const QString& path, CreateTestDirectoryOptions
|
|||
kFatal() << "couldn't create " << path;
|
||||
createTestFile( path + "/testfile" );
|
||||
if ( (opt & NoSymlink) == 0 ) {
|
||||
#ifndef Q_WS_WIN
|
||||
createTestSymlink( path + "/testlink" );
|
||||
QVERIFY( QFileInfo( path + "/testlink" ).isSymLink() );
|
||||
#else
|
||||
// to not change the filecount everywhere in the tests
|
||||
createTestFile( path + "/testlink" );
|
||||
#endif
|
||||
}
|
||||
setTimeStamp( path, s_referenceTimeStamp );
|
||||
}
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
#include <kio/netaccess.h>
|
||||
#include <kio/job.h>
|
||||
#include <QtCore/QFile>
|
||||
#ifdef Q_WS_WIN
|
||||
#include <QDir>
|
||||
#endif
|
||||
#include <kcmdlineargs.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
@ -32,11 +29,7 @@ int main(int argc, char **argv)
|
|||
KCmdLineArgs::init(argc,argv, "netaccesstest", 0, ki18n("netaccesstest"), 0);
|
||||
KApplication app;
|
||||
KUrl srcURL( "ftp://ftp.kde.org/pub/kde/README" );
|
||||
#ifdef Q_WS_WIN
|
||||
KUrl tmpURL( "file://" + QDir::tempPath() + "/netaccesstest_README" );
|
||||
#else
|
||||
KUrl tmpURL( "file:/tmp/netaccesstest_README" );
|
||||
#endif
|
||||
|
||||
for ( uint i = 0; i < 4 ; ++i ) {
|
||||
kDebug() << "file_copy";
|
||||
|
|
|
@ -61,10 +61,6 @@
|
|||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QFile>
|
||||
#ifdef Q_WS_WIN
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#endif
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kurl.h>
|
||||
|
|
|
@ -218,11 +218,7 @@ void KCookieServer::checkCookies(KHttpCookieList *cookieList, qlonglong windowId
|
|||
mCookieJar->preferredDefaultPolicy(),
|
||||
mCookieJar->showCookieDetails() );
|
||||
if (windowId > 0) {
|
||||
#ifndef Q_WS_WIN
|
||||
KWindowSystem::setMainWindow(kw, static_cast<WId>(windowId));
|
||||
#else
|
||||
KWindowSystem::setMainWindow(kw, (HWND)(long)windowId);
|
||||
#endif
|
||||
}
|
||||
|
||||
KCookieAdvice userAdvice = kw->advice(mCookieJar, currentCookie);
|
||||
|
|
|
@ -66,11 +66,7 @@ KCookieWin::KCookieWin( QWidget *parent, KHttpCookieList cookieList,
|
|||
// all cookies in the list should have the same window at this time, so let's take the first
|
||||
if( cookieList.first().windowIds().count() > 0 )
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
KWindowSystem::setMainWindow( this, reinterpret_cast<WId>( cookieList.first().windowIds().first() ) );
|
||||
#else
|
||||
KWindowSystem::setMainWindow( this, cookieList.first().windowIds().first());
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1406,20 +1406,7 @@ bool CoreEngine::install(const QString &payloadfile)
|
|||
pathcounter++;
|
||||
}
|
||||
if (!m_installation->installPath().isEmpty()) {
|
||||
#if defined(Q_WS_WIN)
|
||||
#ifndef _WIN32_WCE
|
||||
WCHAR wPath[MAX_PATH+1];
|
||||
if ( SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wPath) == S_OK) {
|
||||
installdir = QString::fromUtf16((const ushort *) wPath) + QLatin1Char('/') + m_installation->installPath() + QLatin1Char('/');
|
||||
} else {
|
||||
#endif
|
||||
installdir = QDir::home().path() + QLatin1Char('/') + m_installation->installPath() + QLatin1Char('/');
|
||||
#ifndef _WIN32_WCE
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
installdir = QDir::home().path() + '/' + m_installation->installPath() + '/';
|
||||
#endif
|
||||
pathcounter++;
|
||||
}
|
||||
if (!m_installation->absoluteInstallPath().isEmpty()) {
|
||||
|
|
|
@ -345,20 +345,7 @@ QString Installation::targetInstallationPath(const QString& payloadfile)
|
|||
pathcounter++;
|
||||
}
|
||||
if (!installPath.isEmpty()) {
|
||||
#if defined(Q_WS_WIN)
|
||||
#ifndef _WIN32_WCE
|
||||
WCHAR wPath[MAX_PATH+1];
|
||||
if ( SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wPath) == S_OK) {
|
||||
installdir = QString::fromUtf16((const ushort *) wPath) + QLatin1Char('/') + installpath + QLatin1Char('/');
|
||||
} else {
|
||||
#endif
|
||||
installdir = QDir::home().path() + QLatin1Char('/') + installPath + QLatin1Char('/');
|
||||
#ifndef _WIN32_WCE
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
installdir = QDir::home().path() + '/' + installPath + '/';
|
||||
#endif
|
||||
pathcounter++;
|
||||
}
|
||||
if (!absoluteInstallPath.isEmpty()) {
|
||||
|
|
|
@ -17,6 +17,3 @@ void _k__get_dummy_used()
|
|||
KIdleTime::instance();
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
__declspec(dllexport) int __dummy_function() { return 5; }
|
||||
#endif
|
||||
|
|
|
@ -120,11 +120,7 @@ void CheckBox::setImage(const QString &path)
|
|||
d->imagePath = path;
|
||||
|
||||
bool absolutePath = !path.isEmpty() &&
|
||||
#ifdef Q_WS_WIN
|
||||
!QDir::isRelativePath(path)
|
||||
#else
|
||||
(path[0] == '/' || path.startsWith(QLatin1String(":/")))
|
||||
#endif
|
||||
;
|
||||
|
||||
if (absolutePath) {
|
||||
|
|
|
@ -162,11 +162,7 @@ void Frame::setImage(const QString &path)
|
|||
d->pixmap = 0;
|
||||
|
||||
bool absolutePath = !path.isEmpty() &&
|
||||
#ifdef Q_WS_WIN
|
||||
!QDir::isRelativePath(path)
|
||||
#else
|
||||
(path[0] == '/' || path.startsWith(QLatin1String(":/")))
|
||||
#endif
|
||||
;
|
||||
|
||||
if (absolutePath) {
|
||||
|
|
|
@ -137,11 +137,7 @@ void Label::setImage(const QString &path)
|
|||
d->imagePath = path;
|
||||
|
||||
bool absolutePath = !path.isEmpty() &&
|
||||
#ifdef Q_WS_WIN
|
||||
!QDir::isRelativePath(path)
|
||||
#else
|
||||
(path[0] == '/' || path.startsWith(QLatin1String(":/")))
|
||||
#endif
|
||||
;
|
||||
|
||||
if (absolutePath) {
|
||||
|
|
|
@ -242,11 +242,7 @@ void PushButton::setImage(const QString &path)
|
|||
d->imagePath = path;
|
||||
|
||||
bool absolutePath = !path.isEmpty() &&
|
||||
#ifdef Q_WS_WIN
|
||||
!QDir::isRelativePath(path)
|
||||
#else
|
||||
(path[0] == '/' || path.startsWith(QLatin1String(":/")))
|
||||
#endif
|
||||
;
|
||||
|
||||
if (absolutePath) {
|
||||
|
|
|
@ -109,11 +109,7 @@ void RadioButton::setImage(const QString &path)
|
|||
d->imagePath = path;
|
||||
|
||||
bool absolutePath = !path.isEmpty() &&
|
||||
#ifdef Q_WS_WIN
|
||||
!QDir::isRelativePath(path)
|
||||
#else
|
||||
(path[0] == '/' || path.startsWith(QLatin1String(":/")))
|
||||
#endif
|
||||
;
|
||||
|
||||
if (absolutePath) {
|
||||
|
|
|
@ -240,11 +240,7 @@ void ToolButton::setImage(const QString &path)
|
|||
d->imagePath = path;
|
||||
|
||||
bool absolutePath = !path.isEmpty() &&
|
||||
#ifdef Q_WS_WIN
|
||||
!QDir::isRelativePath(path)
|
||||
#else
|
||||
(path[0] == '/' || path.startsWith(QLatin1String(":/")))
|
||||
#endif
|
||||
;
|
||||
|
||||
if (absolutePath) {
|
||||
|
|
|
@ -36,9 +36,7 @@
|
|||
extern "C"
|
||||
{
|
||||
#include <stdarg.h>
|
||||
#ifndef Q_WS_WIN
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
|
Loading…
Add table
Reference in a new issue