diff --git a/CMakeLists.txt b/CMakeLists.txt index 578380458..4a4058935 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,42 @@ project(Konsole) -find_package(KDE4 4.7.0 REQUIRED) +include(FeatureSummary) +find_package(Qt5Core NO_MODULE) +set_package_properties(Qt5Core PROPERTIES TYPE REQUIRED) +message(STATUS "Qt5 build") +find_package(ECM 0.0.9 NO_MODULE) +set_package_properties(ECM PROPERTIES TYPE REQUIRED) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) +find_package(Qt5Transitional MODULE) +set_package_properties(Qt5Transitional PROPERTIES TYPE REQUIRED) +find_package(kdeqt5staging NO_MODULE) +set_package_properties(kdeqt5staging PROPERTIES TYPE REQUIRED) +find_package(KF5 MODULE REQUIRED COMPONENTS CMake Compiler InstallDirs + KDBusAddons KCoreAddons KConfig + KCodecs KI18n KService KWidgetsAddons + KWindowSystem KCrash Sonnet + KArchive ItemModels KAuth KGuiAddons KConfigWidgets + ItemViews KNotifications KJS + KJobWidgets KIconThemes KCompletion KTextWidgets + XmlGui Solid KWallet KIO KUnitConversion KDE4Attic +) +find_package(KDELibs4 NO_MODULE) #needed for KDE4Support +set_package_properties(KDELibs4 PROPERTIES TYPE REQUIRED) +find_package(KDE4Support NO_MODULE) +set_package_properties(KDE4Support PROPERTIES TYPE REQUIRED) +remove_definitions(-DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_CAST_FROM_ASCII) +add_definitions(-Wno-deprecated-declarations) +set(KDE4_KIO_LIBS ${KDE4_KIO_LIBS} ${KDE4Support_LIBRARIES}) -include(KDE4Defaults) - -add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS) add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1211) +#TODO: this is temporarily disabled until it has been ported to Qt5 +add_definitions(-DQT_NO_ACCESSIBILITY) include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES}) -kde4_no_enable_final(konsole) - add_subdirectory( src ) add_subdirectory( data ) add_subdirectory( desktop ) add_subdirectory( doc/manual ) -macro_display_feature_log() +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/BookmarkHandler.cpp b/src/BookmarkHandler.cpp index 9fc1600aa..7a54b1703 100644 --- a/src/BookmarkHandler.cpp +++ b/src/BookmarkHandler.cpp @@ -31,6 +31,8 @@ #include #include #include +#include +#include // Konsole #include "ViewProperties.h" @@ -38,7 +40,7 @@ using namespace Konsole; BookmarkHandler::BookmarkHandler(KActionCollection* collection, - KMenu* menu, + QMenu* menu, bool toplevel, QObject* parent) : QObject(parent), diff --git a/src/BookmarkHandler.h b/src/BookmarkHandler.h index 76c33269e..04e988df6 100644 --- a/src/BookmarkHandler.h +++ b/src/BookmarkHandler.h @@ -26,11 +26,13 @@ // KDE #include +#include // Konsole #include "konsole_export.h" class KMenu; +class QMenu; class KBookmarkMenu; class KActionCollection; @@ -62,7 +64,7 @@ public: * @param toplevel TODO: Document me * @param parent The parent object */ - BookmarkHandler(KActionCollection* collection , KMenu* menu, bool toplevel , QObject* parent); + BookmarkHandler(KActionCollection* collection , QMenu* menu, bool toplevel , QObject* parent); ~BookmarkHandler(); virtual QString currentUrl() const; @@ -75,7 +77,7 @@ public: /** * Returns the menu which this bookmark handler inserts its actions into. */ - KMenu* menu() const { + QMenu* menu() const { return _menu; } @@ -105,7 +107,7 @@ signals: * @param urls The urls of the bookmarks in the folder whose * 'Open Folder in Tabs' action was triggered */ - void openUrls(const QList& urls); + void openUrls(const QList& urls); private slots: void openBookmark(const KBookmark& bm, Qt::MouseButtons, Qt::KeyboardModifiers); @@ -114,7 +116,7 @@ private: QString titleForView(ViewProperties* view) const; QString urlForView(ViewProperties* view) const; - KMenu* _menu; + QMenu* _menu; KBookmarkMenu* _bookmarkMenu; QString _file; bool _toplevel; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 153e4bcf4..9f7d2f59c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,15 @@ -# cmake-options : -WITH_LibKonq=ON or OFF; default is ON -macro_optional_find_package(LibKonq) -macro_bool_to_01(LIBKONQ_FOUND HAVE_LIBKONQ) +# cmake-options : -DCMAKE_DISABLE_FIND_PACKAGE_LibKonq=TRUE or FALSE; default is FALSE -macro_log_feature(LIBKONQ_FOUND "LibKonq" - "Provides high-level file management functions" - "https://projects.kde.org/projects/kde/applications/kde-baseapps" - FALSE "" "Required for drag-n-drop menus") +if (FALSE) # there is no libkonq for Qt5 yet + find_package(LibKonq) + set_package_properties(LibKonq PROPERTIES DESCRIPTION "Provides high-level file management functions" + URL "https://projects.kde.org/projects/kde/applications/kde-baseapps" TYPE OPTIONAL + PURPOSE "Required for drag-n-drop menus") +else() + message(WARNING "LibKonq does not exist for KF5 yet, reenable this check once it exists.") +endif() + +macro_bool_to_01(LIBKONQ_FOUND HAVE_LIBKONQ) if(HAVE_LIBKONQ) include_directories(${LIBKONQ_INCLUDE_DIR}) @@ -143,7 +147,15 @@ kde4_add_ui_files(konsoleprivate_SRCS ColorSchemeEditor.ui settings/TabBarSettings.ui) kde4_add_library(konsoleprivate SHARED ${konsoleprivate_SRCS}) -target_link_libraries(konsoleprivate ${konsole_LIBS}) +target_link_libraries(konsoleprivate ${konsole_LIBS} + KF5::XmlGui + Qt5::PrintSupport + KF5::KNotifications + KF5::KWindowSystem + KF5::KTextWidgets + KF5::KGuiAddons + KF5::KIconThemes +) target_link_libraries(konsoleprivate LINK_INTERFACE_LIBRARIES ${konsole_LIBS}) set(konsole_KDEINIT_SRCS @@ -158,7 +170,7 @@ kde4_add_kcfg_files(konsole_KDEINIT_SRCS settings/KonsoleSettings.kcfgc) kde4_add_app_icon(konsole_KDEINIT_SRCS "${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/utilities-terminal.png") kde4_add_kdeinit_executable(konsole ${konsole_KDEINIT_SRCS}) -target_link_libraries(kdeinit_konsole konsoleprivate) +target_link_libraries(kdeinit_konsole konsoleprivate KF5::XmlGui KF5::KWindowSystem) install(TARGETS kdeinit_konsole konsole konsoleprivate ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/src/ColorScheme.cpp b/src/ColorScheme.cpp index 6945c3914..53bfb8646 100644 --- a/src/ColorScheme.cpp +++ b/src/ColorScheme.cpp @@ -292,7 +292,7 @@ void ColorScheme::read(const KConfig& config) const QString schemeDescription = configGroup.readEntry("Description", I18N_NOOP("Un-named Color Scheme")); - _description = i18n(schemeDescription.toUtf8()); + _description = i18n(schemeDescription.toUtf8().constData()); _opacity = configGroup.readEntry("Opacity", qreal(1.0)); setWallpaper(configGroup.readEntry("Wallpaper", QString())); diff --git a/src/ColorSchemeEditor.cpp b/src/ColorSchemeEditor.cpp index afe13c3a4..93a8a9f01 100644 --- a/src/ColorSchemeEditor.cpp +++ b/src/ColorSchemeEditor.cpp @@ -29,6 +29,9 @@ #include #include #include +#include +#include +#include // Konsole #include "ui_ColorSchemeEditor.h" @@ -156,7 +159,7 @@ void ColorSchemeEditor::editColorItem(QTableWidgetItem* item) } void ColorSchemeEditor::selectWallpaper() { - const KUrl url = KFileDialog::getImageOpenUrl(_ui->wallpaperPath->text(), + const KUrl url = KFileDialog::getImageOpenUrl(KUrl(_ui->wallpaperPath->text()), this, i18nc("@action:button", "Select wallpaper image file")); diff --git a/src/ColorSchemeManager.cpp b/src/ColorSchemeManager.cpp index 802f5d7f9..8fe888ab4 100644 --- a/src/ColorSchemeManager.cpp +++ b/src/ColorSchemeManager.cpp @@ -149,7 +149,7 @@ bool KDE3ColorSchemeReader::readTitleLine(const QString& line, ColorScheme* sche QString description = line.mid(spacePos + 1); - scheme->setDescription(i18n(description.toUtf8())); + scheme->setDescription(i18n(description.toUtf8().constData())); return true; } diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index cf7be3d72..b3c175c78 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -48,6 +48,7 @@ #include #include #include +#include // Konsole #include "ColorScheme.h" @@ -261,7 +262,7 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr profile) _ui->commandEdit->setText(command.fullCommand()); KUrlCompletion* exeCompletion = new KUrlCompletion(KUrlCompletion::ExeCompletion); exeCompletion->setParent(this); - exeCompletion->setDir(QString()); + exeCompletion->setDir(QUrl()); _ui->commandEdit->setCompletionObject(exeCompletion); _ui->initialDirEdit->setText(profile->defaultWorkingDirectory()); @@ -395,7 +396,7 @@ void EditProfileDialog::commandChanged(const QString& command) } void EditProfileDialog::selectInitialDir() { - const KUrl url = KFileDialog::getExistingDirectoryUrl(_ui->initialDirEdit->text(), + const KUrl url = KFileDialog::getExistingDirectoryUrl(KUrl(_ui->initialDirEdit->text()), this, i18n("Select Initial Directory")); @@ -1213,7 +1214,7 @@ void EditProfileDialog::showFontDialog() QFont currentFont = _ui->fontPreviewLabel->font(); QWeakPointer dialog = new KFontDialog(this, KFontChooser::FixedFontsOnly); - dialog.data()->setCaption(i18n("Select Fixed Width Font")); + dialog.data()->setWindowTitle(i18n("Select Fixed Width Font")); dialog.data()->setFont(currentFont, true); // TODO (hindenburg): When https://git.reviewboard.kde.org/r/103357 is diff --git a/src/Emulation.cpp b/src/Emulation.cpp index 02ed4be48..172032058 100644 --- a/src/Emulation.cpp +++ b/src/Emulation.cpp @@ -192,7 +192,7 @@ void Emulation::sendKeyEvent(QKeyEvent* ev) // A block of text // Note that the text is proper unicode. // We should do a conversion here - emit sendData(ev->text().toUtf8(), ev->text().length()); + emit sendData(ev->text().toUtf8().constData(), ev->text().length()); } } diff --git a/src/Filter.cpp b/src/Filter.cpp index 8f40c0c59..8ea6eed57 100644 --- a/src/Filter.cpp +++ b/src/Filter.cpp @@ -30,6 +30,7 @@ // KDE #include #include +#include // Konsole #include "TerminalCharacterDecoder.h" @@ -423,7 +424,7 @@ void UrlFilter::HotSpot::activate(QObject* object) url.prepend("mailto:"); } - new KRun(url, QApplication::activeWindow()); + new KRun(KUrl(url), QApplication::activeWindow()); } } diff --git a/src/KeyBindingEditor.cpp b/src/KeyBindingEditor.cpp index 005b9e320..7a4885707 100644 --- a/src/KeyBindingEditor.cpp +++ b/src/KeyBindingEditor.cpp @@ -22,6 +22,8 @@ // Qt #include +// KDE +#include // Konsole #include "ui_KeyBindingEditor.h" diff --git a/src/KeyboardTranslator.cpp b/src/KeyboardTranslator.cpp index 8fe2acb40..879b3023f 100644 --- a/src/KeyboardTranslator.cpp +++ b/src/KeyboardTranslator.cpp @@ -90,7 +90,7 @@ KeyboardTranslatorReader::KeyboardTranslatorReader(QIODevice* source) while (_description.isEmpty() && !source->atEnd()) { QList tokens = tokenize(QString::fromLocal8Bit(source->readLine())); if (!tokens.isEmpty() && tokens.first().type == Token::TitleKeyword) - _description = i18n(tokens[1].text.toUtf8()); + _description = i18n(tokens[1].text.toUtf8().constData()); } // read first entry (if any) readNext(); diff --git a/src/KeyboardTranslator.h b/src/KeyboardTranslator.h index 99c71743d..8ad94b293 100644 --- a/src/KeyboardTranslator.h +++ b/src/KeyboardTranslator.h @@ -25,6 +25,7 @@ // Qt #include #include +#include //#include #include diff --git a/src/KeyboardTranslatorManager.cpp b/src/KeyboardTranslatorManager.cpp index 4d4621051..dc891e9a7 100644 --- a/src/KeyboardTranslatorManager.cpp +++ b/src/KeyboardTranslatorManager.cpp @@ -28,6 +28,7 @@ // KDE #include +#include #include using namespace Konsole; diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 285d6347b..76222b07b 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -31,6 +31,7 @@ #include #include #include + #include #include #include @@ -42,6 +43,8 @@ #include #include #include +#include +#include // Konsole #include "BookmarkHandler.h" @@ -153,7 +156,10 @@ void MainWindow::removeMenuAccelerators() { foreach(QAction* menuItem, menuBar()->actions()) { QString itemText = menuItem->text(); +#pragma message("TODO: How to port KLocale::removeAcceleratorMarker()?") +#if 0 itemText = KGlobal::locale()->removeAcceleratorMarker(itemText); +#endif menuItem->setText(itemText); } } @@ -283,12 +289,16 @@ IncrementalSearchBar* MainWindow::searchBar() const void MainWindow::setupActions() { KActionCollection* collection = actionCollection(); - KAction* menuAction = 0; + QAction* menuAction = 0; // File Menu _newTabMenuAction = new KActionMenu(KIcon("tab-new"), i18nc("@action:inmenu", "&New Tab"), collection); _newTabMenuAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_T)); + +#pragma message("TODO: How to port KAction::setShortcutConfigurable()?") +#if 0 _newTabMenuAction->setShortcutConfigurable(true); +#endif _newTabMenuAction->setAutoRepeat(false); connect(_newTabMenuAction, SIGNAL(triggered()), this, SLOT(newTab())); collection->addAction("new-tab", _newTabMenuAction); @@ -317,7 +327,7 @@ void MainWindow::setupActions() KActionMenu* bookmarkMenu = new KActionMenu(i18nc("@title:menu", "&Bookmarks"), collection); _bookmarkHandler = new BookmarkHandler(collection, bookmarkMenu->menu(), true, this); collection->addAction("bookmark", bookmarkMenu); - connect(_bookmarkHandler, SIGNAL(openUrls(QList)), this, SLOT(openUrls(QList))); + connect(_bookmarkHandler, SIGNAL(openUrls(QList)), this, SLOT(openUrls(QList))); // Settings Menu _toggleMenuBarAction = KStandardAction::showMenubar(menuBar(), SLOT(setVisible(bool)), collection); @@ -373,7 +383,8 @@ void MainWindow::profileListChanged(const QList& sessionActions) // it if it is the non-default profile. if (sessionActions.size() > 2) { // Update the 'New Tab' KActionMenu - KMenu* newTabMenu = _newTabMenuAction->menu(); + QMenu* newTabMenu = _newTabMenuAction->menu(); + newTabMenu->clear(); foreach(QAction* sessionAction, sessionActions) { newTabMenu->addAction(sessionAction); @@ -389,7 +400,7 @@ void MainWindow::profileListChanged(const QList& sessionActions) } } } else { - KMenu* newTabMenu = _newTabMenuAction->menu(); + QMenu* newTabMenu = _newTabMenuAction->menu(); newTabMenu->clear(); Profile::Ptr profile = ProfileManager::instance()->defaultProfile(); @@ -416,7 +427,7 @@ QString MainWindow::activeSessionDir() const } } -void MainWindow::openUrls(const QList& urls) +void MainWindow::openUrls(const QList& urls) { Profile::Ptr defaultProfile = ProfileManager::instance()->defaultProfile(); diff --git a/src/MainWindow.h b/src/MainWindow.h index b297883eb..cf023726b 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -163,8 +163,7 @@ private slots: void updateWindowIcon(); void updateWindowCaption(); - - void openUrls(const QList& urls); + void openUrls(const QList& urls); // Sets the list of profiles to be displayed under the "New Tab" action void setProfileList(ProfileList* list); diff --git a/src/Part.cpp b/src/Part.cpp index 33e2d3849..69f700a9e 100644 --- a/src/Part.cpp +++ b/src/Part.cpp @@ -30,6 +30,9 @@ #include #include #include +#include +#include +#include #include // Konsole @@ -54,10 +57,13 @@ Part::Part(QWidget* parentWidget , QObject* parent, const QVariantList&) , _pluggedController(0) , _manageProfilesAction(0) { +#pragma message("TODO: How to port KLocale::insertCatalog()?") +#if 0 // make sure the konsole catalog is loaded KGlobal::locale()->insertCatalog("konsole"); // make sure the libkonq catalog is loaded( needed for drag & drop ) KGlobal::locale()->insertCatalog("libkonq"); +#endif // setup global actions createGlobalActions(); @@ -321,10 +327,11 @@ void Part::changeSessionSettings(const QString& text) sendInput(command); } - // Konqueror integration -bool Part::openUrl(const KUrl& aUrl) +bool Part::openUrl(const QUrl& aQUrl) { + KUrl aUrl = aQUrl; + if (url() == aUrl) { emit completed(); return true; diff --git a/src/Part.h b/src/Part.h index 2806bcdb0..c4d75fc43 100644 --- a/src/Part.h +++ b/src/Part.h @@ -33,6 +33,7 @@ class QAction; class QStringList; class QKeyEvent; +class KUrl; namespace Konsole { @@ -191,8 +192,8 @@ signals: protected: /** Reimplemented from KParts::PartBase. */ - virtual bool openFile(); - virtual bool openUrl(const KUrl& url); + virtual bool openFile() Q_DECL_OVERRIDE; + virtual bool openUrl(const QUrl& url) Q_DECL_OVERRIDE; private slots: void activeViewChanged(SessionController* controller); @@ -202,7 +203,6 @@ private slots: void newTab(); void overrideTerminalShortcut(QKeyEvent*, bool& override); void sessionStateChanged(int state); - private: Session* activeSession() const; void createGlobalActions(); diff --git a/src/PrintOptions.cpp b/src/PrintOptions.cpp index 5e802987d..31d295f7c 100644 --- a/src/PrintOptions.cpp +++ b/src/PrintOptions.cpp @@ -23,6 +23,7 @@ // KDE #include +#include #include using namespace Konsole; diff --git a/src/Profile.cpp b/src/Profile.cpp index 14946ce69..4480ed6c9 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -189,7 +189,7 @@ FallbackProfile::FallbackProfile() setProperty(LineSpacing, 0); setProperty(CursorShape, Enum::BlockCursor); setProperty(UseCustomCursorColor, false); - setProperty(CustomCursorColor, Qt::black); + setProperty(CustomCursorColor, QColor(Qt::black)); setProperty(BellMode, Enum::NotifyBell); setProperty(DefaultEncoding, QString(QTextCodec::codecForLocale()->name())); diff --git a/src/SessionController.cpp b/src/SessionController.cpp index 88fc50c6a..ed6b597c7 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -50,8 +50,10 @@ #include #include #include +#include #include #include +#include #include #if KDE_IS_VERSION(4, 9, 1) @@ -90,9 +92,10 @@ using namespace Konsole; // TODO - Replace the icon choices below when suitable icons for silence and // activity are available -const KIcon SessionController::_activityIcon("dialog-information"); -const KIcon SessionController::_silenceIcon("dialog-information"); -const KIcon SessionController::_broadcastIcon("emblem-important"); +//having global static KIcons no longer works with Qt5/KF5, use K_GLOBAL_STATIC +K_GLOBAL_STATIC_WITH_ARGS(KIcon, _activityIcon, ("dialog-information")); +K_GLOBAL_STATIC_WITH_ARGS(KIcon, _silenceIcon, ("dialog-information")); +K_GLOBAL_STATIC_WITH_ARGS(KIcon, _broadcastIcon, ("emblem-important")); QSet SessionController::_allControllers; int SessionController::_lastControllerId; @@ -548,7 +551,8 @@ void SessionController::setShowMenuAction(QAction* action) void SessionController::setupCommonActions() { - KAction* action = 0; + QAction* action = 0; + KActionCollection* collection = actionCollection(); // Close Session @@ -573,10 +577,10 @@ void SessionController::setupCommonActions() action->setEnabled(false); action = KStandardAction::paste(this, SLOT(paste()), collection); - KShortcut pasteShortcut = action->shortcut(); - pasteShortcut.setPrimary(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V)); - pasteShortcut.setAlternate(QKeySequence(Qt::SHIFT + Qt::Key_Insert)); - action->setShortcut(pasteShortcut); + QList pasteShortcut; + pasteShortcut.append(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V)); + pasteShortcut.append(QKeySequence(Qt::SHIFT + Qt::Key_Insert)); + action->setShortcuts(pasteShortcut); action = collection->addAction("paste-selection", this, SLOT(pasteFromX11Selection())); action->setText(i18n("Paste Selection")); @@ -643,7 +647,7 @@ void SessionController::setupCommonActions() void SessionController::setupExtraActions() { - KAction* action = 0; + QAction* action = 0; KToggleAction* toggleAction = 0; KActionCollection* collection = actionCollection(); @@ -702,15 +706,16 @@ void SessionController::setupExtraActions() action = collection->addAction("enlarge-font", this, SLOT(increaseFontSize())); action->setText(i18n("Enlarge Font")); action->setIcon(KIcon("format-font-size-more")); - KShortcut enlargeFontShortcut = action->shortcut(); - enlargeFontShortcut.setPrimary(QKeySequence(Qt::CTRL + Qt::Key_Plus)); - enlargeFontShortcut.setAlternate(QKeySequence(Qt::CTRL + Qt::Key_Equal)); - action->setShortcut(enlargeFontShortcut); + QList enlargeFontShortcut; + enlargeFontShortcut.append(QKeySequence(Qt::CTRL + Qt::Key_Plus)); + enlargeFontShortcut.append(QKeySequence(Qt::CTRL + Qt::Key_Equal)); + action->setShortcuts(enlargeFontShortcut); action = collection->addAction("shrink-font", this, SLOT(decreaseFontSize())); action->setText(i18n("Shrink Font")); action->setIcon(KIcon("format-font-size-less")); - action->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Minus)); + action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus)); + // Send signal KSelectAction* sendSignalActions = collection->add("send-signal"); @@ -918,10 +923,11 @@ void SessionController::openBrowser() { KUrl currentUrl = url(); - if (currentUrl.isLocalFile()) - new KRun(currentUrl, QApplication::activeWindow(), 0, true, true); - else - new KRun(KUrl(QDir::homePath()), QApplication::activeWindow(), 0, true, true); + if (currentUrl.isLocalFile()) { + new KRun(currentUrl, QApplication::activeWindow(), true); + } else { + new KRun(QUrl::fromLocalFile(QDir::homePath()), QApplication::activeWindow(), true); + } } void SessionController::copy() @@ -1381,7 +1387,7 @@ void SessionController::updateSessionIcon() // Visualize that the session is broadcasting to others if (_copyToGroup && _copyToGroup->sessions().count() > 1) { // Master Mode: set different icon, to warn the user to be careful - setIcon(_broadcastIcon); + setIcon(*_broadcastIcon); } else { if (!_keepIconUntilInteraction) { // Not in Master Mode: use normal icon @@ -1393,7 +1399,7 @@ void SessionController::sessionTitleChanged() { if (_sessionIconName != _session->iconName()) { _sessionIconName = _session->iconName(); - _sessionIcon = KIcon(_sessionIconName); + _sessionIcon = QIcon::fromTheme(_sessionIconName); updateSessionIcon(); } @@ -1484,10 +1490,10 @@ void SessionController::sessionStateChanged(int state) return; if (state == NOTIFYACTIVITY) { - setIcon(_activityIcon); + setIcon(*_activityIcon); _keepIconUntilInteraction = true; } else if (state == NOTIFYSILENCE) { - setIcon(_silenceIcon); + setIcon(*_silenceIcon); _keepIconUntilInteraction = true; } else if (state == NOTIFYNORMAL) { if (_sessionIconName != _session->iconName()) { @@ -1509,7 +1515,7 @@ void SessionController::zmodemDownload() } if (!zmodem.isEmpty()) { const QString path = KFileDialog::getExistingDirectory( - QString(), _view, + KUrl(), _view, i18n("Save ZModem Download to...")); if (!path.isEmpty()) { @@ -1598,7 +1604,7 @@ void SaveHistoryTask::execute() // TODO - show a warning ( preferably passive ) if saving the history output fails // - KFileDialog* dialog = new KFileDialog(QString(":konsole") /* check this */, + KFileDialog* dialog = new KFileDialog(KUrl(QString(":konsole")) /* check this */, QString(), QApplication::activeWindow()); dialog->setOperationMode(KFileDialog::Saving); dialog->setConfirmOverwrite(true); @@ -1612,7 +1618,7 @@ void SaveHistoryTask::execute() // to save that session's history. // then start a KIO job to transfer the data from the history to the chosen URL foreach(const SessionPtr& session, sessions()) { - dialog->setCaption(i18n("Save Output From %1", session->title(Session::NameRole))); + dialog->setWindowTitle(i18n("Save Output From %1", session->title(Session::NameRole))); int result = dialog->exec(); diff --git a/src/SessionController.h b/src/SessionController.h index 036e05349..bd6747251 100644 --- a/src/SessionController.h +++ b/src/SessionController.h @@ -301,18 +301,18 @@ private: ProfileList* _profileList; - KIcon _sessionIcon; + QIcon _sessionIcon; QString _sessionIconName; int _previousState; UrlFilter* _viewUrlFilter; RegExpFilter* _searchFilter; - KAction* _copyInputToAllTabsAction; + QAction* _copyInputToAllTabsAction; - KAction* _findAction; - KAction* _findNextAction; - KAction* _findPreviousAction; + QAction* _findAction; + QAction* _findNextAction; + QAction* _findPreviousAction; QTimer* _interactionTimer; @@ -336,9 +336,6 @@ private: static QSet _allControllers; static int _lastControllerId; - static const KIcon _activityIcon; - static const KIcon _silenceIcon; - static const KIcon _broadcastIcon; QStringList _bookmarkValidProgramsToClear; diff --git a/src/ShellCommand.cpp b/src/ShellCommand.cpp index 2b059a16e..790b789e9 100644 --- a/src/ShellCommand.cpp +++ b/src/ShellCommand.cpp @@ -141,7 +141,7 @@ bool ShellCommand::expandEnv(QString& text) const int len = endPos - dollarPos; const QString key = text.mid(dollarPos + 1, len - 1); - const QString value = QString::fromLocal8Bit(qgetenv(key.toLocal8Bit())); + const QString value = QString::fromLocal8Bit(qgetenv(key.toLocal8Bit().constData())); if (!value.isEmpty()) { text.replace(dollarPos, len, value); diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index acfddc176..638bf5dc5 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include // KDE @@ -271,6 +272,9 @@ void TerminalDisplay::setLineSpacing(uint i) namespace Konsole { + +#pragma message("The accessibility code needs proper porting to Qt5") +#ifndef QT_NO_ACCESSIBILITY /** * This function installs the factory function which lets Qt instantiate the QAccessibleInterface * for the TerminalDisplay. @@ -282,6 +286,8 @@ QAccessibleInterface* accessibleInterfaceFactory(const QString &key, QObject *ob return new TerminalDisplayAccessible(display); return 0; } + +#endif } /* ------------------------------------------------------------------------- */ @@ -738,11 +744,7 @@ void TerminalDisplay::drawCharacters(QPainter& painter, painter.drawText(rect, 0, text); } else { // See bug 280896 for more info -#if QT_VERSION >= 0x040800 painter.drawText(rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + text); -#else - painter.drawText(rect, 0, LTR_OVERRIDE_CHAR + text); -#endif } } } @@ -1127,12 +1129,10 @@ void TerminalDisplay::updateImage() } delete[] dirtyMask; -#if QT_VERSION >= 0x040800 // added in Qt 4.8.0 #ifndef QT_NO_ACCESSIBILITY QAccessible::updateAccessibility(this, 0, QAccessible::TextUpdated); QAccessible::updateAccessibility(this, 0, QAccessible::TextCaretMoved); #endif -#endif } void TerminalDisplay::showResizeNotification() @@ -2852,10 +2852,8 @@ void TerminalDisplay::keyPressEvent(QKeyEvent* event) emit keyPressedSignal(event); -#if QT_VERSION >= 0x040800 // added in Qt 4.8.0 #ifndef QT_NO_ACCESSIBILITY QAccessible::updateAccessibility(this, 0, QAccessible::TextCaretMoved); -#endif #endif event->accept(); @@ -3088,7 +3086,7 @@ void TerminalDisplay::dropEvent(QDropEvent* event) if (event->mimeData()->hasFormat("text/plain") || event->mimeData()->hasFormat("text/uri-list")) { - emit sendStringToEmu(dropText.toLocal8Bit()); + emit sendStringToEmu(dropText.toLocal8Bit().constData()); } } @@ -3097,7 +3095,7 @@ void TerminalDisplay::dropMenuPasteActionTriggered() if (sender()) { const QAction* action = qobject_cast(sender()); if (action) { - emit sendStringToEmu(action->data().toString().toLocal8Bit()); + emit sendStringToEmu(action->data().toString().toLocal8Bit().constData()); } } } @@ -3107,7 +3105,7 @@ void TerminalDisplay::dropMenuCdActionTriggered() if (sender()) { const QAction* action = qobject_cast(sender()); if (action) { - emit sendStringToEmu(action->data().toString().toLocal8Bit()); + emit sendStringToEmu(action->data().toString().toLocal8Bit().constData()); } } } diff --git a/src/TerminalDisplayAccessible.cpp b/src/TerminalDisplayAccessible.cpp index 8d37dc5e1..10d490d49 100644 --- a/src/TerminalDisplayAccessible.cpp +++ b/src/TerminalDisplayAccessible.cpp @@ -21,24 +21,21 @@ #include "TerminalDisplayAccessible.h" -#if QT_VERSION >= 0x040800 // added in Qt 4.8.0 +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + + QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int* startOffset, int* endOffset, const QString& text); QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int* startOffset, int* endOffset, const QString& text); QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, int* startOffset, int* endOffset, const QString& text); -#endif using namespace Konsole; TerminalDisplayAccessible::TerminalDisplayAccessible(TerminalDisplay* display) : QAccessibleWidgetEx(display, -#if QT_VERSION > 0x040800 // added in Qt 4.8.1 QAccessible::Terminal -#else - QAccessible::EditableText -#endif ) , QAccessibleSimpleEditableTextInterface(this) {} @@ -183,34 +180,26 @@ QString TerminalDisplayAccessible::text(int startOffset, int endOffset) QString TerminalDisplayAccessible::textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, int* startOffset, int* endOffset) { const QString text = visibleText(); -#if QT_VERSION >= 0x040800 // added in Qt 4.8.0 return qTextAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, text); -#else - return text; -#endif } QString TerminalDisplayAccessible::textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, int* startOffset, int* endOffset) { const QString text = visibleText(); -#if QT_VERSION >= 0x040800 // added in Qt 4.8.0 return qTextAtOffsetFromString(offset, boundaryType, startOffset, endOffset, text); -#else - return text; -#endif } QString TerminalDisplayAccessible::textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType, int* startOffset, int* endOffset) { const QString text = visibleText(); -#if QT_VERSION >= 0x040800 // added in Qt 4.8.0 return qTextBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, text); -#else - return text; -#endif } TerminalDisplay* TerminalDisplayAccessible::display() { return static_cast(object()); } + +#else +#pragma message("This code needs proper porting to Qt5") +#endif diff --git a/src/TerminalDisplayAccessible.h b/src/TerminalDisplayAccessible.h index c69644125..6816a4fc5 100644 --- a/src/TerminalDisplayAccessible.h +++ b/src/TerminalDisplayAccessible.h @@ -22,6 +22,10 @@ #ifndef TERMINALDISPLAYACCESSIBLE_H #define TERMINALDISPLAYACCESSIBLE_H +#include + +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + #include #include #include @@ -89,5 +93,8 @@ private: } // namespace +#else +#pragma message("The accessibility code needs proper porting to Qt5") +#endif #endif // TERMINALDISPLAYACCESSIBLE_H diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index bebf1dd31..e1991e89f 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -196,7 +196,7 @@ void ViewManager::setupActions() multiViewOnlyActions << shrinkActiveAction; #if defined(ENABLE_DETACHING) - KAction* detachViewAction = collection->addAction("detach-view"); + QAction* detachViewAction = collection->addAction("detach-view"); detachViewAction->setIcon(KIcon("tab-detach")); detachViewAction->setText(i18nc("@action:inmenu", "D&etach Current Tab")); // Ctrl+Shift+D is not used as a shortcut by default because it is too close diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp index 0b6d2ed2f..6bb51b3e1 100644 --- a/src/Vt102Emulation.cpp +++ b/src/Vt102Emulation.cpp @@ -945,7 +945,7 @@ void Vt102Emulation::sendMouseEvent(int cb, int cx, int cy , int eventType) coords[1] = cy + 0x20; QString coordsStr = QString(coords, 2); QByteArray utf8 = coordsStr.toUtf8(); - snprintf(command, sizeof(command), "\033[M%c%s", cb + 0x20, (const char *)utf8); + snprintf(command, sizeof(command), "\033[M%c%s", cb + 0x20, utf8.constData()); } } else if (cx <= 223 && cy <= 223) { snprintf(command, sizeof(command), "\033[M%c%c%c", cb + 0x20, cx + 0x20, cy + 0x20); diff --git a/src/main.cpp b/src/main.cpp index 2afc62c72..638f505b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,16 +25,18 @@ #include // KDE -#include +#include #include #include + + #define KONSOLE_VERSION "2.11.999" using Konsole::Application; // fill the KAboutData structure with information about contributors to Konsole. -void fillAboutData(KAboutData& aboutData); +void fillAboutData(K4AboutData& aboutData); // fill the KCmdLineOptions object with konsole specific options. void fillCommandLineOptions(KCmdLineOptions& options); @@ -51,12 +53,12 @@ void restoreSession(Application& app); // *** extern "C" int KDE_EXPORT kdemain(int argc, char** argv) { - KAboutData about("konsole", + K4AboutData about("konsole", 0, ki18nc("@title", "Konsole"), KONSOLE_VERSION, ki18nc("@title", "Terminal emulator"), - KAboutData::License_GPL_V2 + K4AboutData::License_GPL_V2 ); fillAboutData(about); @@ -79,8 +81,11 @@ extern "C" int KDE_EXPORT kdemain(int argc, char** argv) Application app; +#if 0 // make sure the d&d popup menu provided by libkonq get translated. KGlobal::locale()->insertCatalog("libkonq"); +#endif +#pragma message("TODO: Port this to the right insertCatalog() replacement.") restoreSession(app); return app.exec(); @@ -192,7 +197,7 @@ void fillCommandLineOptions(KCmdLineOptions& options) " with the -e option).")); } -void fillAboutData(KAboutData& aboutData) +void fillAboutData(K4AboutData& aboutData) { aboutData.setProgramIconName("utilities-terminal"); aboutData.setHomepage("http://konsole.kde.org"); diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 8f65ebe8c..e10f0a404 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -30,5 +30,5 @@ kde4_add_unit_test(SessionManagerTest SessionManagerTest.cpp) target_link_libraries(SessionManagerTest ${KONSOLE_TEST_LIBS}) kde4_add_unit_test(DBusTest DBusTest.cpp) -target_link_libraries(DBusTest ${KONSOLE_TEST_LIBS}) +target_link_libraries(DBusTest ${KONSOLE_TEST_LIBS} Qt5::DBus) diff --git a/src/tests/DBusTest.cpp b/src/tests/DBusTest.cpp index 729df8bf3..6e81c5ab9 100644 --- a/src/tests/DBusTest.cpp +++ b/src/tests/DBusTest.cpp @@ -98,11 +98,7 @@ void DBusTest::cleanupTestCase() QDBusInterface iface(_interfaceName, QLatin1String("/konsole/MainWindow_1"), -#if QT_VERSION < 0x040800 - QLatin1String("com.trolltech.Qt.QWidget")); -#else QLatin1String("org.qtproject.Qt.QWidget")); -#endif if (!iface.isValid()) kFatal() << "Unable to get a dbus interface to Konsole!"; diff --git a/src/tests/PartTest.cpp b/src/tests/PartTest.cpp index 72cd27de0..03c7a66e3 100644 --- a/src/tests/PartTest.cpp +++ b/src/tests/PartTest.cpp @@ -65,7 +65,7 @@ void PartTest::testFd() } if (pingExe.isEmpty()) { - QSKIP("ping command not found.", SkipSingle); + QSKIP("ping command not found."); return; } diff --git a/src/tests/ShellCommandTest.cpp b/src/tests/ShellCommandTest.cpp index d03964fda..837e18530 100644 --- a/src/tests/ShellCommandTest.cpp +++ b/src/tests/ShellCommandTest.cpp @@ -63,7 +63,7 @@ void ShellCommandTest::testExpandEnvironmentVariable() QString text = "PATH=$PATH:~/bin"; const QString env = "PATH"; const QString value = "/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"; - qputenv(env.toLocal8Bit(), value.toLocal8Bit()); + qputenv(env.toLocal8Bit().constData(), value.toLocal8Bit()); const QString result = ShellCommand::expand(text); const QString expected = text.replace('$' + env, value); QCOMPARE(result, expected);