[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdeexamples] kicons: Adding something for
From: Thorsten Staerk <thorsten () staerk ! de>
Date: 2011-09-18 14:11:21
Message-ID: 20110918141121.C3D7EA607A () git ! kde ! org
[Download RAW message or body]
Git commit 3e589796f91cf33a9c2c41905d52639aeebc932c by Thorsten Staerk.
Committed on 18/09/2011 at 16:20.
Pushed by tstaerk into branch 'master'.
Adding something for http://techbase.kde.org/Development/Tutorials
A +17 -0 kicons/CMakeLists.txt
A +20 -0 kicons/main.cpp [License: UNKNOWN] *
A +34 -0 kicons/mainwindow.cpp [License: UNKNOWN] *
A +17 -0 kicons/mainwindow.h [License: UNKNOWN] *
A +20 -0 kicons/tutorial3ui.rc
The files marked with a * at the end have a non valid license. Please read: \
http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are \
listed at that page.
http://commits.kde.org/kdeexamples/3e589796f91cf33a9c2c41905d52639aeebc932c
diff --git a/kicons/CMakeLists.txt b/kicons/CMakeLists.txt
new file mode 100644
index 0000000..fd520cc
--- /dev/null
+++ b/kicons/CMakeLists.txt
@@ -0,0 +1,17 @@
+project(tutorial3)
+
+find_package(KDE4 REQUIRED)
+include_directories(${KDE4_INCLUDES})
+
+set(tutorial3_SRCS
+ main.cpp
+ mainwindow.cpp
+)
+
+kde4_add_executable(tutorial3 ${tutorial3_SRCS})
+
+target_link_libraries(tutorial3 ${KDE4_KDEUI_LIBS})
+
+install(TARGETS tutorial3 DESTINATION ${BIN_INSTALL_DIR})
+install(FILES tutorial3ui.rc
+ DESTINATION ${DATA_INSTALL_DIR}/tutorial3)
diff --git a/kicons/main.cpp b/kicons/main.cpp
new file mode 100644
index 0000000..76bc3dd
--- /dev/null
+++ b/kicons/main.cpp
@@ -0,0 +1,20 @@
+#include <KApplication>
+#include <KAboutData>
+#include <KCmdLineArgs>
+
+#include "mainwindow.h"
+
+int main (int argc, char *argv[])
+{
+ KAboutData aboutData( "tutorial3", "tutorial3",
+ ki18n("Tutorial 3"), "1.0",
+ ki18n("A simple text area using KAction etc."),
+ KAboutData::License_GPL,
+ ki18n("Copyright (c) 2007 Developer") );
+ KCmdLineArgs::init( argc, argv, &aboutData );
+ KApplication app;
+
+ MainWindow* window = new MainWindow();
+ window->show();
+ return app.exec();
+}
diff --git a/kicons/mainwindow.cpp b/kicons/mainwindow.cpp
new file mode 100644
index 0000000..3477eef
--- /dev/null
+++ b/kicons/mainwindow.cpp
@@ -0,0 +1,34 @@
+#include "mainwindow.h"
+
+#include <KApplication>
+#include <KAction>
+#include <KLocale>
+#include <KActionCollection>
+#include <KStandardAction>
+
+MainWindow::MainWindow(QWidget *parent)
+ : KXmlGuiWindow(parent)
+{
+ textArea = new KTextEdit;
+ setCentralWidget(textArea);
+
+ setupActions();
+}
+
+void MainWindow::setupActions()
+{
+ KAction* clearAction = new KAction(this);
+ clearAction->setText(i18n("&Clear"));
+ clearAction->setIcon(KIcon("document-new"));
+ clearAction->setShortcut(Qt::CTRL + Qt::Key_W);
+ actionCollection()->addAction("clear", clearAction);
+ connect(clearAction, SIGNAL(triggered(bool)),
+ textArea, SLOT(clear()));
+
+ KStandardAction::quit(kapp, SLOT(quit()),
+ actionCollection());
+
+ setupGUI(Default, "tutorial3ui.rc");
+}
+
+
diff --git a/kicons/mainwindow.h b/kicons/mainwindow.h
new file mode 100644
index 0000000..d787505
--- /dev/null
+++ b/kicons/mainwindow.h
@@ -0,0 +1,17 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <KXmlGuiWindow>
+#include <KTextEdit>
+
+class MainWindow : public KXmlGuiWindow
+{
+ public:
+ MainWindow(QWidget *parent=0);
+
+ private:
+ KTextEdit* textArea;
+ void setupActions();
+};
+
+#endif
diff --git a/kicons/tutorial3ui.rc b/kicons/tutorial3ui.rc
new file mode 100644
index 0000000..94d5f07
--- /dev/null
+++ b/kicons/tutorial3ui.rc
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gui name="tutorial3"
+ version="1"
+ xmlns="http://www.kde.org/standards/kxmlgui/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kxmlgui/1.0
+ http://www.kde.org/standards/kxmlgui/1.0/kxmlgui.xsd" >
+
+ <MenuBar>
+ <Menu name="file" >
+ <Action name="clear" />
+ </Menu>
+ </MenuBar>
+
+ <ToolBar name="mainToolBar" >
+ <text>Main Toolbar</text>
+ <Action name="clear" />
+ </ToolBar>
+
+</gui>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic