]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/terminalsidebarpage.cpp
there's no need having 2-liners inside their own method when this method is only...
[dolphin.git] / src / terminalsidebarpage.cpp
index ec3f1cd79aebf8e4c31e228d2dadea6764015d4a..25a92b380a050726df7356a4f6e1e46eb40fa3bd 100644 (file)
@@ -24,7 +24,8 @@
 #include <kparts/part.h>
 #include <kshell.h>
 
-#include <QtGui/QBoxLayout>
+#include <QBoxLayout>
+#include <QShowEvent>
 
 TerminalSidebarPage::TerminalSidebarPage(QWidget* parent) :
     SidebarPage(parent),
@@ -39,6 +40,13 @@ TerminalSidebarPage::~TerminalSidebarPage()
 {
 }
 
+QSize TerminalSidebarPage::sizeHint() const
+{
+    QSize size = SidebarPage::sizeHint();
+    size.setHeight(200);
+    return size;
+}
+
 void TerminalSidebarPage::setUrl(const KUrl& url)
 {
     if (!SidebarPage::url().equals(url, KUrl::CompareWithoutTrailingSlash)) {
@@ -51,9 +59,14 @@ void TerminalSidebarPage::setUrl(const KUrl& url)
 
 void TerminalSidebarPage::showEvent(QShowEvent* event)
 {
+    if (event->spontaneous()) {
+        SidebarPage::showEvent(event);
+        return;
+    }
+
     if (m_terminal == 0) {
-        KLibFactory* factory = KLibLoader::self()->factory("libkonsolepart");
-        KParts::Part* part = static_cast<KParts::Part*>(factory->create(this, "KParts::ReadOnlyPart"));
+        KPluginFactory* factory = KPluginLoader("libkonsolepart").factory();
+        KParts::ReadOnlyPart* part = factory ? (factory->create<KParts::ReadOnlyPart>(this)) : 0;
         if (part != 0) {
             m_layout->addWidget(part->widget());
             m_terminal = qobject_cast<TerminalInterface *>(part);