--- /dev/null
+/*******************************************************************************
+
+ This file is part of mDictionary.
+
+ mDictionary 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 3 of the License, or
+ (at your option) any later version.
+
+ mDictionary is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
+
+ Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#include "MainWidget.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <QtGui/QX11Info>
+
+MainWidget::MainWidget(QWidget *parent) :
+ QWidget(parent)
+{
+ QCoreApplication::instance()->setApplicationName(
+ "mDictionary desktop widget");
+
+ // Get required atoms
+ Atom winTypeAtom = XInternAtom(
+ QX11Info::display(), "_NET_WM_WINDOW_TYPE", false);
+
+ Atom homeAppletAto = XInternAtom(
+ QX11Info::display(), "_HILDON_WM_WINDOW_TYPE_HOME_APPLET", false);
+
+ Atom appletIDAtom = XInternAtom(
+ QX11Info::display(), "_HILDON_APPLET_ID", false);
+
+ Atom utf8Atom = XInternAtom(
+ QX11Info::display(), "UTF8_STRING", false);
+
+ Atom appletSettingAtom = XInternAtom(
+ QX11Info::display(), "_HILDON_APPLET_SETTINGS", false);
+
+
+ // Set correct window type
+ XChangeProperty(QX11Info::display(), winId(), winTypeAtom, XA_ATOM, 32,
+ PropModeReplace, (unsigned char *) &homeAppletAto, 1);
+
+
+
+ // Use application name to fill AppletID
+ QByteArray id (QCoreApplication::instance()->applicationName().remove(' ').toUtf8());
+
+ XChangeProperty(QX11Info::display(), winId(), appletIDAtom, utf8Atom, 8,
+ PropModeReplace, (unsigned char *)id.constData(),
+ id.length());
+
+
+ layout = new QVBoxLayout;
+ setLayout(layout);
+
+ searchStringLineEdit = new QLineEdit;
+ searchButton = new QPushButton(tr("Search"));
+
+ layout->addWidget(searchStringLineEdit);
+ layout->addWidget(searchButton);
+}