Port to KF5/Qt5

TerminalDisplayAccessible is disabled for Qt5 currently since I don't
have any experience with accessible stuff and it is more complicated
than just changing a few includes

REVIEW: 111937
This commit is contained in:
Alex Richardson
2013-08-20 23:34:35 +02:00
parent 205a51839c
commit a83db71590
33 changed files with 184 additions and 120 deletions

View File

@@ -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)

View File

@@ -31,6 +31,8 @@
#include <KShell>
#include <KBookmarkMenu>
#include <KStandardDirs>
#include <KLocalizedString>
#include <KMenu>
// 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),

View File

@@ -26,11 +26,13 @@
// KDE
#include <KBookmarkManager>
#include <KUrl>
// 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<KUrl>& urls);
void openUrls(const QList<QUrl>& 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;

View File

@@ -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})

View File

@@ -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()));

View File

@@ -29,6 +29,9 @@
#include <KWindowSystem>
#include <KFileDialog>
#include <KUrlCompletion>
#include <KIcon>
#include <KUrl>
#include <KLocalizedString>
// 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"));

View File

@@ -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;
}

View File

@@ -48,6 +48,7 @@
#include <KWindowSystem>
#include <KTextEdit>
#include <KMessageBox>
#include <KUrl>
// 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<KFontDialog> 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

View File

@@ -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());
}
}

View File

@@ -30,6 +30,7 @@
// KDE
#include <KLocalizedString>
#include <KRun>
#include <KUrl>
// 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());
}
}

View File

@@ -22,6 +22,8 @@
// Qt
#include <QtGui/QKeyEvent>
// KDE
#include <KIcon>
// Konsole
#include "ui_KeyBindingEditor.h"

View File

@@ -90,7 +90,7 @@ KeyboardTranslatorReader::KeyboardTranslatorReader(QIODevice* source)
while (_description.isEmpty() && !source->atEnd()) {
QList<Token> 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();

View File

@@ -25,6 +25,7 @@
// Qt
#include <QtCore/QHash>
#include <QtCore/QList>
#include <QtCore/QString>
//#include <QtGui/QKeySequence>
#include <QtCore/QMetaType>

View File

@@ -28,6 +28,7 @@
// KDE
#include <KDebug>
#include <KGlobal>
#include <KStandardDirs>
using namespace Konsole;

View File

@@ -31,6 +31,7 @@
#include <KCmdLineArgs>
#include <KShortcutsDialog>
#include <KLocale>
#include <KMenu>
#include <KMenuBar>
#include <KMessageBox>
@@ -42,6 +43,8 @@
#include <KNotifyConfigWidget>
#include <KConfigDialog>
#include <KApplication>
#include <KGlobal>
#include <KShortcut>
// 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<KUrl>)), this, SLOT(openUrls(QList<KUrl>)));
connect(_bookmarkHandler, SIGNAL(openUrls(QList<QUrl>)), this, SLOT(openUrls(QList<QUrl>)));
// Settings Menu
_toggleMenuBarAction = KStandardAction::showMenubar(menuBar(), SLOT(setVisible(bool)), collection);
@@ -373,7 +383,8 @@ void MainWindow::profileListChanged(const QList<QAction*>& 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<QAction*>& 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<KUrl>& urls)
void MainWindow::openUrls(const QList<QUrl>& urls)
{
Profile::Ptr defaultProfile = ProfileManager::instance()->defaultProfile();

View File

@@ -163,8 +163,7 @@ private slots:
void updateWindowIcon();
void updateWindowCaption();
void openUrls(const QList<KUrl>& urls);
void openUrls(const QList<QUrl>& urls);
// Sets the list of profiles to be displayed under the "New Tab" action
void setProfileList(ProfileList* list);

View File

@@ -30,6 +30,9 @@
#include <KActionCollection>
#include <KLocale>
#include <KPluginFactory>
#include <KUrl>
#include <KGlobal>
#include <KLocalizedString>
#include <kde_file.h>
// 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;

View File

@@ -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();

View File

@@ -23,6 +23,7 @@
// KDE
#include <KConfigGroup>
#include <KSharedConfig>
#include <KGlobal>
using namespace Konsole;

View File

@@ -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()));

View File

@@ -50,8 +50,10 @@
#include <KDebug>
#include <KUriFilter>
#include <KStringHandler>
#include <KSharedConfig>
#include <KConfigGroup>
#include <KGlobal>
#include <KShortcut>
#include <kdeversion.h>
#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*> 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<QKeySequence> 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<QKeySequence> 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<KSelectAction>("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();

View File

@@ -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<SessionController*> _allControllers;
static int _lastControllerId;
static const KIcon _activityIcon;
static const KIcon _silenceIcon;
static const KIcon _broadcastIcon;
QStringList _bookmarkValidProgramsToClear;

View File

@@ -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);

View File

@@ -41,6 +41,7 @@
#include <QStyle>
#include <QtCore/QTimer>
#include <QToolTip>
#include <QDrag>
#include <QtGui/QAccessible>
// 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<const QAction*>(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<const QAction*>(sender());
if (action) {
emit sendStringToEmu(action->data().toString().toLocal8Bit());
emit sendStringToEmu(action->data().toString().toLocal8Bit().constData());
}
}
}

View File

@@ -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<TerminalDisplay*>(object());
}
#else
#pragma message("This code needs proper porting to Qt5")
#endif

View File

@@ -22,6 +22,10 @@
#ifndef TERMINALDISPLAYACCESSIBLE_H
#define TERMINALDISPLAYACCESSIBLE_H
#include <QtGlobal>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <QtGui/qaccessible.h>
#include <QtGui/qaccessible2.h>
#include <qaccessiblewidget.h>
@@ -89,5 +93,8 @@ private:
} // namespace
#else
#pragma message("The accessibility code needs proper porting to Qt5")
#endif
#endif // TERMINALDISPLAYACCESSIBLE_H

View File

@@ -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

View File

@@ -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);

View File

@@ -25,16 +25,18 @@
#include <kde_file.h>
// KDE
#include <KAboutData>
#include <k4aboutdata.h>
#include <KCmdLineArgs>
#include <KLocale>
#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", "<application>Konsole</application>"),
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");

View File

@@ -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)

View File

@@ -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!";

View File

@@ -65,7 +65,7 @@ void PartTest::testFd()
}
if (pingExe.isEmpty()) {
QSKIP("ping command not found.", SkipSingle);
QSKIP("ping command not found.");
return;
}

View File

@@ -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);