1 /***************************************************************************
2 * This file is part of KWorship. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * KWorship is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * KWorship is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with KWorship. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
21 * @file UpKpr2Slide.cpp
22 * @brief KPresenter 2 presentation slide.
23 * @author James Hogan <james@albanarts.com>
26 #include "UpKpr2Slide.h"
27 #include "UpKpr2Presentation.h"
31 #include <QTemporaryFile>
33 #include <QTextDocument>
36 * Constructors + destructor
39 /// Primary constructor.
40 UpKpr2Slide::UpKpr2Slide(UpKpr2Presentation
* presentation
, int index
)
41 : UpSlide(presentation
)
42 , m_presentation(presentation
)
52 UpKpr2Slide::~UpKpr2Slide()
60 QString
UpKpr2Slide::title()
64 QDBusInterface
* view
= m_presentation
->dbusView();
67 m_title
= (QDBusReply
<QString
>)view
->call("pageName", m_index
);
70 if (m_title
.isEmpty())
72 return i18n("Page %1", m_index
+ 1);
80 QString
UpKpr2Slide::outline()
85 bool UpKpr2Slide::writeNotes(QTextDocument
* doc
)
87 if (m_notesHtml
.isNull())
89 QDBusInterface
* view
= m_presentation
->dbusView();
92 m_notesHtml
= (QDBusReply
<QString
>)view
->call("pageNotes", m_index
, "html");
96 return UpSlide::writeNotes(doc
);
99 doc
->setHtml(m_notesHtml
);
103 QPixmap
UpKpr2Slide::preview()
105 if (m_preview
.isNull())
107 QDBusInterface
* view
= m_presentation
->dbusView();
110 QTemporaryFile previewFile
;
113 QDBusMessage result
= view
->call(
114 "exportPageThumbnail",
117 previewFile
.fileName(), // filename
121 if (QDBusMessage::ReplyMessage
== result
.type())
123 if (result
.arguments().first().toBool())
125 m_preview
.load(previewFile
.fileName());
133 #include "UpKpr2Slide.moc"