]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge branch 'master' into kf6
authorNate Graham <nate@kde.org>
Tue, 19 Sep 2023 14:29:35 +0000 (08:29 -0600)
committerNate Graham <nate@kde.org>
Tue, 19 Sep 2023 14:29:35 +0000 (08:29 -0600)
1  2 
src/panels/terminal/terminalpanel.cpp

index ac395d09df601350740532a0f811f988535feea9,72886c2e9f1f00e66b51a2b65889919d27c810b1..30c9e8409c213f7b90efab259591276a22852375
@@@ -77,18 -77,22 +77,22 @@@ void TerminalPanel::dockVisibilityChang
  {
      // Only react when the DockWidget itself (not some parent) is hidden. This way we don't
      // respond when e.g. Dolphin is minimized.
-     if (isHiddenInVisibleWindow() && m_terminal && !hasProgramRunning()) {
-         // Make sure that the following "cd /" command will not affect the view.
-         disconnect(m_konsolePart, SIGNAL(currentDirectoryChanged(QString)), this, SLOT(slotKonsolePartCurrentDirectoryChanged(QString)));
-         // Make sure this terminal does not prevent unmounting any removable drives
-         changeDir(QUrl::fromLocalFile(QStringLiteral("/")));
-         // Because we have disconnected from the part's currentDirectoryChanged()
-         // signal, we have to update m_konsolePartCurrentDirectory manually. If this
-         // was not done, showing the panel again might not set the part's working
-         // directory correctly.
-         m_konsolePartCurrentDirectory = '/';
+     if (isHiddenInVisibleWindow()) {
+         if (m_konsolePartMissingMessage) {
+             m_konsolePartMissingMessage->hide();
+         } else if (m_terminal && !hasProgramRunning()) {
+             // Make sure that the following "cd /" command will not affect the view.
+             disconnect(m_konsolePart, SIGNAL(currentDirectoryChanged(QString)), this, SLOT(slotKonsolePartCurrentDirectoryChanged(QString)));
+             // Make sure this terminal does not prevent unmounting any removable drives
+             changeDir(QUrl::fromLocalFile(QStringLiteral("/")));
+             // Because we have disconnected from the part's currentDirectoryChanged()
+             // signal, we have to update m_konsolePartCurrentDirectory manually. If this
+             // was not done, showing the panel again might not set the part's working
+             // directory correctly.
+             m_konsolePartCurrentDirectory = '/';
+         }
      }
  }
  
@@@ -140,7 -144,7 +144,7 @@@ void TerminalPanel::showEvent(QShowEven
  
      if (!m_terminal) {
          m_clearTerminal = true;
 -        KPluginFactory *factory = KPluginFactory::loadFactory(KPluginMetaData(QStringLiteral("konsolepart"))).plugin;
 +        KPluginFactory *factory = KPluginFactory::loadFactory(KPluginMetaData(QStringLiteral("kf6/parts/konsolepart"))).plugin;
          m_konsolePart = factory ? (factory->create<KParts::ReadOnlyPart>(this)) : nullptr;
          if (m_konsolePart) {
              connect(m_konsolePart, &KParts::ReadOnlyPart::destroyed, this, &TerminalPanel::terminalExited);
                  });
              }
  
-         } else if (!m_konsolePartMissingMessage) {
-             const auto konsoleInstallUrl = QUrl("appstream://org.kde.konsole.desktop");
-             const auto konsoleNotInstalledText = i18n(
-                 "Terminal cannot be shown because Konsole is not installed. "
-                 "Please install it and then reopen the panel.");
-             m_konsolePartMissingMessage = new KMessageWidget(konsoleNotInstalledText, this);
-             m_konsolePartMissingMessage->setCloseButtonVisible(false);
-             m_konsolePartMissingMessage->hide();
-             if (KIO::DesktopExecParser::hasSchemeHandler(konsoleInstallUrl)) {
-                 auto installKonsoleAction = new QAction(i18n("Install Konsole"), this);
-                 connect(installKonsoleAction, &QAction::triggered, [konsoleInstallUrl]() {
-                     QDesktopServices::openUrl(konsoleInstallUrl);
-                 });
-                 m_konsolePartMissingMessage->addAction(installKonsoleAction);
-             }
-             m_layout->addWidget(m_konsolePartMissingMessage);
-             m_layout->addStretch();
-             QTimer::singleShot(0, m_konsolePartMissingMessage, &KMessageWidget::animatedShow);
          } else {
+             if (!m_konsolePartMissingMessage) {
+                 const auto konsoleInstallUrl = QUrl("appstream://org.kde.konsole.desktop");
+                 const auto konsoleNotInstalledText = i18n(
+                     "Terminal cannot be shown because Konsole is not installed. "
+                     "Please install it and then reopen the panel.");
+                 m_konsolePartMissingMessage = new KMessageWidget(konsoleNotInstalledText, this);
+                 m_konsolePartMissingMessage->setCloseButtonVisible(false);
+                 m_konsolePartMissingMessage->hide();
+                 if (KIO::DesktopExecParser::hasSchemeHandler(konsoleInstallUrl)) {
+                     auto installKonsoleAction = new QAction(i18n("Install Konsole"), this);
+                     connect(installKonsoleAction, &QAction::triggered, [konsoleInstallUrl]() {
+                         QDesktopServices::openUrl(konsoleInstallUrl);
+                     });
+                     m_konsolePartMissingMessage->addAction(installKonsoleAction);
+                 }
+                 m_layout->addWidget(m_konsolePartMissingMessage);
+                 m_layout->setSizeConstraint(QLayout::SetMaximumSize);
+             }
              m_konsolePartMissingMessage->animatedShow();
          }
      }