OSDN Git Service

use cached variable for the pkg-config installation path
[kde/libdbusmenu-qt.git] / tests / slowmenu.cpp
1 /* This file is part of the dbusmenu-qt library
2    Copyright 2010 Canonical
3    Author: Aurelien Gateau <aurelien.gateau@canonical.com>
4
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Library General Public
7    License (LGPL) as published by the Free Software Foundation;
8    either version 2 of the License, or (at your option) any later
9    version.
10
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Library General Public License for more details.
15
16    You should have received a copy of the GNU Library General Public License
17    along with this library; see the file COPYING.LIB.  If not, write to
18    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19    Boston, MA 02110-1301, USA.
20 */
21
22 // Qt
23 #include <QtDBus>
24 #include <QtGui>
25 #include <QApplication>
26
27 // Local
28 #include "dbusmenuexporter.h"
29 #include "slowmenu.h"
30
31 static const char *TEST_SERVICE = "org.kde.dbusmenu-qt-test";
32 static const char *TEST_OBJECT_PATH = "/TestMenuBar";
33
34 SlowMenu::SlowMenu()
35 : QMenu()
36 {
37     connect(this, SIGNAL(aboutToShow()), SLOT(slotAboutToShow()));
38 }
39
40 void SlowMenu::slotAboutToShow()
41 {
42     qDebug() << __FUNCTION__ << "Entering";
43     QTime time;
44     time.start();
45     while (time.elapsed() < 2000) {
46         qApp->processEvents();
47     }
48     qDebug() << __FUNCTION__ << "Leaving";
49 }
50
51 int main(int argc, char** argv)
52 {
53     QApplication app(argc, argv);
54     QDBusConnection::sessionBus().registerService(TEST_SERVICE);
55     SlowMenu* inputMenu = new SlowMenu;
56     inputMenu->addAction("Test");
57     DBusMenuExporter exporter(TEST_OBJECT_PATH, inputMenu);
58     qDebug() << "Looping";
59     return app.exec();
60 }
61
62 #include "moc_slowmenu.cpp"