[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Patch for KRDC
From:       Sivert Berg <siveberg () online ! no>
Date:       2005-09-25 18:01:06
Message-ID: 200509252001.06826.siveberg () online ! no
[Download RAW message or body]

Hello,

I've made a patch for KRDC that make it function as a KPART. I sent a
mail to the guy mentioned in the readme, but he isn't a KDE developer
anymore, so I wondered if anyone in here could take a look at the patch and
maybe commit it? All that needs to be done is add the krdcpart.* files into
the krdc directory and change the Makefile.am in the same dir with this
Makefile.am. I was also told to volunteer as KRDC maintainer, so I 
guess I do :)

Cheers
Sivert Berg

["krdcpart.cpp" (text/x-c++src)]

/***************************************************************************
                           krdcpart.cpp  -  krdc kpart
                              -------------------
    begin                : Fri Sep 23 21:19:49 2005
    copyright            : (C) 2005 by Sivert Berg
    email                : siveberg@online.no
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/ 

#include "krdcpart.h"

#include <kinstance.h>
#include <klocale.h>
#include <kaboutdata.h>
#include <qsize.h>

#include <qlabel.h>

extern "C"
{
    /**
     * This function is the 'main' function of this part.  It takes
     * the form 'void *init_lib<library name>()  It always returns a
     * new factory object
     */
    void *init_libkrdc()
    {
        return new KrdcFactory;
    }
};

/**
 * We need one static instance of the factory for our C 'main'
 * function
 */
KInstance *KrdcFactory::s_instance = 0L;

KrdcFactory::KrdcFactory()
{
}

KrdcFactory::~KrdcFactory()
{
    if (s_instance)
    {
        delete s_instance->aboutData();
        delete s_instance;
    }

    s_instance = 0;
}

QObject *KrdcFactory::createObject(QObject *parent, const char *name, const char*,
                               const QStringList& )
{
    QObject *obj = new KrdcPart((QWidget*)parent, name);
    emit objectCreated(obj);
    return obj;
}

KInstance *KrdcFactory::instance()
{
    if ( !s_instance )
        s_instance = new KInstance( aboutData() );
    return s_instance;
}

KAboutData *KrdcFactory::aboutData()
{
  KAboutData *about = new KAboutData("KRDC", I18N_NOOP("KDE Remote Desktop \
Connection"), "3.4.2");  return about;
}

KrdcPart::KrdcPart(QWidget *parent, const char *name)
    : KParts::ReadOnlyPart(parent, name)
{
    setInstance(KrdcFactory::instance());

    par = parent;
}

KrdcPart::~KrdcPart()
{
    closeURL();
}

bool KrdcPart::openURL(const KURL &url)
{
  QPoint point(0,0);
  krdc = new KRDC(WINDOW_MODE_NORMAL, url.url(), QUALITY_MEDIUM, QString::null, \
QString::null, false);//, false, size, par);

  krdc->start();

  krdc->reparent(par, 0, point, true);
  krdc->resize(200, 200);
  setWidget(krdc);

  return true;
}

bool KrdcPart::openFile()
{
  return true;
}


["krdcpart.h" (text/x-c++hdr)]

/***************************************************************************
                           krdcpart.h  -  krdc kpart
                              -------------------
    begin                : Fri Sep 23 21:19:49 2005
    copyright            : (C) 2005 by Sivert Berg
    email                : siveberg@online.no
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/ 

#ifndef KRDC_PART_H
#define KRDC_PART_H

#include <klibloader.h>
#include <kparts/part.h>
#include "krdc.h"

class KAboutData;
class KInstance;
class QLabel;

class KrdcFactory : public KLibFactory
{
    Q_OBJECT
public:
    KrdcFactory();
    virtual ~KrdcFactory();

    virtual QObject* createObject(QObject* parent = 0, const char* name = 0,
                            const char* classname = "QObject",
                            const QStringList &args = QStringList());

    static KInstance *instance();
    static KAboutData *aboutData();

private:
    static KInstance *s_instance;
};

class KrdcPart: public KParts::ReadOnlyPart
{
    Q_OBJECT
public:
    KrdcPart(QWidget *parent, const char *name);
    virtual ~KrdcPart();

protected:
    virtual bool openURL(const KURL &url);
    virtual bool openFile();

private:
    KRDC *krdc;
    QWidget *par;
};

#endif

["Makefile.am" (text/x-makefile)]

KDE_CXXFLAGS = $(USE_THREADS)

SUBDIRS = vnc rdp

METASOURCES = AUTO

lib_LTLIBRARIES = libkrdc.la
bin_PROGRAMS = krdc
libkrdc_la_SOURCES = krdc.cpp vidmode.cpp kfullscreenpanel.cpp \
  hostprofiles.ui maindialogbase.ui keycapturewidget.ui kservicelocator.cpp \
  keycapturedialog.cpp kremoteview.cpp smartptr.cpp hostpreferences.cpp \
  preferencesdialog.cpp maindialogwidget.cpp maindialog.cpp krdcpart.cpp
krdc_SOURCES = main.cpp

noinst_HEADERS = main.h krdc.h vidmode.h kfullscreenpanel.h events.h \
  kservicelocator.h preferencesdialog.h \
  keycapturedialog.h kremoteview.h smartptr.h hostpreferences.h krdcpart.h

EXTRA_DIST = README TODO

appdatadir = $(kde_datadir)/krdc/pics
appdata_DATA =  pointcursor.png pointcursormask.png pinup.png pindown.png \
  iconify.png close.png

dnssddatadir = $(kde_datadir)/zeroconf
dnssddata_DATA = _rfb._tcp

libkrdc_la_LIBADD   = vnc/libvnc.la rdp/librdp.la $(LIB_KDEUI) $(LIBXF86VIDMODE) \
$(LIB_SLP) $(LIB_KDNSSD) $(X_LDFLAGS) $(LIB_X11)  -lkparts libkrdc_la_LDFLAGS = \
$(all_libraries) $(KDE_RPATH) -version-info 1:0:0 -module krdc_LDFLAGS = \
$(all_libraries) $(KDE_RPATH) krdc_LDADD = libkrdc.la

xdg_apps_DATA = krdc.desktop

servicedir = $(kde_datadir)/konqueror/servicemenus
service_DATA = smb2rdc.desktop

kde_services_DATA = vnc.protocol rdp.protocol

KDE_ICON = krdc

INCLUDES= $(all_includes)

messages: rc.cpp
	$(EXTRACTRC) *.ui */*.ui >> rc.cpp
	$(XGETTEXT) *.cpp */*.cpp *.h -o $(podir)/krdc.pot



 =

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscrib=
e <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic