┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinnewmenuobserver.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-07-24 22:08:30 +0000
committerPeter Penz <[email protected]>2010-07-24 22:08:30 +0000
commita5cf21ff06aff44cde563eaceae3c6cef452ee48 (patch)
tree3d23179b483e4c9ad5598b128c3063885fe33a30 /src/views/dolphinnewmenuobserver.cpp
parent652d08c9242ed51d86dba3b2afda9d3b2e9a9cd7 (diff)
Sourcecode hierarchy cleanup: Move further files from src to src/views
svn path=/trunk/KDE/kdebase/apps/; revision=1154150
Diffstat (limited to 'src/views/dolphinnewmenuobserver.cpp')
-rw-r--r--src/views/dolphinnewmenuobserver.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/views/dolphinnewmenuobserver.cpp b/src/views/dolphinnewmenuobserver.cpp
new file mode 100644
index 000000000..def510c53
--- /dev/null
+++ b/src/views/dolphinnewmenuobserver.cpp
@@ -0,0 +1,62 @@
+/***************************************************************************
+ * Copyright (C) 2009 by Peter Penz <[email protected]> *
+ * *
+ * 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. *
+ * *
+ * This program 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 this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include "dolphinnewmenuobserver.h"
+
+#include <kglobal.h>
+#include <knewmenu.h>
+
+class DolphinNewMenuObserverSingleton
+{
+public:
+ DolphinNewMenuObserver instance;
+};
+K_GLOBAL_STATIC(DolphinNewMenuObserverSingleton, s_dolphinNewMenuObserver)
+
+DolphinNewMenuObserver& DolphinNewMenuObserver::instance()
+{
+ return s_dolphinNewMenuObserver->instance;
+}
+
+void DolphinNewMenuObserver::attach(const KNewFileMenu* menu)
+{
+ connect(menu, SIGNAL(fileCreated(const KUrl&)),
+ this, SIGNAL(itemCreated(const KUrl&)));
+ connect(menu, SIGNAL(directoryCreated(const KUrl&)),
+ this, SIGNAL(itemCreated(const KUrl&)));
+}
+
+void DolphinNewMenuObserver::detach(const KNewFileMenu* menu)
+{
+ disconnect(menu, SIGNAL(fileCreated(const KUrl&)),
+ this, SIGNAL(itemCreated(const KUrl&)));
+ disconnect(menu, SIGNAL(directoryCreated(const KUrl&)),
+ this, SIGNAL(itemCreated(const KUrl&)));
+}
+
+DolphinNewMenuObserver::DolphinNewMenuObserver() :
+ QObject(0)
+{
+}
+
+DolphinNewMenuObserver::~DolphinNewMenuObserver()
+{
+}
+
+#include "dolphinnewmenuobserver.moc"