mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
generic: remove win leftovers
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
0d85ac3d6b
commit
13c358bbd5
11 changed files with 37 additions and 289 deletions
|
@ -25,6 +25,7 @@
|
|||
#include "fileTree.h"
|
||||
#include "scan.h"
|
||||
|
||||
#include <kde_file.h>
|
||||
#include <KDebug>
|
||||
#include <Solid/StorageVolume>
|
||||
#include <Solid/StorageAccess>
|
||||
|
@ -34,20 +35,25 @@
|
|||
#include <QtCore/QFile>
|
||||
#include <QtCore/QByteArray>
|
||||
|
||||
#include <kde_file.h>
|
||||
#ifdef Q_OS_SOLARIS
|
||||
#include <sys/vfstab.h>
|
||||
#elif !defined(Q_WS_WIN)
|
||||
#include <fstab.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef Q_OS_SOLARIS
|
||||
#include <sys/vfstab.h>
|
||||
#else
|
||||
#include <fstab.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MNTENT_H
|
||||
#include <mntent.h>
|
||||
#endif
|
||||
|
||||
#ifndef S_BLKSIZE
|
||||
#define S_BLKSIZE 512
|
||||
#endif
|
||||
|
||||
namespace Filelight
|
||||
{
|
||||
QStringList LocalLister::s_remoteMounts;
|
||||
|
@ -95,12 +101,6 @@ LocalLister::run()
|
|||
kDebug() << "Thread terminating ...";
|
||||
}
|
||||
|
||||
#ifndef S_BLKSIZE
|
||||
#define S_BLKSIZE 512
|
||||
#endif
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
static void
|
||||
outputError(QByteArray path)
|
||||
{
|
||||
|
@ -125,10 +125,8 @@ outputError(QByteArray path)
|
|||
out("Bad file descriptor");
|
||||
case EFAULT:
|
||||
out("Bad address");
|
||||
#ifndef Q_WS_WIN
|
||||
case ELOOP: //NOTE shouldn't ever happen
|
||||
out("Too many symbolic links encountered while traversing the path");
|
||||
#endif
|
||||
case ENAMETOOLONG:
|
||||
out("File name too long");
|
||||
}
|
||||
|
@ -176,11 +174,7 @@ LocalLister::scan(const QByteArray &path, const QByteArray &dirname)
|
|||
}
|
||||
|
||||
if (S_ISREG(statbuf.st_mode)) //file
|
||||
#ifndef Q_WS_WIN
|
||||
cwd->append(ent->d_name, (statbuf.st_blocks * S_BLKSIZE));
|
||||
#else
|
||||
cwd->append(ent->d_name, statbuf.st_size);
|
||||
#endif
|
||||
|
||||
else if (S_ISDIR(statbuf.st_mode)) //folder
|
||||
{
|
||||
|
|
|
@ -64,9 +64,6 @@ public:
|
|||
// and don't call the inherited one, use this (but NOT when newInstance()
|
||||
// is called for the first time, like here).
|
||||
KStartupInfo::setNewStartupId(kget, startupId());
|
||||
#endif
|
||||
#ifdef Q_WS_WIN
|
||||
KWindowSystem::forceActiveWindow(kget->winId());
|
||||
#endif
|
||||
//END
|
||||
|
||||
|
|
|
@ -348,12 +348,7 @@ QString GPGProc::getGpgHome(const QString &binary)
|
|||
|
||||
// Third try: guess what it is.
|
||||
if (gpgHome.isEmpty()) {
|
||||
#ifdef Q_OS_WIN32 //krazy:exclude=cpp
|
||||
gpgHome = qgetenv("APPDATA") + QLatin1String( "/gnupg/" );
|
||||
gpgHome.replace(QLatin1Char( '\\' ), QLatin1Char( '/' ));
|
||||
#else
|
||||
gpgHome = QDir::homePath() + QLatin1String( "/.gnupg/" );
|
||||
#endif
|
||||
}
|
||||
|
||||
gpgHome.replace(QLatin1String( "//" ), QLatin1String( "/" ));
|
||||
|
|
|
@ -34,11 +34,7 @@ KLineBufferedProcessPrivate::KLineBufferedProcessPrivate(KLineBufferedProcess *p
|
|||
: m_newlineInStdout(-1),
|
||||
m_newlineInStderr(-1),
|
||||
m_parent(parent),
|
||||
#ifdef Q_OS_WIN32 //krazy:exclude=cpp
|
||||
m_lineEnd("\r\n")
|
||||
#else
|
||||
m_lineEnd("\n")
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ KSnapshot::KSnapshot(QWidget *parent, KSnapshotObject::CaptureMode mode )
|
|||
XChangeProperty(dpy, winId(), atom, XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *) &d, 1);
|
||||
}
|
||||
#elif !defined(Q_WS_WIN)
|
||||
#else
|
||||
mainWidget->cbIncludePointer->hide();
|
||||
mainWidget->lblIncludePointer->hide();
|
||||
#endif
|
||||
|
|
|
@ -42,12 +42,6 @@
|
|||
#include <QX11Info>
|
||||
#endif // Q_WS_X11
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <windows.h>
|
||||
|
||||
static UINT cxWindowBorder, cyWindowBorder;
|
||||
#endif // Q_WS_WIN
|
||||
|
||||
static
|
||||
const int minSize = 8;
|
||||
|
||||
|
@ -101,59 +95,7 @@ void getWindowsRecursive( std::vector<QRect> *windows, Window w,
|
|||
std::sort( windows->begin(), windows->end() );
|
||||
}
|
||||
}
|
||||
#elif defined(Q_WS_WIN)
|
||||
static
|
||||
bool maybeAddWindow(HWND hwnd, std::vector<QRect> *windows) {
|
||||
WINDOWINFO wi;
|
||||
GetWindowInfo( hwnd, &wi );
|
||||
RECT rect = wi.rcClient;
|
||||
|
||||
#if 0
|
||||
RECT rect;
|
||||
GetWindowRect( hwnd, &rect );
|
||||
#endif
|
||||
|
||||
int width = rect.right - rect.left;
|
||||
int height = rect.bottom - rect.top;
|
||||
|
||||
// For some reason, rect.left and rect.top are shifted by cxWindowBorders and cyWindowBorders pixels respectively
|
||||
// in *every* case (for every window), but cxWindowBorders and cyWindowBorders are non-zero only in the
|
||||
// biggest-window case, therefore we need to save the biggest cxWindowBorders and cyWindowBorders to adjust the rect later
|
||||
cxWindowBorder = qMax(cxWindowBorder, wi.cxWindowBorders);
|
||||
cyWindowBorder = qMax(cyWindowBorder, wi.cyWindowBorders);
|
||||
|
||||
if ( ( ( wi.dwStyle & WS_VISIBLE ) != 0 ) && (width >= minSize ) && (height >= minSize ) )
|
||||
{
|
||||
//QRect r( rect.left + 4, rect.top + 4, width, height); // 4 = max(wi.cxWindowBorders) = max(wi.cyWindowBorders)
|
||||
QRect r(rect.left + cxWindowBorder, rect.top + cyWindowBorder, width, height);
|
||||
if ( std::find( windows->begin(), windows->end(), r ) == windows->end() ) {
|
||||
windows->push_back( r );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static
|
||||
BOOL CALLBACK getWindowsRecursiveHelper( HWND hwnd, LPARAM lParam ) {
|
||||
maybeAddWindow(hwnd, reinterpret_cast< std::vector<QRect>* >(lParam) );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static
|
||||
void getWindowsRecursive( std::vector<QRect> *windows, HWND hwnd,
|
||||
int rx = 0, int ry = 0, int depth = 0 )
|
||||
{
|
||||
|
||||
maybeAddWindow(hwnd, windows);
|
||||
|
||||
EnumChildWindows( hwnd, getWindowsRecursiveHelper, (LPARAM) windows );
|
||||
|
||||
std::sort( windows->begin(), windows->end() );
|
||||
}
|
||||
#endif // Q_WS_X11
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
static
|
||||
Window findRealWindow( Window w, int depth = 0 )
|
||||
{
|
||||
|
@ -197,16 +139,7 @@ Window findRealWindow( Window w, int depth = 0 )
|
|||
|
||||
return ret;
|
||||
}
|
||||
#elif defined(Q_WS_WIN)
|
||||
static
|
||||
HWND findRealWindow( HWND w, int depth = 0 )
|
||||
{
|
||||
// TODO Implement
|
||||
return w; // This is WRONG but makes code compile for now
|
||||
}
|
||||
#endif // Q_WS_X11
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
static
|
||||
Window windowUnderCursor( bool includeDecorations = true )
|
||||
{
|
||||
|
@ -233,27 +166,7 @@ Window windowUnderCursor( bool includeDecorations = true )
|
|||
|
||||
return child;
|
||||
}
|
||||
#elif defined(Q_WS_WIN)
|
||||
static
|
||||
HWND windowUnderCursor(bool includeDecorations = true)
|
||||
{
|
||||
POINT pointCursor;
|
||||
QPoint qpointCursor = QCursor::pos();
|
||||
pointCursor.x = qpointCursor.x();
|
||||
pointCursor.y = qpointCursor.y();
|
||||
HWND windowUnderCursor = WindowFromPoint(pointCursor);
|
||||
|
||||
if( includeDecorations ) {
|
||||
LONG_PTR style = GetWindowLongPtr( windowUnderCursor, GWL_STYLE );
|
||||
if( ( style & WS_CHILD ) != 0 ) {
|
||||
windowUnderCursor = GetAncestor( windowUnderCursor, GA_ROOT );
|
||||
}
|
||||
}
|
||||
return windowUnderCursor;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
static
|
||||
QPixmap grabWindow( Window child, int x, int y, uint w, uint h, uint border,
|
||||
QString *title=0, QString *windowClass=0 )
|
||||
|
@ -320,35 +233,6 @@ QPixmap grabWindow( Window child, int x, int y, uint w, uint h, uint border,
|
|||
|
||||
return pm;
|
||||
}
|
||||
#elif defined(Q_WS_WIN)
|
||||
static
|
||||
QPixmap grabWindow( HWND hWnd, QString *title=0, QString *windowClass=0 )
|
||||
{
|
||||
RECT windowRect;
|
||||
GetWindowRect(hWnd, &windowRect);
|
||||
int w = windowRect.right - windowRect.left;
|
||||
int h = windowRect.bottom - windowRect.top;
|
||||
HDC targetDC = GetWindowDC(hWnd);
|
||||
HDC hDC = CreateCompatibleDC(targetDC);
|
||||
HBITMAP tempPict = CreateCompatibleBitmap(targetDC, w, h);
|
||||
HGDIOBJ oldPict = SelectObject(hDC, tempPict);
|
||||
BitBlt(hDC, 0, 0, w, h, targetDC, 0, 0, SRCCOPY);
|
||||
tempPict = (HBITMAP) SelectObject(hDC, oldPict);
|
||||
QPixmap pm = QPixmap::fromWinHBITMAP(tempPict);
|
||||
|
||||
DeleteDC(hDC);
|
||||
ReleaseDC(hWnd, targetDC);
|
||||
|
||||
KWindowInfo winInfo( findRealWindow(hWnd), NET::WMVisibleName, NET::WM2WindowClass );
|
||||
if ( title ) {
|
||||
(*title) = winInfo.visibleName();
|
||||
}
|
||||
|
||||
if ( windowClass ) {
|
||||
(*windowClass) = winInfo.windowClassName();
|
||||
}
|
||||
return pm;
|
||||
}
|
||||
#endif // Q_WS_X11
|
||||
|
||||
QString WindowGrabber::title;
|
||||
|
@ -372,24 +256,6 @@ WindowGrabber::WindowGrabber()
|
|||
XUngrabServer( QX11Info::display() );
|
||||
|
||||
QPixmap pm( grabWindow( child, x, y, w, h, border, &title, &windowClass ) );
|
||||
#elif defined(Q_WS_WIN)
|
||||
HWND child = windowUnderCursor();
|
||||
|
||||
WINDOWINFO wi;
|
||||
GetWindowInfo( child, &wi);
|
||||
|
||||
RECT r;
|
||||
GetWindowRect( child, &r);
|
||||
x = r.left;
|
||||
y = r.top;
|
||||
w = r.right - r.left;
|
||||
h = r.bottom - r.top;
|
||||
cxWindowBorder = wi.cxWindowBorders;
|
||||
cyWindowBorder = wi.cyWindowBorders;
|
||||
|
||||
HDC childDC = GetDC(child);
|
||||
|
||||
QPixmap pm( grabWindow( child, &title, &windowClass ) );
|
||||
#endif // Q_WS_X11
|
||||
|
||||
getWindowsRecursive( &windows, child );
|
||||
|
@ -442,28 +308,6 @@ QPixmap WindowGrabber::grabCurrent( bool includeDecorations )
|
|||
QPixmap pm( grabWindow( child, x, y, w, h, border, &title, &windowClass ) );
|
||||
XUngrabServer( QX11Info::display() );
|
||||
return pm;
|
||||
#elif defined(Q_WS_WIN)
|
||||
HWND hWindow;
|
||||
hWindow = windowUnderCursor(includeDecorations);
|
||||
Q_ASSERT(hWindow);
|
||||
|
||||
HWND hParent;
|
||||
|
||||
// Now find the top-most window
|
||||
do {
|
||||
hParent = hWindow;
|
||||
} while( (hWindow = GetParent(hWindow)) != NULL );
|
||||
Q_ASSERT(hParent);
|
||||
|
||||
RECT r;
|
||||
GetWindowRect(hParent, &r);
|
||||
|
||||
x = r.left;
|
||||
y = r.top;
|
||||
|
||||
windowPosition = QPoint(x,y);
|
||||
QPixmap pm( grabWindow( hParent, &title, &windowClass) );
|
||||
return pm;
|
||||
#endif // Q_WS_X11
|
||||
return QPixmap();
|
||||
}
|
||||
|
|
|
@ -1,29 +1,28 @@
|
|||
|
||||
IF (WIN32)
|
||||
install( FILES
|
||||
#find-gui-text.sh TODO
|
||||
newprojectwizard_win.rc
|
||||
newprojectwizard_win.py
|
||||
newprojectwizard.py
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/lokalize/scripts )
|
||||
ELSE (WIN32)
|
||||
install( FILES
|
||||
install(
|
||||
FILES
|
||||
newprojectwizard.rc
|
||||
newprojectwizard.py
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/lokalize/scripts )
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/lokalize/scripts
|
||||
)
|
||||
|
||||
install( PROGRAMS find-gui-text.sh
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/lokalize/scripts )
|
||||
install(
|
||||
PROGRAMS find-gui-text.sh
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/lokalize/scripts
|
||||
)
|
||||
|
||||
ENDIF (WIN32)
|
||||
|
||||
install( FILES
|
||||
install(
|
||||
FILES
|
||||
msgmerge.py
|
||||
msgmerge.rc
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/lokalize/scripts )
|
||||
install( FILES
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/lokalize/scripts
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
xliff2odf.py
|
||||
xliff2odf.rc
|
||||
xliff2odf-standalone.py
|
||||
xliffmerge.py
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/lokalize/scripts/odf )
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/lokalize/scripts/odf
|
||||
)
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import Kross
|
||||
import Lokalize
|
||||
import Project
|
||||
import sys,os
|
||||
import codecs
|
||||
|
||||
def run_standalone():
|
||||
import subprocess
|
||||
|
||||
ourPath=([p for p in sys.path if os.path.exists(p+'/newprojectwizard_win.py')]+[''])[0]
|
||||
os.system(ourPath+'/newprojectwizard.py')
|
||||
|
||||
try:file=open(ourPath+'/projectconf.tmp','r')
|
||||
except: return
|
||||
projectFile=file.readline()[:-1]
|
||||
projectKind=file.readline()[:-1]
|
||||
projectName=file.readline()[:-1]
|
||||
projectSourceLang=file.readline()[:-1]
|
||||
projectTargetlang=file.readline()[:-1]
|
||||
file.close()
|
||||
os.remove(ourPath+'/projectconf.tmp')
|
||||
|
||||
Project.init(projectFile, projectKind, projectName, projectSourceLang, projectTargetlang)
|
||||
Lokalize.openProject(projectFile)
|
||||
|
||||
|
||||
run_standalone()
|
||||
|
||||
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<!DOCTYPE KrossScripting SYSTEM "kpartgui.dtd">
|
||||
<KrossScripting>
|
||||
<collection name="project" text="Project">
|
||||
<script text="Create new project" comment="Fires up a wizard to guide you through project creation"
|
||||
name="newprojectwizard"
|
||||
interpreter="python"
|
||||
enabled="true"
|
||||
file="newprojectwizard_win.py" />
|
||||
</collection>
|
||||
</KrossScripting>
|
|
@ -342,11 +342,7 @@ PDFGenerator::PDFGenerator( QObject *parent, const QVariantList &args )
|
|||
setFeature( Threaded );
|
||||
setFeature( TextExtraction );
|
||||
setFeature( FontInfo );
|
||||
#ifdef Q_OS_WIN32
|
||||
setFeature( PrintNative );
|
||||
#else
|
||||
setFeature( PrintPostscript );
|
||||
#endif
|
||||
if ( Okular::FilePrinter::ps2pdfAvailable() )
|
||||
setFeature( PrintToFile );
|
||||
setFeature( ReadRawData );
|
||||
|
@ -919,33 +915,6 @@ void PDFGenerator::requestFontData(const Okular::FontInfo &font, QByteArray *dat
|
|||
#define DUMMY_QPRINTER_COPY
|
||||
bool PDFGenerator::print( QPrinter& printer )
|
||||
{
|
||||
#ifdef Q_WS_WIN
|
||||
QPainter painter;
|
||||
painter.begin(&printer);
|
||||
|
||||
QList<int> pageList = Okular::FilePrinter::pageList( printer, pdfdoc->numPages(),
|
||||
document()->currentPage() + 1,
|
||||
document()->bookmarkedPageList() );
|
||||
for ( int i = 0; i < pageList.count(); ++i )
|
||||
{
|
||||
if ( i != 0 )
|
||||
printer.newPage();
|
||||
|
||||
const int page = pageList.at( i ) - 1;
|
||||
userMutex()->lock();
|
||||
Poppler::Page *pp = pdfdoc->page( page );
|
||||
if (pp)
|
||||
{
|
||||
QImage img = pp->renderToImage( printer.physicalDpiX(), printer.physicalDpiY() );
|
||||
painter.drawImage( painter.window(), img, QRectF(0, 0, img.width(), img.height()) );
|
||||
delete pp;
|
||||
}
|
||||
userMutex()->unlock();
|
||||
}
|
||||
painter.end();
|
||||
return true;
|
||||
|
||||
#else
|
||||
#ifdef DUMMY_QPRINTER_COPY
|
||||
// Get the real page size to pass to the ps generator
|
||||
QPrinter dummy( QPrinter::PrinterResolution );
|
||||
|
@ -1043,7 +1012,6 @@ bool PDFGenerator::print( QPrinter& printer )
|
|||
tf.close();
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
QVariant PDFGenerator::metaData( const QString & key, const QVariant & option ) const
|
||||
|
|
|
@ -2629,11 +2629,7 @@ void Part::slotPrint()
|
|||
{
|
||||
if (m_document->pages() == 0) return;
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
QPrinter printer(QPrinter::HighResolution);
|
||||
#else
|
||||
QPrinter printer;
|
||||
#endif
|
||||
QPrintDialog *printDialog = 0;
|
||||
QWidget *printConfigWidget = 0;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue