1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz19@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #include "dolphinnewfilemenuobserver.h"
23 #include "dolphinnewfilemenu.h"
25 class DolphinNewFileMenuObserverSingleton
28 DolphinNewFileMenuObserver instance
;
30 K_GLOBAL_STATIC(DolphinNewFileMenuObserverSingleton
, s_DolphinNewFileMenuObserver
)
32 DolphinNewFileMenuObserver
& DolphinNewFileMenuObserver::instance()
34 return s_DolphinNewFileMenuObserver
->instance
;
37 void DolphinNewFileMenuObserver::attach(const DolphinNewFileMenu
* menu
)
39 connect(menu
, &DolphinNewFileMenu::fileCreated
,
40 this, &DolphinNewFileMenuObserver::itemCreated
);
41 connect(menu
, &DolphinNewFileMenu::directoryCreated
,
42 this, &DolphinNewFileMenuObserver::itemCreated
);
43 connect(menu
, &DolphinNewFileMenu::errorMessage
,
44 this, &DolphinNewFileMenuObserver::errorMessage
);
47 void DolphinNewFileMenuObserver::detach(const DolphinNewFileMenu
* menu
)
49 disconnect(menu
, &DolphinNewFileMenu::fileCreated
,
50 this, &DolphinNewFileMenuObserver::itemCreated
);
51 disconnect(menu
, &DolphinNewFileMenu::directoryCreated
,
52 this, &DolphinNewFileMenuObserver::itemCreated
);
53 disconnect(menu
, &DolphinNewFileMenu::errorMessage
,
54 this, &DolphinNewFileMenuObserver::errorMessage
);
57 DolphinNewFileMenuObserver::DolphinNewFileMenuObserver() :
62 DolphinNewFileMenuObserver::~DolphinNewFileMenuObserver()