2007-01-26 00:55:49 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2006 by Peter Penz *
|
|
|
|
* peter.penz@gmx.at *
|
|
|
|
* *
|
|
|
|
* 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 *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2010-08-27 05:26:27 +00:00
|
|
|
#include "dolphinnewfilemenu.h"
|
2009-03-17 20:47:03 +00:00
|
|
|
|
2007-01-26 00:55:49 +00:00
|
|
|
#include "dolphinmainwindow.h"
|
2007-06-07 21:10:48 +00:00
|
|
|
#include "dolphinviewcontainer.h"
|
2009-08-01 20:01:51 +00:00
|
|
|
#include "statusbar/dolphinstatusbar.h"
|
2010-08-27 05:26:27 +00:00
|
|
|
#include "views/dolphinnewfilemenuobserver.h"
|
2010-07-24 21:45:49 +00:00
|
|
|
#include "views/dolphinview.h"
|
2007-01-26 00:55:49 +00:00
|
|
|
|
2011-02-04 14:43:21 +00:00
|
|
|
#include <KActionCollection>
|
|
|
|
#include <KIO/Job>
|
2007-01-26 00:55:49 +00:00
|
|
|
|
2011-02-09 20:15:55 +00:00
|
|
|
DolphinNewFileMenu::DolphinNewFileMenu(DolphinMainWindow* parent) :
|
|
|
|
KNewFileMenu(parent->actionCollection(), "create_new", parent),
|
|
|
|
m_mainWin(parent)
|
2007-05-06 17:41:49 +00:00
|
|
|
{
|
2010-08-27 05:26:27 +00:00
|
|
|
DolphinNewFileMenuObserver::instance().attach(this);
|
2007-05-06 17:41:49 +00:00
|
|
|
}
|
2007-01-26 00:55:49 +00:00
|
|
|
|
2010-08-27 05:26:27 +00:00
|
|
|
DolphinNewFileMenu::~DolphinNewFileMenu()
|
2007-05-06 17:41:49 +00:00
|
|
|
{
|
2010-08-27 05:26:27 +00:00
|
|
|
DolphinNewFileMenuObserver::instance().detach(this);
|
2007-05-06 17:41:49 +00:00
|
|
|
}
|
2007-01-26 00:55:49 +00:00
|
|
|
|
2010-08-27 05:26:27 +00:00
|
|
|
void DolphinNewFileMenu::slotResult(KJob* job)
|
2007-01-26 00:55:49 +00:00
|
|
|
{
|
|
|
|
if (job->error()) {
|
2007-06-07 21:10:48 +00:00
|
|
|
DolphinStatusBar* statusBar = m_mainWin->activeViewContainer()->statusBar();
|
2007-01-26 00:55:49 +00:00
|
|
|
statusBar->setMessage(job->errorString(), DolphinStatusBar::Error);
|
2007-04-09 19:12:54 +00:00
|
|
|
} else {
|
2010-01-26 12:04:56 +00:00
|
|
|
KNewFileMenu::slotResult(job);
|
2007-01-26 00:55:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-27 05:26:27 +00:00
|
|
|
#include "dolphinnewfilemenu.moc"
|