[-]
[+]
|
Changed |
_service:tar_git:kate.spec
|
|
[-]
[+]
|
Deleted |
_service:tar_git:kate-5.0.0+master.4.68d70d7.tar.xz/upstream/addons/filetree/metatype_qlist_ktexteditor_document_pointer.h
^
|
@@ -1,25 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2010 Thomas Fjellstrom <thomas@fjellstrom.ca>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef METATYPE_QLIST_KTEXTEDITOR_DOCUMENT_POINTER_H
-#define METATYPE_QLIST_KTEXTEDITOR_DOCUMENT_POINTER_H
-
-Q_DECLARE_METATYPE(QList<KTextEditor::Document*>)
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:kate-5.0.0+master.4.68d70d7.tar.xz/upstream/addons/sessionapplet/katesessionConfig.ui
^
|
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>KateSessionConfig</class>
- <widget class="QWidget" name="KateSessionConfig">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>553</width>
- <height>333</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QListWidget" name="itemList">
- <property name="selectionMode">
- <enum>QAbstractItemView::ExtendedSelection</enum>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
|
[-]
[+]
|
Deleted |
_service:tar_git:kate-5.0.0+master.4.68d70d7.tar.xz/upstream/addons/sessionapplet/katesessionapplet.cpp
^
|
@@ -1,260 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- ***************************************************************************/
-
-#include "katesessionapplet.h"
-#include <QStyleOptionGraphicsItem>
-#include <QTreeView>
-#include <QVBoxLayout>
-#include <QGraphicsGridLayout>
-#include <KStandardDirs>
-#include <KIconLoader>
-#include <KInputDialog>
-#include <KMessageBox>
-#include <KStandardGuiItem>
-#include <QGraphicsProxyWidget>
-#include <QListWidgetItem>
-#include <QStandardItemModel>
-#include <KIcon>
-#include <KToolInvocation>
-#include <KDirWatch>
-#include <QGraphicsLinearLayout>
-#include <KGlobalSettings>
-#include <KUrl>
-#include <KStringHandler>
-#include <QFile>
-#include <KConfigDialog>
-
-
-bool katesessions_compare_sessions(const QString &s1, const QString &s2) {
- return KStringHandler::naturalCompare(s1,s2)==-1;
-}
-
-
-KateSessionApplet::KateSessionApplet(QObject *parent, const QVariantList &args)
- : Plasma::PopupApplet(parent, args), m_listView( 0 ), m_config(0)
-{
- KDirWatch *dirwatch = new KDirWatch( this );
- QStringList lst = KGlobal::dirs()->findDirs( "data", "kate/sessions/" );
- for ( int i = 0; i < lst.count(); i++ )
- {
- dirwatch->addDir( lst[i] );
- }
- connect( dirwatch, SIGNAL(dirty(QString)), this, SLOT(slotUpdateSessionMenu()) );
- setPopupIcon( "kate" );
- setHasConfigurationInterface(true);
- setAspectRatioMode(Plasma::IgnoreAspectRatio);
-}
-
-KateSessionApplet::~KateSessionApplet()
-{
- delete m_listView;
-}
-
-QWidget *KateSessionApplet::widget()
-{
- if ( !m_listView )
- {
- m_listView= new QTreeView();
- m_listView->setAttribute(Qt::WA_NoSystemBackground);
- m_listView->setEditTriggers( QAbstractItemView::NoEditTriggers );
- m_listView->setRootIsDecorated(false);
- m_listView->setHeaderHidden(true);
- m_listView->setMouseTracking(true);
-
- m_kateModel = new QStandardItemModel(this);
- m_listView->setModel(m_kateModel);
- m_listView->setMouseTracking(true);
-
- initSessionFiles();
-
- connect(m_listView, SIGNAL(activated(QModelIndex)),
- this, SLOT(slotOnItemClicked(QModelIndex)));
- }
- return m_listView;
-}
-
-
-void KateSessionApplet::slotUpdateSessionMenu()
-{
- m_kateModel->clear();
- m_sessions.clear();
- m_fullList.clear();
- initSessionFiles();
-}
-
-void KateSessionApplet::initSessionFiles()
-{
- // Obtain list of items previously configured as hidden
- const QStringList hideList = config().readEntry("hideList", QStringList());
-
- // Construct a full list of items (m_fullList) so we can display them
- // in the config dialog, but leave out the hidden stuff for m_kateModel
- // that is actually displayed
- int index=0;
- QStandardItem *item = new QStandardItem();
- item->setData(i18n("Start Kate (no arguments)"), Qt::DisplayRole);
- item->setData( KIcon( "kate" ), Qt::DecorationRole );
- item->setData( index++, Index );
- m_fullList << item->data(Qt::DisplayRole).toString();
- if (!hideList.contains(item->data(Qt::DisplayRole).toString())) {
- m_kateModel->appendRow(item);
- }
-
- item = new QStandardItem();
- item->setData( i18n("New Kate Session"), Qt::DisplayRole);
- item->setData( KIcon( "document-new" ), Qt::DecorationRole );
- item->setData( index++, Index );
- m_fullList << item->data(Qt::DisplayRole).toString();
- if (!hideList.contains(item->data(Qt::DisplayRole).toString())) {
- m_kateModel->appendRow(item);
- }
-
- item = new QStandardItem();
- item->setData( i18n("New Anonymous Session"), Qt::DisplayRole);
- item->setData( index++, Index );
- item->setData( KIcon( "document-new" ), Qt::DecorationRole );
- m_fullList << item->data(Qt::DisplayRole).toString();
- if (!hideList.contains(item->data(Qt::DisplayRole).toString())) {
- m_kateModel->appendRow(item);
- }
-
- const QStringList list = KGlobal::dirs()->findAllResources( "data", "kate/sessions/*.katesession", KStandardDirs::NoDuplicates );
- KUrl url;
- for (QStringList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it)
- {
- url.setPath(*it);
- QString name=url.fileName();
- name = QUrl::fromPercentEncoding(QFile::encodeName(url.fileName()));
- name.chop(12);///.katesession==12
-/* KConfig _config( *it, KConfig::SimpleConfig );
- KConfigGroup config(&_config, "General" );
- QString name = config.readEntry( "Name" );*/
- m_sessions.append( name );
- }
- qSort(m_sessions.begin(),m_sessions.end(),katesessions_compare_sessions);
- for(QStringList::ConstIterator it=m_sessions.constBegin();it!=m_sessions.constEnd();++it)
- {
- m_fullList << *it;
- if (!hideList.contains(*it)) {
- item = new QStandardItem();
- item->setData(*it, Qt::DisplayRole);
- item->setData( index++, Index );
- m_kateModel->appendRow( item);
- }
- }
-}
-
-void KateSessionApplet::slotOnItemClicked(const QModelIndex &index)
-{
- hidePopup();
- int id = index.data(Index).toInt();
- QStringList args;
-
- // If a new session is requested we try to ask for a name.
- if ( id == 1 )
- {
- bool ok = false;
- QString name = KInputDialog::getText( i18n("Session Name"),
- i18n("Please enter a name for the new session"),
- QString(),
- &ok );
- if ( ! ok )
- return;
-
- if ( name.isEmpty() && KMessageBox::questionYesNo( 0,
- i18n("An unnamed session will not be saved automatically. "
- "Do you want to create such a session?"),
- i18n("Create anonymous session?"),
- KStandardGuiItem::yes(), KStandardGuiItem::cancel(),
- "kate_session_button_create_anonymous" ) == KMessageBox::No )
- return;
-
- if ( m_sessions.contains( name ) &&
- KMessageBox::warningYesNo( 0,
- i18n("You already have a session named %1. Do you want to open that session?", name ),
- i18n("Session exists") ) == KMessageBox::No )
- return;
- if (name.isEmpty())
- args <<"-startanon";
- else
- args <<"-n"<<"--start"<< name;
- }
-
- else if ( id == 2 )
|
[-]
[+]
|
Deleted |
_service:tar_git:kate-5.0.0+master.4.68d70d7.tar.xz/upstream/addons/sessionapplet/katesessionapplet.h
^
|
@@ -1,77 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- ***************************************************************************/
-
-#ifndef _KATESESSIONAPPLET_H_
-#define _KATESESSIONAPPLET_H_
-
-#include <plasma/popupapplet.h>
-
-#include "ui_katesessionConfig.h"
-
-class QTreeView;
-class QGraphicsProxyWidget;
-class QStandardItemModel;
-class QModelIndex;
-class KConfigDialog;
-class QStringList;
-class KateSessionConfigInterface : public QWidget {
- // Wrapper widget class for the configuration interface.
- Q_OBJECT
-public:
- KateSessionConfigInterface(const QStringList& all, const QStringList& hidden);
- QStringList hideList() const;
-private:
- QStringList m_all;
- Ui::KateSessionConfig m_config;
-};
-
-
-class KateSessionApplet : public Plasma::PopupApplet
-{
- Q_OBJECT
-public:
- KateSessionApplet(QObject *parent, const QVariantList &args);
- ~KateSessionApplet();
-
- QWidget *widget();
-
- enum SpecificRoles {
- Index = Qt::UserRole+1
- };
-
-protected Q_SLOTS:
- void slotOnItemClicked(const QModelIndex &index);
- void slotUpdateSessionMenu();
- void slotSaveConfig();
-
-protected:
- void initSessionFiles();
- void createConfigurationInterface(KConfigDialog *parent);
- void configChanged();
-private:
- QTreeView *m_listView;
- QStandardItemModel *m_kateModel;
- QStringList m_sessions;
- QStringList m_fullList;
- KateSessionConfigInterface *m_config;
-};
-
-K_EXPORT_PLASMA_APPLET(katesession, KateSessionApplet )
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:kate-5.0.0+master.4.68d70d7.tar.xz/upstream/addons/sessionapplet/plasma-applet-katesession.desktop
^
|
@@ -1,124 +0,0 @@
-[Desktop Entry]
-Name=Kate Session Applet
-Name[ast]=Miniaplicación de sesiones de Kate
-Name[bg]=Сесии на Kate
-Name[bs]=Programčić Kate sesije
-Name[ca]=Miniaplicació de sessió del Kate
-Name[ca@valencia]=Miniaplicació de sessió del Kate
-Name[cs]=Applet sezení Kate
-Name[da]=Panelprogram til Kate-session
-Name[de]=Kate-Sitzungsverwaltung
-Name[el]=Μικροεφαρμογή συνεδρίας Kate
-Name[en_GB]=Kate Session Applet
-Name[es]=Miniaplicación de sesiones de Kate
-Name[et]=Kate seansi aplett
-Name[eu]=Kate saioaren miniaplikazioa
-Name[fi]=Kate-istuntosovelma
-Name[fr]=Applet de sessions pour Kate
-Name[ga]=Feidhmchláirín Seisiúin Kate
-Name[gl]=Applet de sesións de Kate
-Name[he]=יישומון הפעלות של Kate
-Name[hu]=Kate munkamenet-menü
-Name[ia]=Applet de session de Kate
-Name[it]=Applet di sessioni di Kate
-Name[ja]=Kate セッションアプレット
-Name[kk]=Kate сеанс апплеті
-Name[km]=អាប់ភ្លេតសម័យ Kate
-Name[ko]=Kate 세션 애플릿
-Name[lt]=Kate sesijų programėlė
-Name[lv]=Kate sesiju sīklietotne
-Name[mr]=केट सत्र एप्लेट
-Name[nb]=Kate øktvelger
-Name[nds]=Kate-Törnlüttprogramm
-Name[nl]=Kate sessieapplet
-Name[nn]=Kate-øktveljar
-Name[pa]=ਕੇਟ ਸ਼ੈਸ਼ਨ ਐਪਲਿਟ
-Name[pl]=Aplet sesji Kate
-Name[pt]='Applet' de Sessões do Kate
-Name[pt_BR]=Miniaplicativo de sessões do Kate
-Name[ro]=Miniaplicație de sesiune Kate
-Name[ru]=Kate: сеансы
-Name[si]=Kate වාර ඇප්ලටය
-Name[sk]=Applet Kate sedenia
-Name[sl]=Aplet sej za Kate
-Name[sr]=Кејтине сесије
-Name[sr@ijekavian]=Кејтине сесије
-Name[sr@ijekavianlatin]=Kateine sesije
-Name[sr@latin]=Kateine sesije
-Name[sv]=Kate sessionsminiprogram
-Name[tg]=Барномаи мониторинги Кейт
-Name[tr]=Kate Oturum Programcığı
-Name[ug]=Kate ئەڭگىمە قوللانچاق
-Name[uk]=Аплет сеансів Kate
-Name[x-test]=xxKate Session Appletxx
-Name[zh_CN]=Kate 会话小程序
-Name[zh_TW]=Kate 工作階段小程式
-Comment=Kate Session Launcher
-Comment[ast]=Llanzador de sesiones de Kate
-Comment[bg]=Зареждане на сесии на Kate
-Comment[bs]=Pokretač Kate sesija
-Comment[ca]=Llançador de la sessió del Kate
-Comment[ca@valencia]=Llançador de sessió del Kate
-Comment[cs]=Spouštěč sezení Kate
-Comment[da]=Kate sessionstarter
-Comment[de]=Kate-Sitzung starten
-Comment[el]=Εκτελεστής συνεδρίας Kate
-Comment[en_GB]=Kate Session Launcher
-Comment[es]=Lanzador de sesiones de Kate
-Comment[et]=Kate seansi käivitaja
-Comment[eu]=Kate saioaren abiarazlea
-Comment[fi]=Kate-istunnonkäynnistin
-Comment[fr]=Lanceur de sessions pour Kate
-Comment[ga]=Tosaitheoir Seisiúin Kate
-Comment[gl]=Iniciador de sesións de Kate
-Comment[he]=מפעיל הפעלות של Kate
-Comment[hu]=Kate munkamenet-indító
-Comment[ia]=Lanceator de session de Kate
-Comment[is]=Kate seturæsir
-Comment[it]=Avviatore di sessioni di Kate
-Comment[ja]=Kate のセッションを開始します
-Comment[kk]=Kate сеанс жеккіші
-Comment[km]=កម្មវិធីចាប់ផ្ដើមសម័យ Kate
-Comment[ko]=Kate 세션 실행기
-Comment[lt]=Kate sesijų paleidiklis
-Comment[lv]=Kate sesiju palaidējs
-Comment[mr]=केट सत्र प्रक्षेपक
-Comment[nb]=Kate øktstarter
-Comment[nds]=Kate-Törnstarter
-Comment[nl]=Kate sessiestarter
-Comment[nn]=Start Kate-økter
-Comment[pa]=ਕੇਟ ਸ਼ੈਸ਼ਨ ਲਾਂਚਰ
-Comment[pl]=Program uruchamiający sesję Kate
-Comment[pt]=Lançador de Sessões do Kate
-Comment[pt_BR]=Lançamento de sessões do Kate
-Comment[ro]=Lansator de sesiuni Kate
-Comment[ru]=Программа запуска сеанса Kate
-Comment[si]=Kate වාර ආරම්භකය
-Comment[sk]=Spúšťač Kate sedenia
-Comment[sl]=Zaganjalnik sej za Kate
-Comment[sr]=Покретач Кејтиних сесија
-Comment[sr@ijekavian]=Покретач Кејтиних сесија
-Comment[sr@ijekavianlatin]=Pokretač Kateinih sesija
-Comment[sr@latin]=Pokretač Kateinih sesija
-Comment[sv]=Kate sessionsstart
-Comment[tg]=Оғозкунандаи мониторинги Кейт
-Comment[tr]=Kate Oturum Başlatıcı
-Comment[ug]=Kate ئەڭگىمە قوزغاتقۇچ
-Comment[uk]=Запуск сеансів Kate
-Comment[x-test]=xxKate Session Launcherxx
-Comment[zh_CN]=Kate 会话启动器
-Comment[zh_TW]=Kate 工作階段啟動器
-Type=Service
-Icon=kate
-X-KDE-ServiceTypes=Plasma/Applet
-
-X-KDE-Library=plasma_applet_katesession
-X-KDE-PluginInfo-Author=Montel Laurent
-X-KDE-PluginInfo-Email=montel@kde.org
-X-KDE-PluginInfo-Name=katesession
-X-KDE-PluginInfo-Version=pre0.1
-X-KDE-PluginInfo-Category=Utilities
-X-KDE-PluginInfo-Depends=
-X-KDE-PluginInfo-License=GPL
-X-KDE-PluginInfo-EnabledByDefault=true
-
|
[-]
[+]
|
Deleted |
_service:tar_git:kate-5.0.0+master.4.68d70d7.tar.xz/upstream/addons/snippets/snippetfilterproxymodel.cpp
^
|
@@ -1,96 +0,0 @@
-/* This file is part of the Kate project.
- * Based on the snippet plugin from KDevelop 4.
- *
- * Copyright (C) 2007 Robert Gruber <rgruber@users.sourceforge.net>
- * Copyright (C) 2012 Christoph Cullmann <cullmann@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include "snippetfilterproxymodel.h"
-
-#include "snippetstore.h"
-#include "snippet.h"
-
-SnippetFilterProxyModel::SnippetFilterProxyModel(QObject *parent)
- : QSortFilterProxyModel(parent)
-{
- connect(SnippetStore::self(),
- SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- this,
- SLOT(dataChanged(QModelIndex,QModelIndex)));
-}
-
-
-SnippetFilterProxyModel::~SnippetFilterProxyModel()
-{
-}
-
-QVariant SnippetFilterProxyModel::data(const QModelIndex& index, int role) const
-{
- if (role == Qt::DisplayRole && index.parent().isValid()) {
- // in the view, also show prefix, postfix and arguments
- Snippet* snippet = dynamic_cast<Snippet*>( SnippetStore::self()->itemFromIndex(mapToSource(index)) );
- if (snippet) {
- QString ret = snippet->prefix() + QLatin1Char(' ') + snippet->text() + snippet->arguments() + QLatin1Char(' ') + snippet->postfix();
- return ret.trimmed();
- }
- }
- return QSortFilterProxyModel::data(index, role);
-}
-
-void SnippetFilterProxyModel::changeFilter(const QString& filter)
-{
- filter_ = filter;
- clear();
-}
-
-bool SnippetFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const
-{
- if (filter_.isEmpty()) {
- // No filtering needed...
- return true;
- }
-
- QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
-
- QStandardItem* item = SnippetStore::self()->itemFromIndex( index );
- if (!item)
- return false;
-
- Snippet* snippet = dynamic_cast<Snippet*>( item );
- if (snippet) {
- if ( snippet->text().contains( filter_) )
- return true;
- else
- return false;
- }
-
- // if it's not a snippet; allow it...
- return true;
-}
-
-void SnippetFilterProxyModel::dataChanged(const QModelIndex& /*topLeft*/, const QModelIndex& /*bottomRight*/)
-{
- // If we don't do this, the model will contain strange QModelIndex elements after a
- // sync of a repository. Stangely this only happens on Linux. When running under Windows
- // everything's ok, evan without this hack.
- // By letting the proxy reevaluate the items, these elements will be removed.
-
- ///@todo check if this is OK
- clear();
-}
-
-#include "snippetfilterproxymodel.moc"
|
[-]
[+]
|
Deleted |
_service:tar_git:kate-5.0.0+master.4.68d70d7.tar.xz/upstream/addons/snippets/snippetfilterproxymodel.h
^
|
@@ -1,52 +0,0 @@
-/* This file is part of the Kate project.
- * Based on the snippet plugin from KDevelop 4.
- *
- * Copyright (C) 2007 Robert Gruber <rgruber@users.sourceforge.net>
- * Copyright (C) 2012 Christoph Cullmann <cullmann@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#ifndef __SNIPPETFILTERPROXYMODEL_H__
-#define __SNIPPETFILTERPROXYMODEL_H__
-
-#include <QSortFilterProxyModel>
-
-/**
- * @author Robert Gruber <rgruber@users.sourceforge.net>
- */
-class SnippetFilterProxyModel : public QSortFilterProxyModel {
- Q_OBJECT
-
-public:
- SnippetFilterProxyModel(QObject *parent);
- ~SnippetFilterProxyModel();
-
- virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
-
-public Q_SLOTS:
- void changeFilter(const QString& filter);
-
-private Q_SLOTS:
- void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
-
-private:
- bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
-
- QString filter_;
-};
-
-#endif
-
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/.gitignore
^
|
@@ -5,7 +5,6 @@
*.out
# kate
-.kateproject.d
*~
*-swp
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/CMakeLists.txt
^
|
@@ -12,7 +12,7 @@
set (KATE_VERSION ${KATE_VERSION_MAJOR}.${KATE_VERSION_MINOR}.${KATE_VERSION_MICRO})
# we need some parts of the ECM CMake helpers
-find_package (ECM 0.0.9 REQUIRED NO_MODULE)
+find_package (ECM 1.1.0 REQUIRED NO_MODULE)
set (CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
include(ECMOptionalAddSubdirectory)
include(ECMInstallIcons)
@@ -77,3 +77,5 @@
# docs
ecm_optional_add_subdirectory (doc)
+
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/CMakeLists.txt
^
|
@@ -1,3 +1,30 @@
+# detect aditional frameworks
+find_package(KF5 OPTIONAL_COMPONENTS Wallet Plasma Service ItemModels Notifications)
+
+set_package_properties(KF5Wallet PROPERTIES PURPOSE "Required to build the katesql addon")
+set_package_properties(KF5Plasma PROPERTIES PURPOSE "Required to build the sessionapplet addon")
+set_package_properties(KF5Service PROPERTIES PURPOSE "Required to build the sessionapplet addon")
+set_package_properties(KF5ItemModels PROPERTIES PURPOSE "Required to build the project, konsole addon")
+set_package_properties(KF5Notifications PROPERTIES PURPOSE "Required to build the katebuild, close-except-like addon")
+
+if (NOT(KF5Plasma_FOUND AND KF5Service_FOUND))
+ set(BUILD_sessionapplet OFF)
+endif()
+
+if(NOT(KF5ItemModels_FOUND))
+ set(BUILD_project OFF)
+ set(BUILD_konsole OFF)
+endif()
+
+if(NOT(KF5Wallet_FOUND))
+ set(BUILD_katesql OFF)
+endif()
+
+if(NOT(KF5Notifications_FOUND))
+ set(BUILD_katebuild-plugin OFF)
+ set(BUILD_close-except-like OFF)
+endif()
+
# document switcher
ecm_optional_add_subdirectory (filetree)
@@ -10,8 +37,11 @@
# terminal tool view
ecm_optional_add_subdirectory (konsole)
-# snippets => disabled in KF 5.0, we need to have a improved template interface
-#ecm_optional_add_subdirectory (snippets)
+# ALT+Tab like tab switcher
+ecm_optional_add_subdirectory (tabswitcher)
+
+# snippets
+ecm_optional_add_subdirectory (snippets)
# ctags
ecm_optional_add_subdirectory (kate-ctags)
@@ -52,6 +82,6 @@
#add_subdirectory( xmlcheck )
-#add_subdirectory( sessionapplet )
+ecm_optional_add_subdirectory(sessionapplet)
#macro_optional_add_subdirectory(pate)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/backtracebrowser/CMakeLists.txt
^
|
@@ -21,9 +21,8 @@
)
########### install files ###############
-install( TARGETS katebacktracebrowserplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
-kservice_desktop_to_json (katebacktracebrowserplugin katebacktracebrowserplugin.desktop)
-install( FILES katebacktracebrowserplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+install( TARGETS katebacktracebrowserplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
+kcoreaddons_desktop_to_json (katebacktracebrowserplugin katebacktracebrowserplugin.desktop)
############# unit tests ################
ecm_optional_add_subdirectory (autotests)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/close-except-like/CMakeLists.txt
^
|
@@ -7,8 +7,6 @@
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
-find_package(KF5 REQUIRED COMPONENTS Parts TextEditor XmlGui Notifications)
-
set(KATE_CLOSE_EXCEPT_PLUGIN_SOURCES
close_confirm_dialog.cpp
close_except_plugin.cpp
@@ -31,8 +29,7 @@
configure_file(config.h.in config.h)
-install(TARGETS katecloseexceptplugin DESTINATION ${PLUGIN_INSTALL_DIR})
+install(TARGETS katecloseexceptplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
-kservice_desktop_to_json(katecloseexceptplugin katecloseexceptplugin.desktop)
+kcoreaddons_desktop_to_json(katecloseexceptplugin katecloseexceptplugin.desktop)
install(FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}//katecloseexceptplugin)
-install(FILES katecloseexceptplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filebrowser/CMakeLists.txt
^
|
@@ -13,11 +13,9 @@
target_link_libraries(katefilebrowserplugin KF5::TextEditor KF5::KIOCore KF5::KIOFileWidgets KF5::KIOWidgets KF5::I18n)
-install(TARGETS katefilebrowserplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katefilebrowserplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
########### install files ###############
-kservice_desktop_to_json (katefilebrowserplugin katefilebrowserplugin.desktop)
-install( FILES katefilebrowserplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-
+kcoreaddons_desktop_to_json (katefilebrowserplugin katefilebrowserplugin.desktop)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filebrowser/katefilebrowser.cpp
^
|
@@ -44,9 +44,7 @@
#include <QAbstractItemView>
#include <QAction>
#include <QDir>
-#include <QLabel>
#include <QLineEdit>
-#include <QToolButton>
#include <QVBoxLayout>
//END Includes
@@ -96,17 +94,11 @@
setupActions();
setupToolbar();
- QHBoxLayout *filterBox = new QHBoxLayout(this);
- filterBox->setMargin(0);
- mainLayout->addLayout(filterBox);
-
- QLabel* filterLabel = new QLabel(i18n("Filter:"), this);
- filterBox->addWidget(filterLabel);
m_filter = new KHistoryComboBox(true, this);
- filterLabel->setBuddy(m_filter);
m_filter->setMaxCount(10);
m_filter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
- filterBox->addWidget(m_filter);
+ m_filter->lineEdit()->setPlaceholderText(i18n("Search"));
+ mainLayout->addWidget(m_filter);
connect(m_filter, SIGNAL(editTextChanged(QString)),
SLOT(slotFilterChange(QString)));
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filebrowser/katefilebrowserconfig.cpp
^
|
@@ -22,19 +22,22 @@
#include "katefilebrowserconfig.h"
#include "katefilebrowserconfig.moc"
+#include "katefilebrowser.h"
+
+#include <QAction>
+#include <QApplication>
#include <QGroupBox>
#include <QListWidget>
#include <QRegExp>
-#include <QToolButton>
-#include <QVBoxLayout>
-#include <QApplication>
#include <QStyle>
+#include <QVBoxLayout>
#include <KActionCollection>
-#include <KLocalizedString>
+#include <KActionSelector>
+#include <KConfigGroup>
#include <KDirOperator>
+#include <KLocalizedString>
#include <KSharedConfig>
-#include <KConfigGroup>
//BEGIN ACtionLBItem
/*
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filebrowser/katefilebrowserconfig.h
^
|
@@ -23,11 +23,10 @@
#ifndef KATE_FILEBROWSER_CONFIG_H
#define KATE_FILEBROWSER_CONFIG_H
-#include <KActionSelector>
-
#include <ktexteditor/configpage.h>
-#include "katefilebrowser.h"
+class KateFileBrowser;
+class KActionSelector;
class KateFileBrowserConfigPage : public KTextEditor::ConfigPage
{
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filebrowser/katefilebrowserplugin.cpp
^
|
@@ -25,14 +25,11 @@
#include "katefilebrowserconfig.h"
#include "katefilebrowser.h"
-#include <ktexteditor/mainwindow.h>
-#include <ktexteditor/view.h>
-
-#include <kaboutdata.h>
#include <KLocalizedString>
#include <KPluginFactory>
#include <QKeyEvent>
+#include <QIcon>
//END Includes
K_PLUGIN_FACTORY_WITH_JSON (KateFileBrowserPluginFactory, "katefilebrowserplugin.json", registerPlugin<KateFileBrowserPlugin>();)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filebrowser/katefilebrowserplugin.h
^
|
@@ -29,20 +29,6 @@
#include <ktexteditor/configpage.h>
#include <KTextEditor/SessionConfigInterface>
-#include <kurlcombobox.h>
-#include <KFile>
-
-class KActionCollection;
-class KActionSelector;
-class KDirOperator;
-class KFileItem;
-class KHistoryComboBox;
-class KToolBar;
-
-class QToolButton;
-class QCheckBox;
-class QSpinBox;
-
class KateFileBrowser;
class KateFileBrowserPluginView;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetemplates/plugin/CMakeLists.txt
^
|
@@ -6,11 +6,10 @@
target_link_libraries(katefiletemplates kateinterfaces ktexteditor )
-install(TARGETS katefiletemplates DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katefiletemplates DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
########### install files ###############
install( FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kate/plugins/katefiletemplates )
install( FILES katetemplate.xml DESTINATION ${DATA_INSTALL_DIR}/katepart5/syntax )
-install( FILES katefiletemplates.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetemplates/plugin/filetemplates.cpp
^
|
@@ -66,7 +66,6 @@
#include <stdlib.h>
-#include <ktexteditor/templateinterface.h>
#include <krecentfilesaction.h>
#include <kpluginfactory.h>
@@ -463,8 +462,8 @@
delete m_emailstuff;
m_emailstuff = 0;
if (isTemplate) {
- KTextEditor::TemplateInterface *ti=qobject_cast<KTextEditor::TemplateInterface*>(doc->activeView());
- ti->insertTemplateText(KTextEditor::Cursor(0,0),str,QMap<QString,QString>());
+ auto ti = static_cast<KTextEditor::TemplateInterface*>(doc->activeView());
+ ti->insertTemplate({0, 0}, str);
} else {
doc->insertText( KTextEditor::Cursor(0, 0), str );
view->setCursorPosition(KTextEditor::Cursor(line, col));
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/CMakeLists.txt
^
|
@@ -19,10 +19,9 @@
add_library (katefiletreeplugin MODULE ${katefiletreeplugin_PART_SRCS})
target_link_libraries(katefiletreeplugin katefiletree)
-install(TARGETS katefiletreeplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katefiletreeplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
-kservice_desktop_to_json (katefiletreeplugin katefiletreeplugin.desktop)
-install( FILES katefiletreeplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+kcoreaddons_desktop_to_json (katefiletreeplugin katefiletreeplugin.desktop)
########### install files ###############
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletree.cpp
^
|
@@ -1,5 +1,6 @@
/* This file is part of the KDE project
Copyright (C) 2010 Thomas Fjellstrom <thomas@fjellstrom.ca>
+ Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -35,84 +36,90 @@
#include <KLocalizedString>
#include <KStandardAction>
#include <KIO/DeleteJob>
+#include <KIO/CopyJob>
#include <QMimeDatabase>
#include <QClipboard>
#include <QContextMenuEvent>
#include <QApplication>
#include <QMenu>
+#include <QInputDialog>
+#include <QLineEdit>
+#include <QDir>
//END Includes
-
//BEGIN KateFileTree
KateFileTree::KateFileTree(QWidget *parent): QTreeView(parent)
{
- setAcceptDrops(false);
- setIndentation(12);
- setAllColumnsShowFocus(true);
+ setAcceptDrops(false);
+ setIndentation(12);
+ setAllColumnsShowFocus(true);
- connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(mouseClicked(QModelIndex)));
+ connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(mouseClicked(QModelIndex)));
- m_filelistReloadDocument = new QAction(QIcon::fromTheme(QLatin1String("view-refresh")), i18nc("@action:inmenu", "Reloa&d"), this);
- connect(m_filelistReloadDocument, SIGNAL(triggered(bool)), SLOT(slotDocumentReload()));
- m_filelistReloadDocument->setWhatsThis(i18n("Reload selected document(s) from disk."));
+ m_filelistReloadDocument = new QAction(QIcon::fromTheme(QLatin1String("view-refresh")), i18nc("@action:inmenu", "Reloa&d"), this);
+ connect(m_filelistReloadDocument, SIGNAL(triggered(bool)), SLOT(slotDocumentReload()));
+ m_filelistReloadDocument->setWhatsThis(i18n("Reload selected document(s) from disk."));
- m_filelistCloseDocument = new QAction( QIcon::fromTheme(QLatin1String("document-close")), i18nc("@action:inmenu", "Close"), this );
- connect( m_filelistCloseDocument, SIGNAL(triggered()), this, SLOT(slotDocumentClose()) );
- m_filelistCloseDocument->setWhatsThis(i18n("Close the current document."));
+ m_filelistCloseDocument = new QAction(QIcon::fromTheme(QLatin1String("document-close")), i18nc("@action:inmenu", "Close"), this);
+ connect(m_filelistCloseDocument, SIGNAL(triggered()), this, SLOT(slotDocumentClose()));
+ m_filelistCloseDocument->setWhatsThis(i18n("Close the current document."));
- m_filelistCloseOtherDocument = new QAction( QIcon::fromTheme(QLatin1String("window-close")), i18nc("@action:inmenu", "Close Other"), this );
- connect( m_filelistCloseOtherDocument, SIGNAL(triggered()), this, SLOT(slotDocumentCloseOther()) );
- m_filelistCloseOtherDocument->setWhatsThis(i18n("Close other documents in this folder."));
+ m_filelistCloseOtherDocument = new QAction(QIcon::fromTheme(QLatin1String("window-close")), i18nc("@action:inmenu", "Close Other"), this);
+ connect(m_filelistCloseOtherDocument, SIGNAL(triggered()), this, SLOT(slotDocumentCloseOther()));
+ m_filelistCloseOtherDocument->setWhatsThis(i18n("Close other documents in this folder."));
- m_filelistCopyFilename = new QAction( QIcon::fromTheme(QLatin1String("edit-copy")), i18nc("@action:inmenu", "Copy Filename"), this );
- connect( m_filelistCopyFilename, SIGNAL(triggered()), this, SLOT(slotCopyFilename()) );
- m_filelistCopyFilename->setWhatsThis(i18n("Copy the filename of the file."));
+ m_filelistCopyFilename = new QAction(QIcon::fromTheme(QLatin1String("edit-copy")), i18nc("@action:inmenu", "Copy Filename"), this);
+ connect(m_filelistCopyFilename, SIGNAL(triggered()), this, SLOT(slotCopyFilename()));
+ m_filelistCopyFilename->setWhatsThis(i18n("Copy the filename of the file."));
- m_filelistPrintDocument = KStandardAction::print(this, SLOT(slotPrintDocument()), this);
- m_filelistPrintDocument->setWhatsThis(i18n("Print selected document."));
+ m_filelistRenameFile = new QAction(QIcon::fromTheme(QLatin1String("edit-rename")), i18nc("@action:inmenu", "Rename File"), this);
+ connect(m_filelistRenameFile, &QAction::triggered, this, &KateFileTree::slotRenameFile);
+ m_filelistRenameFile->setWhatsThis(i18n("Rename the selected file."));
- m_filelistPrintDocumentPreview = KStandardAction::printPreview(this, SLOT(slotPrintDocumentPreview()), this);
- m_filelistPrintDocumentPreview->setWhatsThis(i18n("Show print preview of current document"));
+ m_filelistPrintDocument = KStandardAction::print(this, SLOT(slotPrintDocument()), this);
+ m_filelistPrintDocument->setWhatsThis(i18n("Print selected document."));
- m_filelistDeleteDocument = new QAction(QIcon::fromTheme(QLatin1String("edit-delete-shred")), i18nc("@action:inmenu", "Delete Document"), this);
- connect(m_filelistDeleteDocument, SIGNAL(triggered()), this, SLOT(slotDocumentDelete()));
- m_filelistDeleteDocument->setWhatsThis(i18n("Close and delete selected file from storage."));
+ m_filelistPrintDocumentPreview = KStandardAction::printPreview(this, SLOT(slotPrintDocumentPreview()), this);
+ m_filelistPrintDocumentPreview->setWhatsThis(i18n("Show print preview of current document"));
- QActionGroup *modeGroup = new QActionGroup(this);
+ m_filelistDeleteDocument = new QAction(QIcon::fromTheme(QLatin1String("edit-delete-shred")), i18nc("@action:inmenu", "Delete Document"), this);
+ connect(m_filelistDeleteDocument, SIGNAL(triggered()), this, SLOT(slotDocumentDelete()));
+ m_filelistDeleteDocument->setWhatsThis(i18n("Close and delete selected file from storage."));
- m_treeModeAction = setupOption(modeGroup, QIcon::fromTheme(QLatin1String("view-list-tree")), i18nc("@action:inmenu", "Tree Mode"),
- i18n("Set view style to Tree Mode"),
- SLOT(slotTreeMode()), true);
+ QActionGroup *modeGroup = new QActionGroup(this);
- m_listModeAction = setupOption(modeGroup, QIcon::fromTheme(QLatin1String("view-list-text")), i18nc("@action:inmenu", "List Mode"),
- i18n("Set view style to List Mode"),
- SLOT(slotListMode()), false);
+ m_treeModeAction = setupOption(modeGroup, QIcon::fromTheme(QLatin1String("view-list-tree")), i18nc("@action:inmenu", "Tree Mode"),
+ i18n("Set view style to Tree Mode"),
+ SLOT(slotTreeMode()), true);
- QActionGroup *sortGroup = new QActionGroup(this);
+ m_listModeAction = setupOption(modeGroup, QIcon::fromTheme(QLatin1String("view-list-text")), i18nc("@action:inmenu", "List Mode"),
+ i18n("Set view style to List Mode"),
+ SLOT(slotListMode()), false);
- m_sortByFile = setupOption(sortGroup, QIcon(), i18nc("@action:inmenu sorting option", "Document Name"),
- i18n("Sort by Document Name"),
- SLOT(slotSortName()), true);
+ QActionGroup *sortGroup = new QActionGroup(this);
+ m_sortByFile = setupOption(sortGroup, QIcon(), i18nc("@action:inmenu sorting option", "Document Name"),
+ i18n("Sort by Document Name"),
+ SLOT(slotSortName()), true);
- m_sortByPath = setupOption(sortGroup, QIcon(), i18nc("@action:inmenu sorting option", "Document Path"),
- i18n("Sort by Document Path"),
- SLOT(slotSortPath()), false);
+ m_sortByPath = setupOption(sortGroup, QIcon(), i18nc("@action:inmenu sorting option", "Document Path"),
+ i18n("Sort by Document Path"),
+ SLOT(slotSortPath()), false);
- m_sortByOpeningOrder = setupOption(sortGroup, QIcon(), i18nc("@action:inmenu sorting option", "Opening Order"),
- i18n("Sort by Opening Order"),
- SLOT(slotSortOpeningOrder()), false);
+ m_sortByOpeningOrder = setupOption(sortGroup, QIcon(), i18nc("@action:inmenu sorting option", "Opening Order"),
+ i18n("Sort by Opening Order"),
+ SLOT(slotSortOpeningOrder()), false);
- m_resetHistory = new QAction(QIcon::fromTheme(QLatin1String("edit-clear-history")), i18nc("@action:inmenu", "Clear History"), this);
- connect(m_resetHistory, SIGNAL(triggered()), this, SLOT(slotResetHistory()) );
- m_resetHistory->setWhatsThis(i18n("Clear edit/view history."));
+ m_resetHistory = new QAction(QIcon::fromTheme(QLatin1String("edit-clear-history")), i18nc("@action:inmenu", "Clear History"), this);
+ connect(m_resetHistory, SIGNAL(triggered()), this, SLOT(slotResetHistory()));
+ m_resetHistory->setWhatsThis(i18n("Clear edit/view history."));
- QPalette p = palette();
- p.setColor(QPalette::Inactive, QPalette::Highlight, p.color(QPalette::Active, QPalette::Highlight));
- p.setColor(QPalette::Inactive, QPalette::HighlightedText, p.color(QPalette::Active, QPalette::HighlightedText));
- setPalette(p);
+ QPalette p = palette();
+ p.setColor(QPalette::Inactive, QPalette::Highlight, p.color(QPalette::Active, QPalette::Highlight));
+ p.setColor(QPalette::Inactive, QPalette::HighlightedText, p.color(QPalette::Active, QPalette::HighlightedText));
+ setPalette(p);
}
KateFileTree::~KateFileTree()
@@ -120,476 +127,522 @@
void KateFileTree::setModel(QAbstractItemModel *model)
{
- Q_ASSERT(qobject_cast<KateFileTreeProxyModel*>(model)); // we dont' realy work with anything else
- QTreeView::setModel(model);
+ Q_ASSERT(qobject_cast<KateFileTreeProxyModel *>(model)); // we dont' realy work with anything else
+ QTreeView::setModel(model);
}
QAction *KateFileTree::setupOption(
- QActionGroup *group,
- const QIcon &icon,
- const QString &label,
- const QString &whatsThis,
- const char *slot,
- bool checked
+ QActionGroup *group,
+ const QIcon &icon,
+ const QString &label,
+ const QString &whatsThis,
+ const char *slot,
+ bool checked
)
{
- QAction *new_action = new QAction( icon, label, this );
- new_action->setWhatsThis(whatsThis);
- new_action->setActionGroup(group);
- new_action->setCheckable(true);
- new_action->setChecked(checked);
- connect( new_action, SIGNAL(triggered()), this, slot );
- return new_action;
+ QAction *new_action = new QAction(icon, label, this);
+ new_action->setWhatsThis(whatsThis);
+ new_action->setActionGroup(group);
+ new_action->setCheckable(true);
+ new_action->setChecked(checked);
+ connect(new_action, SIGNAL(triggered()), this, slot);
+ return new_action;
}
void KateFileTree::slotListMode()
{
- emit viewModeChanged(true);
+ emit viewModeChanged(true);
}
void KateFileTree::slotTreeMode()
{
- emit viewModeChanged(false);
+ emit viewModeChanged(false);
}
void KateFileTree::slotSortName()
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletree.h
^
|
@@ -24,8 +24,9 @@
#include <QIcon>
#include <QTreeView>
-namespace KTextEditor {
- class Document;
+namespace KTextEditor
+{
+class Document;
}
class QActionGroup;
@@ -34,19 +35,19 @@
{
Q_OBJECT
- public:
+public:
- KateFileTree(QWidget * parent);
+ KateFileTree(QWidget *parent);
virtual ~KateFileTree();
virtual void setModel(QAbstractItemModel *model);
- public Q_SLOTS:
+public Q_SLOTS:
void slotDocumentClose();
void slotDocumentCloseOther();
void slotDocumentReload();
void slotCopyFilename();
- void slotCurrentChanged( const QModelIndex ¤t, const QModelIndex &previous );
+ void slotCurrentChanged(const QModelIndex ¤t, const QModelIndex &previous);
void slotDocumentFirst();
void slotDocumentLast();
void slotDocumentNext();
@@ -56,19 +57,19 @@
void slotResetHistory();
void slotDocumentDelete();
- protected:
- virtual void contextMenuEvent ( QContextMenuEvent * event );
+protected:
+ virtual void contextMenuEvent(QContextMenuEvent *event);
- Q_SIGNALS:
- void closeDocument(KTextEditor::Document*);
- void activateDocument(KTextEditor::Document*);
+Q_SIGNALS:
+ void closeDocument(KTextEditor::Document *);
+ void activateDocument(KTextEditor::Document *);
void openDocument(QUrl);
void viewModeChanged(bool treeMode);
void sortRoleChanged(int);
- private Q_SLOTS:
+private Q_SLOTS:
void mouseClicked(const QModelIndex &index);
void slotTreeMode();
@@ -78,16 +79,19 @@
void slotSortPath();
void slotSortOpeningOrder();
void slotFixOpenWithMenu();
- void slotOpenWithMenuAction(QAction* a);
+ void slotOpenWithMenuAction(QAction *a);
+
+ void slotRenameFile();
- private:
- QAction *setupOption(QActionGroup *group, const QIcon &, const QString &, const QString &, const char *slot, bool checked=false);
+private:
+ QAction *setupOption(QActionGroup *group, const QIcon &, const QString &, const QString &, const char *slot, bool checked = false);
- private:
+private:
QAction *m_filelistCloseDocument;
QAction *m_filelistCloseOtherDocument;
QAction *m_filelistReloadDocument;
QAction *m_filelistCopyFilename;
+ QAction *m_filelistRenameFile;
QAction *m_filelistPrintDocument;
QAction *m_filelistPrintDocumentPreview;
QAction *m_filelistDeleteDocument;
@@ -106,4 +110,3 @@
#endif // KATE_FILETREE_H
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreeconfigpage.cpp
^
|
@@ -48,151 +48,149 @@
#include <QCheckBox>
#include <KLocalizedString>
-KateFileTreeConfigPage::KateFileTreeConfigPage( QWidget* parent, KateFileTreePlugin *fl )
- : KTextEditor::ConfigPage( parent ),
- m_plug( fl ),
- m_changed( false )
-{
- QVBoxLayout *layout = new QVBoxLayout( this );
- layout->setMargin( 0 );
-
- gbEnableShading = new QGroupBox( i18n("Background Shading"), this );
- gbEnableShading->setCheckable(true);
- layout->addWidget( gbEnableShading );
-
- QGridLayout *lo = new QGridLayout( gbEnableShading);
-
- kcbViewShade = new KColorButton( gbEnableShading );
- lViewShade = new QLabel( i18n("&Viewed documents' shade:"), gbEnableShading );
- lViewShade->setBuddy( kcbViewShade );
- lo->addWidget( lViewShade, 2, 0 );
- lo->addWidget( kcbViewShade, 2, 1 );
-
- kcbEditShade = new KColorButton( gbEnableShading );
- lEditShade = new QLabel( i18n("&Modified documents' shade:"), gbEnableShading );
- lEditShade->setBuddy( kcbEditShade );
- lo->addWidget( lEditShade, 3, 0 );
- lo->addWidget( kcbEditShade, 3, 1 );
-
- // sorting
- QHBoxLayout *lo2 = new QHBoxLayout;
- layout->addLayout( lo2 );
- lSort = new QLabel( i18n("&Sort by:"), this );
- lo2->addWidget( lSort );
- cmbSort = new KComboBox( this );
- lo2->addWidget( cmbSort );
- lSort->setBuddy( cmbSort );
- cmbSort->addItem(i18n("Opening Order"), (int)KateFileTreeModel::OpeningOrderRole);
- cmbSort->addItem(i18n("Document Name"), (int)Qt::DisplayRole);
- cmbSort->addItem(i18n("Url"), (int)KateFileTreeModel::PathRole);
-
-
- // view mode
- QHBoxLayout *lo3 = new QHBoxLayout;
- layout->addLayout( lo3 );
- lMode = new QLabel( i18n("&View Mode:"), this );
- lo3->addWidget( lMode );
- cmbMode = new KComboBox( this );
- lo3->addWidget( cmbMode );
- lMode->setBuddy( cmbMode );
- cmbMode->addItem(i18n("Tree View"), QVariant(false));
- cmbMode->addItem(i18n("List View"), QVariant(true));
-
- // Show Full Path on Roots?
- QHBoxLayout *lo4 = new QHBoxLayout;
- layout->addLayout( lo4 );
- cbShowFullPath = new QCheckBox( i18n("&Show Full Path"), this );
- lo4->addWidget( cbShowFullPath );
-
- layout->insertStretch( -1, 10 );
-
- gbEnableShading->setWhatsThis( i18n(
- "When background shading is enabled, documents that have been viewed "
- "or edited within the current session will have a shaded background. "
- "The most recent documents have the strongest shade.") );
- kcbViewShade->setWhatsThis( i18n(
- "Set the color for shading viewed documents.") );
- kcbEditShade->setWhatsThis( i18n(
- "Set the color for modified documents. This color is blended into "
- "the color for viewed files. The most recently edited documents get "
- "most of this color.") );
-
- cbShowFullPath->setWhatsThis( i18n(
- "When enabled, in tree mode, top level folders will show up with their full path "
- "rather than just the last folder name." ) );
+KateFileTreeConfigPage::KateFileTreeConfigPage(QWidget *parent, KateFileTreePlugin *fl)
+ : KTextEditor::ConfigPage(parent),
+ m_plug(fl),
+ m_changed(false)
+{
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->setMargin(0);
+
+ gbEnableShading = new QGroupBox(i18n("Background Shading"), this);
+ gbEnableShading->setCheckable(true);
+ layout->addWidget(gbEnableShading);
+
+ QGridLayout *lo = new QGridLayout(gbEnableShading);
+
+ kcbViewShade = new KColorButton(gbEnableShading);
+ lViewShade = new QLabel(i18n("&Viewed documents' shade:"), gbEnableShading);
+ lViewShade->setBuddy(kcbViewShade);
+ lo->addWidget(lViewShade, 2, 0);
+ lo->addWidget(kcbViewShade, 2, 1);
+
+ kcbEditShade = new KColorButton(gbEnableShading);
+ lEditShade = new QLabel(i18n("&Modified documents' shade:"), gbEnableShading);
+ lEditShade->setBuddy(kcbEditShade);
+ lo->addWidget(lEditShade, 3, 0);
+ lo->addWidget(kcbEditShade, 3, 1);
+
+ // sorting
+ QHBoxLayout *lo2 = new QHBoxLayout;
+ layout->addLayout(lo2);
+ lSort = new QLabel(i18n("&Sort by:"), this);
+ lo2->addWidget(lSort);
+ cmbSort = new KComboBox(this);
+ lo2->addWidget(cmbSort);
+ lSort->setBuddy(cmbSort);
+ cmbSort->addItem(i18n("Opening Order"), (int)KateFileTreeModel::OpeningOrderRole);
+ cmbSort->addItem(i18n("Document Name"), (int)Qt::DisplayRole);
+ cmbSort->addItem(i18n("Url"), (int)KateFileTreeModel::PathRole);
+
+ // view mode
+ QHBoxLayout *lo3 = new QHBoxLayout;
+ layout->addLayout(lo3);
+ lMode = new QLabel(i18n("&View Mode:"), this);
+ lo3->addWidget(lMode);
+ cmbMode = new KComboBox(this);
+ lo3->addWidget(cmbMode);
+ lMode->setBuddy(cmbMode);
+ cmbMode->addItem(i18n("Tree View"), QVariant(false));
+ cmbMode->addItem(i18n("List View"), QVariant(true));
+
+ // Show Full Path on Roots?
+ QHBoxLayout *lo4 = new QHBoxLayout;
+ layout->addLayout(lo4);
+ cbShowFullPath = new QCheckBox(i18n("&Show Full Path"), this);
+ lo4->addWidget(cbShowFullPath);
+
+ layout->insertStretch(-1, 10);
+
+ gbEnableShading->setWhatsThis(i18n(
+ "When background shading is enabled, documents that have been viewed "
+ "or edited within the current session will have a shaded background. "
+ "The most recent documents have the strongest shade."));
+ kcbViewShade->setWhatsThis(i18n(
+ "Set the color for shading viewed documents."));
+ kcbEditShade->setWhatsThis(i18n(
+ "Set the color for modified documents. This color is blended into "
+ "the color for viewed files. The most recently edited documents get "
+ "most of this color."));
+
+ cbShowFullPath->setWhatsThis(i18n(
+ "When enabled, in tree mode, top level folders will show up with their full path "
+ "rather than just the last folder name."));
// cmbSort->setWhatsThis( i18n(
// "Set the sorting method for the documents.") );
- reset();
+ reset();
- connect( gbEnableShading, SIGNAL(toggled(bool)), this, SLOT(slotMyChanged()) );
- connect( kcbViewShade, SIGNAL(changed(QColor)), this, SLOT(slotMyChanged()) );
- connect( kcbEditShade, SIGNAL(changed(QColor)), this, SLOT(slotMyChanged()) );
- connect( cmbSort, SIGNAL(activated(int)), this, SLOT(slotMyChanged()) );
- connect( cmbMode, SIGNAL(activated(int)), this, SLOT(slotMyChanged()) );
- connect( cbShowFullPath, SIGNAL(stateChanged(int)), this, SLOT(slotMyChanged()) );
+ connect(gbEnableShading, SIGNAL(toggled(bool)), this, SLOT(slotMyChanged()));
+ connect(kcbViewShade, SIGNAL(changed(QColor)), this, SLOT(slotMyChanged()));
+ connect(kcbEditShade, SIGNAL(changed(QColor)), this, SLOT(slotMyChanged()));
+ connect(cmbSort, SIGNAL(activated(int)), this, SLOT(slotMyChanged()));
+ connect(cmbMode, SIGNAL(activated(int)), this, SLOT(slotMyChanged()));
+ connect(cbShowFullPath, SIGNAL(stateChanged(int)), this, SLOT(slotMyChanged()));
}
QString KateFileTreeConfigPage::name() const
{
- return QString(i18n("Documents"));
+ return QString(i18n("Documents"));
}
QString KateFileTreeConfigPage::fullName() const
{
- return QString(i18n("Configure Documents"));
+ return QString(i18n("Configure Documents"));
}
QIcon KateFileTreeConfigPage::icon() const
{
- return QIcon::fromTheme(QLatin1String("view-list-tree"));
+ return QIcon::fromTheme(QLatin1String("view-list-tree"));
}
void KateFileTreeConfigPage::apply()
{
- if ( ! m_changed ) {
- return;
- }
-
- m_changed = false;
-
- // apply config to views
- m_plug->applyConfig(
- gbEnableShading->isChecked(),
- kcbViewShade->color(),
- kcbEditShade->color(),
- cmbMode->itemData(cmbMode->currentIndex()).toBool(),
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreeconfigpage.h
^
|
@@ -29,28 +29,29 @@
class KateFileTreePlugin;
-class KateFileTreeConfigPage : public KTextEditor::ConfigPage {
- Q_OBJECT
- public:
- explicit KateFileTreeConfigPage( QWidget* parent=0, KateFileTreePlugin *plug=0 );
+class KateFileTreeConfigPage : public KTextEditor::ConfigPage
+{
+ Q_OBJECT
+public:
+ explicit KateFileTreeConfigPage(QWidget *parent = 0, KateFileTreePlugin *plug = 0);
~KateFileTreeConfigPage() {};
virtual QString name() const;
virtual QString fullName() const;
virtual QIcon icon() const;
- public Q_SLOTS:
+public Q_SLOTS:
void apply();
void defaults();
void reset();
-
- //Q_SIGNALS:
- // void changed();
- private Q_SLOTS:
+ //Q_SIGNALS:
+ // void changed();
+
+private Q_SLOTS:
void slotMyChanged();
- private:
+private:
class QGroupBox *gbEnableShading;
class KColorButton *kcbViewShade, *kcbEditShade;
class QLabel *lEditShade, *lViewShade, *lSort, *lMode;
@@ -63,4 +64,3 @@
#endif /* KATE_FILETREE_CONFIGPAGE_H */
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreemodel.cpp
^
|
@@ -38,11 +38,12 @@
#include "katefiletreedebug.h"
class ProxyItemDir;
-class ProxyItem {
- friend class KateFileTreeModel;
+class ProxyItem
+{
+ friend class KateFileTreeModel;
- public:
- enum Flag { None = 0, Dir = 1, Modified = 2, ModifiedExternally = 4, DeletedExternally = 8, Empty = 16, ShowFullPath = 32, Host=64 };
+public:
+ enum Flag { None = 0, Dir = 1, Modified = 2, ModifiedExternally = 4, DeletedExternally = 8, Empty = 16, ShowFullPath = 32, Host = 64 };
Q_DECLARE_FLAGS(Flags, Flag)
ProxyItem(const QString &n, ProxyItemDir *p = 0, Flags f = ProxyItem::None);
@@ -70,8 +71,8 @@
void setIcon(const QIcon &i);
const QIcon &icon() const;
- const QList<ProxyItem*> &children() const;
- QList<ProxyItem*> &children();
+ const QList<ProxyItem *> &children() const;
+ QList<ProxyItem *> &children();
void setDoc(KTextEditor::Document *doc);
KTextEditor::Document *doc() const;
@@ -80,18 +81,18 @@
* the view usess this to close all the documents under the folder
* @returns list of all the (nested) documents under this node
*/
- QList<KTextEditor::Document*> docTree() const;
+ QList<KTextEditor::Document *> docTree() const;
void setFlags(Flags flags);
void setFlag(Flag flag);
void clearFlag(Flag flag);
bool flag(Flag flag) const;
- private:
+private:
QString m_path;
QString m_documentName;
ProxyItemDir *m_parent;
- QList<ProxyItem*> m_children;
+ QList<ProxyItem *> m_children;
int m_row;
Flags m_flags;
@@ -100,712 +101,708 @@
KTextEditor::Document *m_doc;
QString m_host;
- protected:
+protected:
void updateDisplay();
void updateDocumentName();
};
QDebug operator<<(QDebug dbg, ProxyItem *item)
{
- if(!item) {
- dbg.nospace() << "ProxyItem(0x0) ";
- return dbg.maybeSpace();
- }
+ if (!item) {
+ dbg.nospace() << "ProxyItem(0x0) ";
+ return dbg.maybeSpace();
+ }
- const void *parent = static_cast<void *>(item->parent());
+ const void *parent = static_cast<void *>(item->parent());
- dbg.nospace() << "ProxyItem(" << (void*)item << ",";
- dbg.nospace() << parent << "," << item->row() << ",";
- dbg.nospace() << item->doc() << "," << item->path() << ") ";
- return dbg.maybeSpace();
+ dbg.nospace() << "ProxyItem(" << (void *)item << ",";
+ dbg.nospace() << parent << "," << item->row() << ",";
+ dbg.nospace() << item->doc() << "," << item->path() << ") ";
+ return dbg.maybeSpace();
}
-
class ProxyItemDir : public ProxyItem
{
- public:
- ProxyItemDir(QString n, ProxyItemDir *p = 0) : ProxyItem(n, p)
- {
- setFlag(ProxyItem::Dir);
- updateDisplay();
+public:
+ ProxyItemDir(QString n, ProxyItemDir *p = 0) : ProxyItem(n, p) {
+ setFlag(ProxyItem::Dir);
+ updateDisplay();
- setIcon(QIcon::fromTheme(QLatin1String("folder")));
+ setIcon(QIcon::fromTheme(QLatin1String("folder")));
}
};
QDebug operator<<(QDebug dbg, ProxyItemDir *item)
{
- if(!item) {
- dbg.nospace() << "ProxyItemDir(0x0) ";
- return dbg.maybeSpace();
- }
+ if (!item) {
+ dbg.nospace() << "ProxyItemDir(0x0) ";
+ return dbg.maybeSpace();
+ }
- const void *parent = static_cast<void *>(item->parent());
+ const void *parent = static_cast<void *>(item->parent());
- dbg.nospace() << "ProxyItemDir(" << (void*)item << ",";
- dbg.nospace() << parent << "," << item->row() << ",";
- dbg.nospace() << item->path() << ", children:" << item->childCount() << ") ";
- return dbg.maybeSpace();
+ dbg.nospace() << "ProxyItemDir(" << (void *)item << ",";
+ dbg.nospace() << parent << "," << item->row() << ",";
+ dbg.nospace() << item->path() << ", children:" << item->childCount() << ") ";
+ return dbg.maybeSpace();
}
Q_DECLARE_OPERATORS_FOR_FLAGS(ProxyItem::Flags)
//BEGIN ProxyItem
ProxyItem::ProxyItem(const QString &d, ProxyItemDir *p, ProxyItem::Flags f)
- : m_path(d), m_parent(p), m_row(-1), m_flags(f), m_doc(0)
+ : m_path(d), m_parent(p), m_row(-1), m_flags(f), m_doc(0)
{
- updateDisplay();
+ updateDisplay();
- if(p) {
- p->addChild(this);
- }
+ if (p) {
+ p->addChild(this);
+ }
}
ProxyItem::~ProxyItem()
{
- qDeleteAll(m_children);
+ qDeleteAll(m_children);
}
void ProxyItem::updateDisplay()
{
- // triggers only if this is a top level node and the root has the show full path flag set.
- if (flag(ProxyItem::Dir) && m_parent && !m_parent->m_parent && m_parent->flag(ProxyItem::ShowFullPath)) {
- m_display = m_path;
- if (m_display.startsWith(QDir::homePath())) {
- m_display.replace(0, QDir::homePath().length(), QLatin1String("~"));
- }
- } else {
- m_display = m_path.section(QLatin1Char('/'), -1, -1);
- if (flag(ProxyItem::Host) && (!m_parent || (m_parent && !m_parent->m_parent))) {
- const QString hostPrefix = QString::fromLatin1("[%1]").arg(host());
- if (hostPrefix != m_display) {
- m_display = hostPrefix + m_display;
- }
+ // triggers only if this is a top level node and the root has the show full path flag set.
+ if (flag(ProxyItem::Dir) && m_parent && !m_parent->m_parent && m_parent->flag(ProxyItem::ShowFullPath)) {
+ m_display = m_path;
+ if (m_display.startsWith(QDir::homePath())) {
+ m_display.replace(0, QDir::homePath().length(), QLatin1String("~"));
+ }
+ } else {
+ m_display = m_path.section(QLatin1Char('/'), -1, -1);
+ if (flag(ProxyItem::Host) && (!m_parent || (m_parent && !m_parent->m_parent))) {
+ const QString hostPrefix = QString::fromLatin1("[%1]").arg(host());
+ if (hostPrefix != m_display) {
+ m_display = hostPrefix + m_display;
+ }
+ }
}
- }
}
int ProxyItem::addChild(ProxyItem *item)
{
- const int item_row = m_children.count();
- item->m_row = item_row;
- m_children.append(item);
- item->m_parent = static_cast<ProxyItemDir*>(this);
+ const int item_row = m_children.count();
+ item->m_row = item_row;
+ m_children.append(item);
+ item->m_parent = static_cast<ProxyItemDir *>(this);
- item->updateDisplay();
+ item->updateDisplay();
- return item_row;
+ return item_row;
}
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreemodel.h
^
|
@@ -24,8 +24,9 @@
#include <QColor>
#include <ktexteditor/modificationinterface.h>
-namespace KTextEditor {
- class Document;
+namespace KTextEditor
+{
+class Document;
}
class ProxyItem;
@@ -36,24 +37,24 @@
class KateFileTreeModel : public QAbstractItemModel
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
enum { DocumentRole = Qt::UserRole + 1, PathRole, OpeningOrderRole, DocumentTreeRole };
KateFileTreeModel(QObject *p);
virtual ~KateFileTreeModel();
/* QAbstractItemModel implementations */
- virtual Qt::ItemFlags flags( const QModelIndex & index ) const;
- virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const;
- virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
- virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const;
- virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const;
-
- virtual QModelIndex parent( const QModelIndex & index ) const;
- virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
- virtual bool hasChildren( const QModelIndex & parent = QModelIndex() ) const;
+ virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+ virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+ virtual QModelIndex parent(const QModelIndex &index) const;
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
/* extra api for view */
QModelIndex docIndex(const KTextEditor::Document *) const;
@@ -81,19 +82,19 @@
void documentEdited(const KTextEditor::Document *);
void resetHistory();
- public Q_SLOTS:
+public Q_SLOTS:
void documentOpened(KTextEditor::Document *);
void documentClosed(KTextEditor::Document *);
void documentNameChanged(KTextEditor::Document *);
- void documentModifiedChanged( KTextEditor::Document *);
- void documentModifiedOnDisc(KTextEditor::Document*, bool, KTextEditor::ModificationInterface::ModifiedOnDiskReason);
+ void documentModifiedChanged(KTextEditor::Document *);
+ void documentModifiedOnDisc(KTextEditor::Document *, bool, KTextEditor::ModificationInterface::ModifiedOnDiskReason);
void slotAboutToDeleteDocuments(const QList<KTextEditor::Document *> &);
void slotDocumentsDeleted(const QList<KTextEditor::Document *> &);
- Q_SIGNALS:
+Q_SIGNALS:
void triggerViewChangeAfterNameChange();
- private:
+private:
ProxyItemDir *findRootNode(const QString &name, const int r = 1) const;
ProxyItemDir *findChildNode(const ProxyItemDir *parent, const QString &name) const;
void insertItemInto(ProxyItemDir *root, ProxyItem *item);
@@ -110,7 +111,7 @@
void clearModel();
void connectDocument(const KTextEditor::Document *);
- private:
+private:
ProxyItemDir *m_root;
QHash<const KTextEditor::Document *, ProxyItem *> m_docmap;
@@ -128,4 +129,3 @@
#endif /* KATEFILETREEMODEL_H */
-// kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreeplugin.cpp
^
|
@@ -35,338 +35,422 @@
#include <KConfigGroup>
#include <KIconLoader>
#include <KXMLGUIFactory>
+#include <KXmlGuiWindow>
+#include <KToolBar>
#include <QAction>
#include <QApplication>
+#include <QVBoxLayout>
#include "katefiletreedebug.h"
//END Includes
-K_PLUGIN_FACTORY_WITH_JSON (KateFileTreeFactory, "katefiletreeplugin.json", registerPlugin<KateFileTreePlugin>();)
+K_PLUGIN_FACTORY_WITH_JSON(KateFileTreeFactory, "katefiletreeplugin.json", registerPlugin<KateFileTreePlugin>();)
Q_LOGGING_CATEGORY(FILETREE, "kate-filetree")
//BEGIN KateFileTreePlugin
-KateFileTreePlugin::KateFileTreePlugin(QObject* parent, const QList<QVariant>&)
- : KTextEditor::Plugin (parent)
+KateFileTreePlugin::KateFileTreePlugin(QObject *parent, const QList<QVariant> &)
+ : KTextEditor::Plugin(parent)
{
}
KateFileTreePlugin::~KateFileTreePlugin()
{
- m_settings.save();
+ m_settings.save();
}
-QObject *KateFileTreePlugin::createView (KTextEditor::MainWindow *mainWindow)
+QObject *KateFileTreePlugin::createView(KTextEditor::MainWindow *mainWindow)
{
- KateFileTreePluginView* view = new KateFileTreePluginView (mainWindow, this);
- connect(view, SIGNAL(destroyed(QObject*)), this, SLOT(viewDestroyed(QObject*)));
- m_views.append(view);
+ KateFileTreePluginView *view = new KateFileTreePluginView(mainWindow, this);
+ connect(view, SIGNAL(destroyed(QObject *)), this, SLOT(viewDestroyed(QObject *)));
+ m_views.append(view);
- return view;
+ return view;
}
-void KateFileTreePlugin::viewDestroyed(QObject* view)
+void KateFileTreePlugin::viewDestroyed(QObject *view)
{
- // do not access the view pointer, since it is partially destroyed already
- m_views.removeAll(static_cast<KateFileTreePluginView *>(view));
+ // do not access the view pointer, since it is partially destroyed already
+ m_views.removeAll(static_cast<KateFileTreePluginView *>(view));
}
int KateFileTreePlugin::configPages() const
{
- return 1;
+ return 1;
}
-KTextEditor::ConfigPage *KateFileTreePlugin::configPage (int number, QWidget *parent)
+KTextEditor::ConfigPage *KateFileTreePlugin::configPage(int number, QWidget *parent)
{
- if(number != 0)
- return 0;
+ if (number != 0) {
+ return 0;
+ }
- KateFileTreeConfigPage *page = new KateFileTreeConfigPage(parent, this);
- return page;
+ KateFileTreeConfigPage *page = new KateFileTreeConfigPage(parent, this);
+ return page;
}
const KateFileTreePluginSettings &KateFileTreePlugin::settings()
{
- return m_settings;
+ return m_settings;
}
void KateFileTreePlugin::applyConfig(bool shadingEnabled, QColor viewShade, QColor editShade, bool listMode, int sortRole, bool showFullPath)
{
- // save to settings
- m_settings.setShadingEnabled(shadingEnabled);
- m_settings.setViewShade(viewShade);
- m_settings.setEditShade(editShade);
-
- m_settings.setListMode(listMode);
- m_settings.setSortRole(sortRole);
- m_settings.setShowFullPathOnRoots(showFullPath);
- m_settings.save();
-
- // update views
- foreach(KateFileTreePluginView *view, m_views) {
- view->setHasLocalPrefs(false);
- view->model()->setShadingEnabled( shadingEnabled );
- view->model()->setViewShade( viewShade );
- view->model()->setEditShade( editShade );
- view->setListMode( listMode );
- view->proxy()->setSortRole( sortRole );
- view->model()->setShowFullPathOnRoots( showFullPath );
- }
+ // save to settings
+ m_settings.setShadingEnabled(shadingEnabled);
+ m_settings.setViewShade(viewShade);
+ m_settings.setEditShade(editShade);
+
+ m_settings.setListMode(listMode);
+ m_settings.setSortRole(sortRole);
+ m_settings.setShowFullPathOnRoots(showFullPath);
+ m_settings.save();
+
+ // update views
+ foreach(KateFileTreePluginView * view, m_views) {
+ view->setHasLocalPrefs(false);
+ view->model()->setShadingEnabled(shadingEnabled);
+ view->model()->setViewShade(viewShade);
+ view->model()->setEditShade(editShade);
+ view->setListMode(listMode);
+ view->proxy()->setSortRole(sortRole);
+ view->model()->setShowFullPathOnRoots(showFullPath);
+ }
}
//END KateFileTreePlugin
//BEGIN KateFileTreePluginView
-KateFileTreePluginView::KateFileTreePluginView (KTextEditor::MainWindow *mainWindow, KateFileTreePlugin *plug)
- : QObject (mainWindow)
- , m_loadingDocuments(false)
- , m_plug(plug)
- , m_mainWindow (mainWindow)
-{
- KXMLGUIClient::setComponentName (QLatin1String("katefiletree"), i18n ("Kate File Tree"));
- setXMLFile(QLatin1String("ui.rc"));
-
- m_toolView = mainWindow->createToolView (plug,QLatin1String("kate_private_plugin_katefiletreeplugin"), KTextEditor::MainWindow::Left, SmallIcon(QLatin1String("document-open")), i18n("Documents"));
- m_fileTree = new KateFileTree(m_toolView);
- m_fileTree->setSortingEnabled(true);
-
- connect(m_fileTree, SIGNAL(activateDocument(KTextEditor::Document*)),
- this, SLOT(activateDocument(KTextEditor::Document*)));
-
- connect(m_fileTree, SIGNAL(viewModeChanged(bool)), this, SLOT(viewModeChanged(bool)));
- connect(m_fileTree, SIGNAL(sortRoleChanged(int)), this, SLOT(sortRoleChanged(int)));
-
- m_documentModel = new KateFileTreeModel(this);
- m_proxyModel = new KateFileTreeProxyModel(this);
- m_proxyModel->setSourceModel(m_documentModel);
- m_proxyModel->setDynamicSortFilter(true);
-
- m_documentModel->setShowFullPathOnRoots(m_plug->settings().showFullPathOnRoots());
- m_documentModel->setShadingEnabled(m_plug->settings().shadingEnabled());
- m_documentModel->setViewShade(m_plug->settings().viewShade());
- m_documentModel->setEditShade(m_plug->settings().editShade());
-
- connect(KTextEditor::Editor::instance()->application(), SIGNAL(documentWillBeDeleted(KTextEditor::Document*)),
- m_documentModel, SLOT(documentClosed(KTextEditor::Document*)));
-
- connect(KTextEditor::Editor::instance()->application(), SIGNAL(documentCreated(KTextEditor::Document*)),
- this, SLOT(documentOpened(KTextEditor::Document*)));
- connect(KTextEditor::Editor::instance()->application(), SIGNAL(documentWillBeDeleted(KTextEditor::Document*)),
- this, SLOT(documentClosed(KTextEditor::Document*)));
- connect(KTextEditor::Editor::instance()->application(), SIGNAL(aboutToCreateDocuments()),
- this, SLOT(slotAboutToCreateDocuments()));
- connect(KTextEditor::Editor::instance()->application(), SIGNAL(documentsCreated(QList<KTextEditor::Document*>)),
- this, SLOT(slotDocumentsCreated(const QList<KTextEditor::Document*> &)));
- connect(KTextEditor::Editor::instance()->application(), SIGNAL(aboutToDeleteDocuments(const QList<KTextEditor::Document *> &)),
- m_documentModel, SLOT(slotAboutToDeleteDocuments(const QList<KTextEditor::Document *> &)));
- connect(KTextEditor::Editor::instance()->application(), SIGNAL(documentsDeleted(const QList<KTextEditor::Document *> &)),
- m_documentModel, SLOT(slotDocumentsDeleted(const QList<KTextEditor::Document *> &)));
-
- connect(m_documentModel,SIGNAL(triggerViewChangeAfterNameChange()),this,SLOT(viewChanged()));
- m_fileTree->setModel(m_proxyModel);
-
- m_fileTree->setDragEnabled(false);
- m_fileTree->setDragDropMode(QAbstractItemView::InternalMove);
- m_fileTree->setDropIndicatorShown(false);
-
- m_fileTree->setSelectionMode(QAbstractItemView::SingleSelection);
-
- connect( m_fileTree->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), m_fileTree, SLOT(slotCurrentChanged(QModelIndex,QModelIndex)));
-
- connect(mainWindow, SIGNAL(viewChanged(KTextEditor::View*)), this, SLOT(viewChanged(KTextEditor::View*)));
-
- QAction *show_active = actionCollection()->addAction(QLatin1String("filetree_show_active_document"), mainWindow);
- show_active->setText(i18n("&Show Active"));
- show_active->setIcon(QIcon::fromTheme(QLatin1String("folder-sync")));
- connect( show_active, SIGNAL(triggered(bool)), this, SLOT(showActiveDocument()) );
-
- /**
- * back + forward
- */
- actionCollection()->addAction( KStandardAction::Back, QLatin1String("filetree_prev_document"), m_fileTree, SLOT(slotDocumentPrev()) )->setText(i18n("Previous Document"));
- actionCollection()->addAction( KStandardAction::Forward, QLatin1String("filetree_next_document"), m_fileTree, SLOT(slotDocumentNext()) )->setText(i18n("Next Document"));
-
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreeplugin.desktop
^
|
@@ -2,7 +2,6 @@
Type=Service
ServiceTypes=KTextEditor/Plugin
X-KDE-Library=katefiletreeplugin
-X-KTextEditor-Load-Default=kate
Name=File Tree
Name[ar]=شجرة الملفات
Name[bg]=Дърво с файлове
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreeplugin.h
^
|
@@ -33,34 +33,35 @@
#include <KXMLGUIClient>
+class KToolBar;
+
class KateFileTree;
class KateFileTreeModel;
class KateFileTreeProxyModel;
class KateFileTreeConfigPage;
class KateFileTreePluginView;
-class KateFileTreeCommand;
class KateFileTreePlugin: public KTextEditor::Plugin
{
- Q_OBJECT
+ Q_OBJECT
- public:
- explicit KateFileTreePlugin( QObject* parent = 0, const QList<QVariant>& = QList<QVariant>() );
+public:
+ explicit KateFileTreePlugin(QObject *parent = 0, const QList<QVariant> & = QList<QVariant>());
virtual ~KateFileTreePlugin();
- QObject *createView (KTextEditor::MainWindow *mainWindow);
+ QObject *createView(KTextEditor::MainWindow *mainWindow);
virtual int configPages() const;
- virtual KTextEditor::ConfigPage *configPage (int number = 0, QWidget *parent = 0 );
+ virtual KTextEditor::ConfigPage *configPage(int number = 0, QWidget *parent = 0);
const KateFileTreePluginSettings &settings();
void applyConfig(bool shadingEnabled, QColor viewShade, QColor editShade, bool listMode, int sortRole, bool showFulPath);
- public Q_SLOTS:
- void viewDestroyed(QObject* view);
+public Q_SLOTS:
+ void viewDestroyed(QObject *view);
- private:
+private:
QList<KateFileTreePluginView *> m_views;
KateFileTreeConfigPage *m_confPage;
KateFileTreePluginSettings m_settings;
@@ -68,23 +69,23 @@
class KateFileTreePluginView : public QObject, public KXMLGUIClient, public KTextEditor::SessionConfigInterface
{
- Q_OBJECT
-
- Q_INTERFACES(KTextEditor::SessionConfigInterface)
+ Q_OBJECT
+
+ Q_INTERFACES(KTextEditor::SessionConfigInterface)
- public:
+public:
/**
* Constructor.
*/
- KateFileTreePluginView (KTextEditor::MainWindow *mainWindow, KateFileTreePlugin *plug);
+ KateFileTreePluginView(KTextEditor::MainWindow *mainWindow, KateFileTreePlugin *plug);
/**
* Virtual destructor.
*/
- ~KateFileTreePluginView ();
+ ~KateFileTreePluginView();
- void readSessionConfig (const KConfigGroup& config);
- void writeSessionConfig (KConfigGroup& config);
+ void readSessionConfig(const KConfigGroup &config) Q_DECL_OVERRIDE;
+ void writeSessionConfig(KConfigGroup &config) Q_DECL_OVERRIDE;
/**
* The file tree model.
@@ -107,8 +108,12 @@
bool hasLocalPrefs();
void setHasLocalPrefs(bool);
- private:
+protected:
+ void setupActions();
+
+private:
QWidget *m_toolView;
+ KToolBar *m_toolbar;
KateFileTree *m_fileTree;
KateFileTreeProxyModel *m_proxyModel;
KateFileTreeModel *m_documentModel;
@@ -117,7 +122,7 @@
KateFileTreePlugin *m_plug;
KTextEditor::MainWindow *m_mainWindow;
- private Q_SLOTS:
+private Q_SLOTS:
void showToolView();
void hideToolView();
void showActiveDocument();
@@ -129,8 +134,9 @@
void sortRoleChanged(int);
void slotAboutToCreateDocuments();
void slotDocumentsCreated(const QList<KTextEditor::Document *> &);
+ void slotDocumentSave();
+ void slotDocumentSaveAs();
};
#endif //KATE_FILETREE_PLUGIN_H
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreepluginsettings.cpp
^
|
@@ -23,93 +23,92 @@
#include "katefiletreedebug.h"
KateFileTreePluginSettings::KateFileTreePluginSettings()
- : m_group(KSharedConfig::openConfig(), "filetree")
+ : m_group(KSharedConfig::openConfig(), "filetree")
{
- KColorScheme colors(QPalette::Active);
- QColor bg = colors.background().color();
- QColor viewShade = KColorUtils::tint(bg, colors.foreground(KColorScheme::VisitedText).color(), 0.5);
- QColor editShade = KColorUtils::tint(bg, colors.foreground(KColorScheme::ActiveText).color(), 0.5);
+ KColorScheme colors(QPalette::Active);
+ QColor bg = colors.background().color();
+ QColor viewShade = KColorUtils::tint(bg, colors.foreground(KColorScheme::VisitedText).color(), 0.5);
+ QColor editShade = KColorUtils::tint(bg, colors.foreground(KColorScheme::ActiveText).color(), 0.5);
- m_shadingEnabled = m_group.readEntry("shadingEnabled", true);
- m_viewShade = m_group.readEntry("viewShade", viewShade);
- m_editShade = m_group.readEntry("editShade", editShade);
+ m_shadingEnabled = m_group.readEntry("shadingEnabled", true);
+ m_viewShade = m_group.readEntry("viewShade", viewShade);
+ m_editShade = m_group.readEntry("editShade", editShade);
- m_listMode = m_group.readEntry("listMode", false);
- m_sortRole = m_group.readEntry("sortRole", int(Qt::DisplayRole));
+ m_listMode = m_group.readEntry("listMode", false);
+ m_sortRole = m_group.readEntry("sortRole", int(Qt::DisplayRole));
- m_showFullPathOnRoots = m_group.readEntry("showFullPathOnRoots", false);
+ m_showFullPathOnRoots = m_group.readEntry("showFullPathOnRoots", false);
}
void KateFileTreePluginSettings::save()
{
- m_group.writeEntry("shadingEnabled", m_shadingEnabled);
- m_group.writeEntry("viewShade", m_viewShade);
- m_group.writeEntry("editShade", m_editShade);
- m_group.writeEntry("listMode", m_listMode);
- m_group.writeEntry("sortRole", m_sortRole);
- m_group.writeEntry("showFullPathOnRoots", m_showFullPathOnRoots);
+ m_group.writeEntry("shadingEnabled", m_shadingEnabled);
+ m_group.writeEntry("viewShade", m_viewShade);
+ m_group.writeEntry("editShade", m_editShade);
+ m_group.writeEntry("listMode", m_listMode);
+ m_group.writeEntry("sortRole", m_sortRole);
+ m_group.writeEntry("showFullPathOnRoots", m_showFullPathOnRoots);
- m_group.sync();
+ m_group.sync();
}
bool KateFileTreePluginSettings::shadingEnabled() const
{
- return m_shadingEnabled;
+ return m_shadingEnabled;
}
void KateFileTreePluginSettings::setShadingEnabled(bool shadingEnabled)
{
- m_shadingEnabled = shadingEnabled;
+ m_shadingEnabled = shadingEnabled;
}
const QColor &KateFileTreePluginSettings::viewShade() const
{
- return m_viewShade;
+ return m_viewShade;
}
void KateFileTreePluginSettings::setViewShade(const QColor &viewShade)
{
- m_viewShade = viewShade;
+ m_viewShade = viewShade;
}
const QColor &KateFileTreePluginSettings::editShade() const
{
- return m_editShade;
+ return m_editShade;
}
void KateFileTreePluginSettings::setEditShade(const QColor &editShade)
{
- m_editShade = editShade;
+ m_editShade = editShade;
}
bool KateFileTreePluginSettings::listMode() const
{
- return m_listMode;
+ return m_listMode;
}
void KateFileTreePluginSettings::setListMode(bool listMode)
{
- m_listMode = listMode;
+ m_listMode = listMode;
}
int KateFileTreePluginSettings::sortRole() const
{
- return m_sortRole;
+ return m_sortRole;
}
void KateFileTreePluginSettings::setSortRole(int sortRole)
{
- m_sortRole = sortRole;
+ m_sortRole = sortRole;
}
bool KateFileTreePluginSettings::showFullPathOnRoots() const
{
- return m_showFullPathOnRoots;
+ return m_showFullPathOnRoots;
}
void KateFileTreePluginSettings::setShowFullPathOnRoots(bool s)
{
- m_showFullPathOnRoots = s;
+ m_showFullPathOnRoots = s;
}
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreepluginsettings.h
^
|
@@ -26,7 +26,7 @@
// Geh, should make this into a proper class, setters and getters.
class KateFileTreePluginSettings
{
- public:
+public:
KateFileTreePluginSettings();
void save();
@@ -45,23 +45,22 @@
int sortRole() const;
void setSortRole(int);
-
+
bool showFullPathOnRoots() const;
void setShowFullPathOnRoots(bool);
-
- private:
+
+private:
KConfigGroup m_group;
-
+
bool m_shadingEnabled;
QColor m_viewShade;
QColor m_editShade;
bool m_listMode;
int m_sortRole;
-
+
bool m_showFullPathOnRoots;
};
#endif //KATE_FILETREE_PLUGIN_H
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreeproxymodel.cpp
^
|
@@ -25,59 +25,58 @@
#include <ktexteditor/document.h>
KateFileTreeProxyModel::KateFileTreeProxyModel(QObject *parent)
- : QSortFilterProxyModel(parent)
+ : QSortFilterProxyModel(parent)
{
}
-void KateFileTreeProxyModel::setSourceModel(QAbstractItemModel* model)
+void KateFileTreeProxyModel::setSourceModel(QAbstractItemModel *model)
{
- Q_ASSERT(qobject_cast<KateFileTreeModel*>(model)); // we don't realy work with anything else
- QSortFilterProxyModel::setSourceModel(model);
+ Q_ASSERT(qobject_cast<KateFileTreeModel *>(model)); // we don't realy work with anything else
+ QSortFilterProxyModel::setSourceModel(model);
}
bool KateFileTreeProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
{
- const KateFileTreeModel *model = static_cast<KateFileTreeModel*>(sourceModel());
+ const KateFileTreeModel *model = static_cast<KateFileTreeModel *>(sourceModel());
- const bool left_isdir = model->isDir(left);
- const bool right_isdir = model->isDir(right);
+ const bool left_isdir = model->isDir(left);
+ const bool right_isdir = model->isDir(right);
- // in tree mode, there will be parent nodes, we want to put those first
- if(left_isdir != right_isdir) {
- return ((left_isdir - right_isdir)) > 0;
- }
+ // in tree mode, there will be parent nodes, we want to put those first
+ if (left_isdir != right_isdir) {
+ return ((left_isdir - right_isdir)) > 0;
+ }
- QCollator collate;
- collate.setCaseSensitivity(Qt::CaseInsensitive);
+ QCollator collate;
+ collate.setCaseSensitivity(Qt::CaseInsensitive);
- switch(sortRole()) {
+ switch (sortRole()) {
case Qt::DisplayRole: {
- const QString left_name = model->data(left).toString();
- const QString right_name = model->data(right).toString();
- return collate.compare(left_name, right_name) < 0;
+ const QString left_name = model->data(left).toString();
+ const QString right_name = model->data(right).toString();
+ return collate.compare(left_name, right_name) < 0;
}
case KateFileTreeModel::PathRole: {
- const QString left_name = model->data(left, KateFileTreeModel::PathRole).toString();
- const QString right_name = model->data(right, KateFileTreeModel::PathRole).toString();
- return collate.compare(left_name, right_name) < 0;
+ const QString left_name = model->data(left, KateFileTreeModel::PathRole).toString();
+ const QString right_name = model->data(right, KateFileTreeModel::PathRole).toString();
+ return collate.compare(left_name, right_name) < 0;
}
case KateFileTreeModel::OpeningOrderRole:
- return (left.row() - right.row()) < 0;
- }
+ return (left.row() - right.row()) < 0;
+ }
- return false;
+ return false;
}
QModelIndex KateFileTreeProxyModel::docIndex(const KTextEditor::Document *doc) const
{
- return mapFromSource(static_cast<KateFileTreeModel*>(sourceModel())->docIndex(doc));
+ return mapFromSource(static_cast<KateFileTreeModel *>(sourceModel())->docIndex(doc));
}
bool KateFileTreeProxyModel::isDir(const QModelIndex &index) const
{
- return static_cast<KateFileTreeModel*>(sourceModel())->isDir(mapToSource(index));
+ return static_cast<KateFileTreeModel *>(sourceModel())->isDir(mapToSource(index));
}
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/katefiletreeproxymodel.h
^
|
@@ -22,25 +22,25 @@
#include <QSortFilterProxyModel>
-namespace KTextEditor {
- class Document;
+namespace KTextEditor
+{
+class Document;
}
class KateFileTreeProxyModel : public QSortFilterProxyModel
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
KateFileTreeProxyModel(QObject *p = 0);
QModelIndex docIndex(const KTextEditor::Document *) const;
bool isDir(const QModelIndex &i) const;
virtual void setSourceModel(QAbstractItemModel *model);
- protected:
+protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
};
#endif /* KATE_FILETREEPROXYMODEL_H */
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/filetree/ui.rc
^
|
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui>
-<gui name="katefiletreeplugin" library="katefiletreeplugin" version="6">
+<gui name="katefiletreeplugin" library="katefiletreeplugin" version="8">
<!-- merge in view -->
<MenuBar>
<Menu name="view">
@@ -10,11 +10,5 @@
<Action name="filetree_show_active_document" group="switch_document"/>
</Menu>
</MenuBar>
- <!-- merge in main toolbar -->
- <ToolBar name="mainToolBar">
- <text>Main Toolbar</text>
- <Action name="filetree_prev_document" group="switch_document"/>
- <Action name="filetree_next_document" group="switch_document"/>
- </ToolBar>
</gui>
<!-- kate: space-indent on; indent-width 4; replace-tabs on; -->
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/gdbplugin/22-actions-debug-kategdb.png
^
|
(renamed from upstream/addons/gdbplugin/hi22-action-debug-kategdb.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/gdbplugin/CMakeLists.txt
^
|
@@ -1,3 +1,4 @@
+add_definitions(-DTRANSLATION_DOMAIN=\"kategdbplugin\")
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(kategdbplugin_PART_SRCS
@@ -17,7 +18,6 @@
########### install files ###############
install(FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kategdb)
-install(TARGETS kategdbplugin DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES kategdbplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-ecm_install_icons (${ICON_INSTALL_DIR})
-kservice_desktop_to_json (kategdbplugin kategdbplugin.desktop)
+install(TARGETS kategdbplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
+ecm_install_icons(ICONS 22-actions-debug-kategdb.png DESTINATION ${ICON_INSTALL_DIR} THEME hicolor)
+kcoreaddons_desktop_to_json (kategdbplugin kategdbplugin.desktop)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/gdbplugin/kategdbplugin.desktop
^
|
@@ -54,6 +54,7 @@
Name[tr]=GDB
Name[ug]=GDB
Name[uk]=GDB
+Name[vi]=GDB
Name[wa]=GDB
Name[x-test]=xxGDBxx
Name[zh_CN]=GDB
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/kate-ctags/CMakeLists.txt
^
|
@@ -15,8 +15,7 @@
target_link_libraries(katectagsplugin KF5::TextEditor KF5::I18n KF5::IconThemes)
########### install files ###############
-install(TARGETS katectagsplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katectagsplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
install(FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/katectags)
-kservice_desktop_to_json (katectagsplugin katectagsplugin.desktop)
-install(FILES katectagsplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+kcoreaddons_desktop_to_json (katectagsplugin katectagsplugin.desktop)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/katebuild-plugin/CMakeLists.txt
^
|
@@ -1,5 +1,4 @@
-# Load the frameworks we need
-find_package(KF5 REQUIRED COMPONENTS Notifications)
+add_definitions(-DTRANSLATION_DOMAIN=\"katebuild-plugin\")
set(katebuild_SRCS plugin_katebuild.cpp targets.cpp selecttargetdialog.cpp)
@@ -11,7 +10,5 @@
########### install files ###############
install(FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/katebuild)
-install(TARGETS katebuildplugin DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES katebuildplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-ecm_install_icons (${ICON_INSTALL_DIR})
-kservice_desktop_to_json (katebuildplugin katebuildplugin.desktop)
+install(TARGETS katebuildplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
+kcoreaddons_desktop_to_json (katebuildplugin katebuildplugin.desktop)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/katebuild-plugin/plugin_katebuild.cpp
^
|
@@ -128,12 +128,12 @@
a = actionCollection()->addAction(QStringLiteral("goto_next"));
a->setText(i18n("Next Error"));
- a->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_Right));
+ actionCollection()->setDefaultShortcut(a, Qt::CTRL+Qt::ALT+Qt::Key_Right);
connect(a, SIGNAL(triggered(bool)), this, SLOT(slotNext()));
a = actionCollection()->addAction(QStringLiteral("goto_prev"));
a->setText(i18n("Previous Error"));
- a->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_Left));
+ actionCollection()->setDefaultShortcut(a, Qt::CTRL+Qt::ALT+Qt::Key_Left);
connect(a, SIGNAL(triggered(bool)), this, SLOT(slotPrev()));
// KF5 FIXME m_targetSelectAction = actionCollection()->add<KSelectAction>( "targets" );
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/katesql/CMakeLists.txt
^
|
@@ -1,8 +1,6 @@
project(katesqlplugin)
-# Load the frameworks we need
-find_package(KF5 REQUIRED COMPONENTS Wallet)
-
+add_definitions(-DTRANSLATION_DOMAIN=\"katesql\")
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
set(katesql_SRCS
@@ -34,11 +32,10 @@
KF5::Parts KF5::I18n KF5::Wallet
Qt5::Script Qt5::Sql KF5::ItemViews KF5::IconThemes)
-install(TARGETS katesqlplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katesqlplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
########### install files ###############
install( FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/katesql )
-kservice_desktop_to_json (katesqlplugin katesql.desktop)
-install( FILES katesql.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+kcoreaddons_desktop_to_json (katesqlplugin katesql.desktop)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/katesql/pics/16-actions-sql-field-pk.png
^
|
(renamed from upstream/addons/katesql/pics/hi16-actions-sql-field-pk.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/katesql/pics/16-actions-sql-field-red.png
^
|
(renamed from upstream/addons/katesql/pics/hi16-actions-sql-field-red.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/katesql/pics/16-actions-sql-field.png
^
|
(renamed from upstream/addons/katesql/pics/hi16-actions-sql-field.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/katesql/pics/16-actions-sql-table.png
^
|
(renamed from upstream/addons/katesql/pics/hi16-actions-sql-table.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/katesql/pics/16-actions-sql-view.png
^
|
(renamed from upstream/addons/katesql/pics/hi16-actions-sql-view.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/katesql/pics/CMakeLists.txt
^
|
@@ -1 +1,9 @@
-ecm_install_icons ( ${ICON_INSTALL_DIR} )
+ecm_install_icons(ICONS
+ 16-actions-sql-field-pk.png
+ 16-actions-sql-field.png
+ 16-actions-sql-field-red.png
+ 16-actions-sql-table.png
+ 16-actions-sql-view.png
+ DESTINATION ${ICON_INSTALL_DIR}
+ THEME hicolor
+)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/katesql/sqlmanager.cpp
^
|
@@ -372,17 +372,17 @@
if (query.isSelect())
{
if (!query.driver()->hasFeature(QSqlDriver::QuerySize))
- message = i18nc("@info/plain", "Query completed successfully");
+ message = i18nc("@info", "Query completed successfully");
else
{
int nRowsSelected = query.size();
- message = i18ncp("@info/plain", "%1 record selected", "%1 records selected", nRowsSelected);
+ message = i18ncp("@info", "%1 record selected", "%1 records selected", nRowsSelected);
}
}
else
{
int nRowsAffected = query.numRowsAffected();
- message = i18ncp("@info/plain", "%1 row affected", "%1 rows affected", nRowsAffected);
+ message = i18ncp("@info", "%1 row affected", "%1 rows affected", nRowsAffected);
}
emit success(message);
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/konsole/CMakeLists.txt
^
|
@@ -1,8 +1,5 @@
project(katekonsoleplugin)
-# Load the frameworks we need
-find_package(KF5 REQUIRED COMPONENTS ItemModels)
-
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
set(katekonsoleplugin_PART_SRCS kateconsole.cpp )
@@ -17,12 +14,11 @@
KF5::Service
)
-install(TARGETS katekonsoleplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katekonsoleplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
########### install files ###############
install( FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/katekonsole )
-kservice_desktop_to_json (katekonsoleplugin katekonsoleplugin.desktop)
-install( FILES katekonsoleplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+kcoreaddons_desktop_to_json (katekonsoleplugin katekonsoleplugin.desktop)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/konsole/kateconsole.cpp
^
|
@@ -43,8 +43,8 @@
#include <QVBoxLayout>
#include <QFileInfo>
-#include <kpluginloader.h>
-#include <kservice.h>
+#include <KPluginLoader>
+#include <KPluginFactory>
#include <kaboutdata.h>
#include <kpluginfactory.h>
#include <kauthorized.h>
@@ -161,16 +161,16 @@
if (!window() || !parentWidget()) return;
if (!window() || !isVisibleTo(window())) return;
+
+
+ /**
+ * get konsole part factory
+ */
+ KPluginFactory *factory = KPluginLoader(QStringLiteral("konsolepart")).factory();
+ if (!factory)
+ return;
- KPluginFactory* factory = 0;
- KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("konsolepart"));
- if (service) {
- factory = KPluginLoader(service->library()).factory();
- }
-
- if (!factory) return;
-
- m_part = static_cast<KParts::ReadOnlyPart *>(factory->create<QObject>(this, this));
+ m_part = factory->create<KParts::ReadOnlyPart>(this, this);
if (!m_part) return;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/kttsd/CMakeLists.txt
^
|
@@ -6,10 +6,9 @@
target_link_libraries(kate_kttsd ${KDE4_KDECORE_LIBS} ktexteditor ${KDE4_KPARTS_LIBS} kateinterfaces )
-install(TARGETS kate_kttsd DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS kate_kttsd DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
########### install files ###############
-install( FILES kate_kttsd.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kate/plugins/kate_kttsd)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/mailfiles/CMakeLists.txt
^
|
@@ -1,12 +1,12 @@
+add_definitions(-DTRANSLATION_DOMAIN=\"katemailfilesplugin\")
set(katemailfilesplugin_PART_SRCS katemailfiles.cpp katemailfilesdialog.cpp )
kde4_add_plugin(katemailfilesplugin ${katemailfilesplugin_PART_SRCS})
target_link_libraries(katemailfilesplugin ${KDE4_KDECORE_LIBS} ${KDE4_KPARTS_LIBS} kateinterfaces )
-install(TARGETS katemailfilesplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katemailfilesplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
########### install files ###############
install( FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kate/plugins/katemailfiles )
-install( FILES katemailfilesplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/pate/src/CMakeLists.txt
^
|
@@ -49,7 +49,7 @@
kateinterfaces
)
-install(TARGETS katepateplugin DESTINATION ${PLUGIN_INSTALL_DIR})
+install(TARGETS katepateplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
install(FILES katepythonplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
install(FILES pate.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kate/plugins/katepateplugin)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/pate/src/plugins/cmake_utils/settings.ui
^
|
@@ -35,7 +35,7 @@
<item row="1" column="1">
<widget class="QSpinBox" name="parentDirsLookupCnt">
<property name="toolTip">
- <string><p>How many parent directories to check for <filename>CMakeLists.txt</filename> if the latter is absent in a current document's path</p></string>
+ <string><p>How many parent directories to check for <tt>CMakeLists.txt</tt> if the latter is absent in a current document's path</p></string>
</property>
<property name="maximum">
<number>32</number>
@@ -45,7 +45,7 @@
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="toolTip">
- <string><p>How many parent directories to check for <filename>CMakeLists.txt</filename> if the latter is absent in a current document's path</p></string>
+ <string><p>How many parent directories to check for <tt>CMakeLists.txt</tt> if the latter is absent in a current document's path</p></string>
</property>
<property name="text">
<string>CMakeLists lookup parents:</string>
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/CMakeLists.txt
^
|
@@ -1,10 +1,8 @@
project(kateprojectplugin)
-# Load the frameworks we need
-find_package(KF5 REQUIRED COMPONENTS ItemModels)
-
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
+add_definitions(-DTRANSLATION_DOMAIN=\"kateproject\")
set(kateprojectplugin_PART_SRCS
kateprojectplugin.cpp
kateprojectpluginview.cpp
@@ -21,6 +19,7 @@
kateprojectinfoviewterminal.cpp
kateprojectinfoviewcodeanalysis.cpp
kateprojectinfoviewnotes.cpp
+ kateprojectconfigpage.cpp
)
add_library (kateprojectplugin MODULE ${kateprojectplugin_PART_SRCS})
@@ -31,10 +30,9 @@
Qt5::Script KF5::ItemViews KF5::ItemModels KF5::IconThemes)
########### install files ###############
-install(TARGETS kateprojectplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS kateprojectplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
install( FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kateproject )
install( FILES kateproject.example DESTINATION ${DATA_INSTALL_DIR}/kateproject )
-kservice_desktop_to_json (kateprojectplugin kateprojectplugin.desktop)
-install( FILES kateprojectplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+kcoreaddons_desktop_to_json (kateprojectplugin kateprojectplugin.desktop)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/ctags/readtags.c
^
|
@@ -16,7 +16,7 @@
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
-#include <sys/types.h> /* to declare off_t */
+#include <sys/types.h> /* to declare off_t */
#include "readtags.h"
@@ -25,7 +25,6 @@
*/
#define TAB '\t'
-
/*
* DATA DECLARATIONS
*/
@@ -36,52 +35,52 @@
/* Information about current tag file */
struct sTagFile {
- /* has the file been opened and this structure initialized? */
+ /* has the file been opened and this structure initialized? */
short initialized;
- /* format of tag file */
+ /* format of tag file */
short format;
- /* how is the tag file sorted? */
+ /* how is the tag file sorted? */
sortType sortMethod;
- /* pointer to file structure */
- FILE* fp;
- /* file position of first character of `line' */
+ /* pointer to file structure */
+ FILE *fp;
+ /* file position of first character of `line' */
off_t pos;
- /* size of tag file in seekable positions */
+ /* size of tag file in seekable positions */
off_t size;
- /* last line read */
+ /* last line read */
vstring line;
- /* name of tag in last line read */
+ /* name of tag in last line read */
vstring name;
- /* defines tag search state */
+ /* defines tag search state */
struct {
- /* file position of last match for tag */
- off_t pos;
- /* name of tag last searched for */
- const char *name;
- /* length of name for partial matches */
- size_t nameLength;
- /* peforming partial match */
- short partial;
- /* ignoring case */
- short ignorecase;
+ /* file position of last match for tag */
+ off_t pos;
+ /* name of tag last searched for */
+ const char *name;
+ /* length of name for partial matches */
+ size_t nameLength;
+ /* peforming partial match */
+ short partial;
+ /* ignoring case */
+ short ignorecase;
} search;
- /* miscellaneous extension fields */
+ /* miscellaneous extension fields */
struct {
- /* number of entries in `list' */
- unsigned short max;
- /* list of key value pairs */
- tagExtensionField *list;
+ /* number of entries in `list' */
+ unsigned short max;
+ /* list of key value pairs */
+ tagExtensionField *list;
} fields;
- /* buffers to be freed at close */
+ /* buffers to be freed at close */
struct {
- /* name of program author */
- char *author;
- /* name of program */
- char *name;
- /* URL of distribution */
- char *url;
- /* program version */
- char *version;
+ /* name of program author */
+ char *author;
+ /* name of program */
+ char *name;
+ /* URL of distribution */
+ char *url;
+ /* program version */
+ char *version;
} program;
};
@@ -102,75 +101,71 @@
* This makes a difference when one of the chars lies between upper and lower
* ie. one of the chars [ \ ] ^ _ ` for ascii. (The '_' in particular !)
*/
-static int struppercmp (const char *s1, const char *s2)
+static int struppercmp(const char *s1, const char *s2)
{
int result;
- do
- {
- result = toupper ((int) *s1) - toupper ((int) *s2);
+ do {
+ result = toupper((int) * s1) - toupper((int) * s2);
} while (result == 0 && *s1++ != '\0' && *s2++ != '\0');
return result;
}
-static int strnuppercmp (const char *s1, const char *s2, size_t n)
+static int strnuppercmp(const char *s1, const char *s2, size_t n)
{
int result;
- do
- {
- result = toupper ((int) *s1) - toupper ((int) *s2);
+ do {
+ result = toupper((int) * s1) - toupper((int) * s2);
} while (result == 0 && --n > 0 && *s1++ != '\0' && *s2++ != '\0');
return result;
}
-static int growString (vstring *s)
+static int growString(vstring *s)
{
int result = 0;
size_t newLength;
char *newLine;
- if (s->size == 0)
- {
- newLength = 128;
- newLine = (char*) malloc (newLength);
- *newLine = '\0';
- }
- else
- {
- newLength = 2 * s->size;
- newLine = (char*) realloc (s->buffer, newLength);
- }
- if (newLine == NULL)
- perror ("string too large");
- else
- {
- s->buffer = newLine;
- s->size = newLength;
- result = 1;
+ if (s->size == 0) {
+ newLength = 128;
+ newLine = (char *) malloc(newLength);
+ *newLine = '\0';
+ } else {
+ newLength = 2 * s->size;
+ newLine = (char *) realloc(s->buffer, newLength);
+ }
+ if (newLine == NULL) {
+ perror("string too large");
+ } else {
+ s->buffer = newLine;
+ s->size = newLength;
+ result = 1;
}
return result;
}
/* Copy name of tag out of tag line */
-static void copyName (tagFile *const file)
+static void copyName(tagFile *const file)
{
size_t length;
- const char *end = strchr (file->line.buffer, '\t');
- if (end == NULL)
- {
- end = strchr (file->line.buffer, '\n');
- if (end == NULL)
- end = strchr (file->line.buffer, '\r');
- }
- if (end != NULL)
- length = end - file->line.buffer;
- else
- length = strlen (file->line.buffer);
- while (length >= file->name.size)
- growString (&file->name);
- strncpy (file->name.buffer, file->line.buffer, length);
+ const char *end = strchr(file->line.buffer, '\t');
+ if (end == NULL) {
+ end = strchr(file->line.buffer, '\n');
+ if (end == NULL) {
+ end = strchr(file->line.buffer, '\r');
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/ctags/readtags.h
^
|
@@ -53,38 +53,37 @@
/* This structure contains information about the tag file. */
typedef struct {
- struct {
- /* was the tag file successfully opened? */
- int opened;
-
- /* errno value when 'opened' is false */
- int error_number;
- } status;
-
- /* information about the structure of the tag file */
- struct {
- /* format of tag file (1 = original, 2 = extended) */
- short format;
-
- /* how is the tag file sorted? */
- sortType sort;
- } file;
-
-
- /* information about the program which created this tag file */
- struct {
- /* name of author of generating program (may be null) */
- const char *author;
-
- /* name of program (may be null) */
- const char *name;
-
- /* URL of distribution (may be null) */
- const char *url;
-
- /* program version (may be null) */
- const char *version;
- } program;
+ struct {
+ /* was the tag file successfully opened? */
+ int opened;
+
+ /* errno value when 'opened' is false */
+ int error_number;
+ } status;
+
+ /* information about the structure of the tag file */
+ struct {
+ /* format of tag file (1 = original, 2 = extended) */
+ short format;
+
+ /* how is the tag file sorted? */
+ sortType sort;
+ } file;
+
+ /* information about the program which created this tag file */
+ struct {
+ /* name of author of generating program (may be null) */
+ const char *author;
+
+ /* name of program (may be null) */
+ const char *name;
+
+ /* URL of distribution (may be null) */
+ const char *url;
+
+ /* program version (may be null) */
+ const char *version;
+ } program;
} tagFileInfo;
@@ -93,52 +92,51 @@
*/
typedef struct {
- /* the key of the extension field */
- const char *key;
+ /* the key of the extension field */
+ const char *key;
- /* the value of the extension field (may be an empty string) */
- const char *value;
+ /* the value of the extension field (may be an empty string) */
+ const char *value;
} tagExtensionField;
/* This structure contains information about a specific tag. */
typedef struct {
- /* name of tag */
- const char *name;
+ /* name of tag */
+ const char *name;
- /* path of source file containing definition of tag */
- const char *file;
+ /* path of source file containing definition of tag */
+ const char *file;
- /* address for locating tag in source file */
- struct {
- /* pattern for locating source line
- * (may be NULL if not present) */
- const char *pattern;
-
- /* line number in source file of tag definition
- * (may be zero if not known) */
- unsigned long lineNumber;
- } address;
-
- /* kind of tag (may by name, character, or NULL if not known) */
- const char *kind;
-
- /* is tag of file-limited scope? */
- short fileScope;
-
- /* miscellaneous extension fields */
- struct {
- /* number of entries in `list' */
- unsigned short count;
-
- /* list of key value pairs */
- tagExtensionField *list;
- } fields;
+ /* address for locating tag in source file */
+ struct {
+ /* pattern for locating source line
+ * (may be NULL if not present) */
+ const char *pattern;
+
+ /* line number in source file of tag definition
+ * (may be zero if not known) */
+ unsigned long lineNumber;
+ } address;
+
+ /* kind of tag (may by name, character, or NULL if not known) */
+ const char *kind;
+
+ /* is tag of file-limited scope? */
+ short fileScope;
+
+ /* miscellaneous extension fields */
+ struct {
+ /* number of entries in `list' */
+ unsigned short count;
+
+ /* list of key value pairs */
+ tagExtensionField *list;
+ } fields;
} tagEntry;
-
/*
* FUNCTION PROTOTYPES
*/
@@ -154,7 +152,7 @@
* be set to the errno value representing the system error preventing the tag
* file from being successfully opened.
*/
-extern tagFile *tagsOpen (const char *const filePath, tagFileInfo *const info);
+extern tagFile *tagsOpen(const char *const filePath, tagFileInfo *const info);
/*
* This function allows the client to override the normal automatic detection
@@ -169,7 +167,7 @@
* it actually is not. The function will return TagSuccess if called on an
* open tag file or TagFailure if not.
*/
-extern tagResult tagsSetSortType (tagFile *const file, const sortType type);
+extern tagResult tagsSetSortType(tagFile *const file, const sortType type);
/*
* Reads the first tag in the file, if any. It is passed the handle to an
@@ -178,7 +176,7 @@
* The function will return TagSuccess another tag entry is found, or
* TagFailure if not (i.e. it reached end of file).
*/
-extern tagResult tagsFirst (tagFile *const file, tagEntry *const entry);
+extern tagResult tagsFirst(tagFile *const file, tagEntry *const entry);
/*
* Step to the next tag in the file, if any. It is passed the handle to an
@@ -188,7 +186,7 @@
* if not (i.e. it reached end of file). It will always read the first tag in
* the file immediately after calling tagsOpen().
*/
-extern tagResult tagsNext (tagFile *const file, tagEntry *const entry);
+extern tagResult tagsNext(tagFile *const file, tagEntry *const entry);
/*
* Retrieve the value associated with the extension field for a specified key.
@@ -197,7 +195,7 @@
* containing the key of the desired extension field. If no such field of the
* specified key exists, the function will return null.
*/
-extern const char *tagsField (const tagEntry *const entry, const char *const key);
+extern const char *tagsField(const tagEntry *const entry, const char *const key);
/*
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateproject.cpp
^
|
@@ -32,362 +32,393 @@
#include <QJsonDocument>
#include <QJsonParseError>
-KateProject::KateProject ()
- : QObject ()
- , m_worker (new KateProjectWorker (this))
- , m_thread (m_worker)
- , m_notesDocument (0)
- , m_documentsParent (0)
-{
- /**
- * move worker object over and start our worker thread
- * thread will delete worker on run() exit
- */
- m_worker->moveToThread (&m_thread);
- m_thread.start ();
-}
-
-KateProject::~KateProject ()
-{
- /**
- * only do this once
- */
- Q_ASSERT (m_worker);
-
- /**
- * quit the thread event loop and wait for completion
- * will delete worker on thread run() exit
- */
- m_thread.quit ();
- m_thread.wait ();
-
- /**
- * marks as deleted
- */
- m_worker = 0;
-
- /**
- * save notes document, if any
- */
- saveNotesDocument ();
-}
-
-bool KateProject::load (const QString &fileName)
-{
- /**
- * bail out if already fileName set!
- */
- if (!m_fileName.isEmpty())
- return false;
-
- /**
- * set new filename and base directory
- */
- m_fileName = fileName;
- m_baseDir = QFileInfo(m_fileName).canonicalPath();
-
- /**
- * trigger reload
- */
- return reload ();
-}
-
-bool KateProject::reload (bool force)
-{
- /**
- * open the file for reading, bail out on error!
- */
- QFile file (m_fileName);
- if (!file.open (QFile::ReadOnly))
- return false;
-
- /**
- * parse the whole file, bail out again on error!
- */
- const QByteArray jsonData = file.readAll();
- QJsonParseError parseError;
- QJsonDocument project (QJsonDocument::fromJson(jsonData, &parseError));
- if (parseError.error != QJsonParseError::NoError)
- return false;
-
- /**
- * now: get global group
- */
- QVariantMap globalProject = project.toVariant().toMap ();
-
- /**
- * no name, bad => bail out
- */
- if (globalProject[QStringLiteral("name")].toString().isEmpty())
- return false;
-
- /**
- * support out-of-source project files
- */
- if (!globalProject[QStringLiteral("directory")].toString().isEmpty())
- m_baseDir = QFileInfo (globalProject[QStringLiteral("directory")].toString()).canonicalFilePath ();
-
- /**
- * anything changed?
- * else be done without forced reload!
- */
- if (!force && (m_projectMap == globalProject))
- return true;
+KateProject::KateProject()
+ : QObject()
+ , m_worker(new KateProjectWorker(this))
+ , m_thread(m_worker)
+ , m_notesDocument(0)
+ , m_documentsParent(0)
+{
+ /**
+ * move worker object over and start our worker thread
+ * thread will delete worker on run() exit
+ */
+ m_worker->moveToThread(&m_thread);
+ m_thread.start();
+}
+
+KateProject::~KateProject()
+{
+ /**
+ * only do this once
+ */
+ Q_ASSERT(m_worker);
+
+ /**
+ * quit the thread event loop and wait for completion
+ * will delete worker on thread run() exit
+ */
+ m_thread.quit();
+ m_thread.wait();
+
+ /**
+ * marks as deleted
+ */
+ m_worker = 0;
+
+ /**
+ * save notes document, if any
+ */
+ saveNotesDocument();
+}
+
+bool KateProject::loadFromFile(const QString &fileName)
+{
+ /**
+ * bail out if already fileName set!
+ */
+ if (!m_fileName.isEmpty()) {
+ return false;
+ }
- /**
- * setup global attributes in this object
- */
- m_projectMap = globalProject;
-
- /**
- * emit that we changed stuff
- */
- emit projectMapChanged ();
-
- /**
- * trigger worker to REALLY load the project model and stuff
- */
- QMetaObject::invokeMethod (m_worker, "loadProject", Qt::QueuedConnection, Q_ARG(QString, m_baseDir), Q_ARG(QVariantMap, m_projectMap));
-
- /**
- * done ok ;)
- */
- return true;
-}
-
-void KateProject::loadProjectDone (KateProjectSharedQStandardItem topLevel, KateProjectSharedQMapStringItem file2Item)
-{
- /**
- * setup model data
- */
- m_model.clear ();
- m_model.invisibleRootItem()->appendColumn (topLevel->takeColumn (0));
-
- /**
- * setup file => item map
- */
- m_file2Item = file2Item;
-
- /**
- * readd the documents that are open atm
- */
- m_documentsParent = 0;
- foreach (KTextEditor::Document *document, m_documents.keys ())
- registerDocument (document);
-
- /**
- * model changed
- */
- emit modelChanged ();
-}
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateproject.h
^
|
@@ -48,38 +48,22 @@
*/
class KateProjectWorkerThread : public QThread
{
- public:
- /**
- * Construct thread for given worker
- */
- KateProjectWorkerThread (QObject *worker)
- : QThread()
- , m_worker (worker)
- {
- }
-
- protected:
- /**
- * start the thread event loop
- */
- virtual void run()
- {
- /**
- * run event loop
- */
- exec ();
-
- /**
- * kill worker in THIS thread
- */
- delete m_worker;
- }
-
- private:
- /**
- * Worker object
- */
- QObject *m_worker;
+public:
+ KateProjectWorkerThread(QObject *worker)
+ : QThread()
+ , m_worker (worker)
+ {
+ }
+
+protected:
+ virtual void run()
+ {
+ exec();
+ delete m_worker;
+ }
+
+private:
+ QObject *m_worker;
};
/**
@@ -88,26 +72,27 @@
*/
class KateProject : public QObject
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
/**
* construct empty project
*/
- KateProject ();
+ KateProject();
/**
* deconstruct project
*/
- ~KateProject ();
+ ~KateProject();
/**
- * Load a project.
+ * Load a project from project file
* Only works once, afterwards use reload().
* @param fileName name of project file
* @return success
*/
- bool load (const QString &fileName);
+ bool loadFromFile(const QString &fileName);
+ bool loadFromData(const QVariantMap &globalProject, const QString &directory);
/**
* Try to reload a project.
@@ -115,60 +100,54 @@
* @param force will enforce the worker to update files list and co even if the content of the file was not changed!
* @return success
*/
- bool reload (bool force = false);
+ bool reload(bool force = false);
/**
* Accessor to file name.
* @return file name
*/
- const QString &fileName () const
- {
- return m_fileName;
+ const QString &fileName() const {
+ return m_fileName;
}
-
+
/**
* Return the base directory of this project.
* @return base directory of project, might not be the directory of the fileName!
*/
- const QString &baseDir () const
- {
- return m_baseDir;
+ const QString &baseDir() const {
+ return m_baseDir;
}
/**
* Accessor to project map containing the whole project info.
* @return project info
*/
- const QVariantMap &projectMap () const
- {
- return m_projectMap;
+ const QVariantMap &projectMap() const {
+ return m_projectMap;
}
/**
* Accessor to project name.
* @return project name
*/
- QString name () const
- {
- return m_projectMap[QStringLiteral("name")].toString ();
+ QString name() const {
+ return m_projectMap[QStringLiteral("name")].toString();
}
/**
* Accessor for the model.
* @return model of this project
*/
- QStandardItemModel *model ()
- {
- return &m_model;
+ QStandardItemModel *model() {
+ return &m_model;
}
/**
* Flat list of all files in the project
* @return list of files in project
*/
- QStringList files ()
- {
- return m_file2Item ? m_file2Item->keys () : QStringList ();
+ QStringList files() {
+ return m_file2Item ? m_file2Item->keys() : QStringList();
}
/**
@@ -176,9 +155,8 @@
* @param file file to get item for
* @return item for given file or 0
*/
- KateProjectItem *itemForFile (const QString &file)
- {
- return m_file2Item ? m_file2Item->value (file) : 0;
+ KateProjectItem *itemForFile(const QString &file) {
+ return m_file2Item ? m_file2Item->value(file) : 0;
}
/**
@@ -187,84 +165,84 @@
* Don't store this pointer, might change.
* @return project index
*/
- KateProjectIndex *projectIndex ()
- {
- return m_projectIndex.data();
+ KateProjectIndex *projectIndex() {
+ return m_projectIndex.data();
}
-
+
/**
- * Will try to open a project local file.
- * Such files will be stored as .kateproject.d/file in the project directory.
- * @param file wanted file name, relative to .kateproject.d folder in project directory
- * @return either a pointer to a read-write opened file or null on error
+ * Computes a suitable file name for the given suffix.
+ * If you e.g. want to store a "notes" file, you could pass "notes" and get
+ * the full path to projectbasedir/.kateproject.notes
+ * @param suffix suffix for the file
+ * @return full path for project local file, on error => empty string
*/
- QFile *projectLocalFile (const QString &file) const;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectcompletion.cpp
^
|
@@ -26,183 +26,198 @@
#include <QIcon>
-KateProjectCompletion::KateProjectCompletion (KateProjectPlugin *plugin)
- : KTextEditor::CodeCompletionModel (0)
- , m_plugin (plugin)
+KateProjectCompletion::KateProjectCompletion(KateProjectPlugin *plugin)
+ : KTextEditor::CodeCompletionModel(0)
+ , m_plugin(plugin)
{
}
-KateProjectCompletion::~KateProjectCompletion ()
+KateProjectCompletion::~KateProjectCompletion()
{
}
-void KateProjectCompletion::saveMatches( KTextEditor::View* view, const KTextEditor::Range& range)
+void KateProjectCompletion::saveMatches(KTextEditor::View *view, const KTextEditor::Range &range)
{
- m_matches.clear ();
- allMatches( m_matches, view, range );
+ m_matches.clear();
+ allMatches(m_matches, view, range);
}
-QVariant KateProjectCompletion::data(const QModelIndex& index, int role) const
+QVariant KateProjectCompletion::data(const QModelIndex &index, int role) const
{
- if( role == InheritanceDepth )
- return 10010; //Very high value, so the word-completion group and items are shown behind any other groups/items if there is multiple
+ if (role == InheritanceDepth) {
+ return 10010; //Very high value, so the word-completion group and items are shown behind any other groups/items if there is multiple
+ }
- if( !index.parent().isValid() ) {
- //It is the group header
- switch ( role )
- {
- case Qt::DisplayRole:
- return i18n("Project Completion");
- case GroupRole:
- return Qt::DisplayRole;
+ if (!index.parent().isValid()) {
+ //It is the group header
+ switch (role) {
+ case Qt::DisplayRole:
+ return i18n("Project Completion");
+ case GroupRole:
+ return Qt::DisplayRole;
+ }
}
- }
- if( index.column() == KTextEditor::CodeCompletionModel::Name && role == Qt::DisplayRole )
- return m_matches.item ( index.row() )->data (Qt::DisplayRole);
+ if (index.column() == KTextEditor::CodeCompletionModel::Name && role == Qt::DisplayRole) {
+ return m_matches.item(index.row())->data(Qt::DisplayRole);
+ }
- if( index.column() == KTextEditor::CodeCompletionModel::Icon && role == Qt::DecorationRole ) {
- static QIcon icon(QIcon::fromTheme(QStringLiteral("insert-text")).pixmap(QSize(16, 16)));
- return icon;
- }
+ if (index.column() == KTextEditor::CodeCompletionModel::Icon && role == Qt::DecorationRole) {
+ static QIcon icon(QIcon::fromTheme(QStringLiteral("insert-text")).pixmap(QSize(16, 16)));
+ return icon;
+ }
- return QVariant();
+ return QVariant();
}
-QModelIndex KateProjectCompletion::parent(const QModelIndex& index) const
+QModelIndex KateProjectCompletion::parent(const QModelIndex &index) const
{
- if(index.internalId())
- return createIndex(0, 0, quintptr(0));
- else
- return QModelIndex();
+ if (index.internalId()) {
+ return createIndex(0, 0, quintptr(0));
+ } else {
+ return QModelIndex();
+ }
}
-QModelIndex KateProjectCompletion::index(int row, int column, const QModelIndex& parent) const
+QModelIndex KateProjectCompletion::index(int row, int column, const QModelIndex &parent) const
{
- if( !parent.isValid()) {
- if(row == 0)
- return createIndex(row, column, quintptr(0));
- else
- return QModelIndex();
-
- }else if(parent.parent().isValid())
- return QModelIndex();
+ if (!parent.isValid()) {
+ if (row == 0) {
+ return createIndex(row, column, quintptr(0));
+ } else {
+ return QModelIndex();
+ }
+ } else if (parent.parent().isValid()) {
+ return QModelIndex();
+ }
- if (row < 0 || row >= m_matches.rowCount() || column < 0 || column >= ColumnCount )
- return QModelIndex();
+ if (row < 0 || row >= m_matches.rowCount() || column < 0 || column >= ColumnCount) {
+ return QModelIndex();
+ }
- return createIndex(row, column, 1);
+ return createIndex(row, column, 1);
}
-int KateProjectCompletion::rowCount ( const QModelIndex & parent ) const
+int KateProjectCompletion::rowCount(const QModelIndex &parent) const
{
- if( !parent.isValid() && !(m_matches.rowCount() == 0) )
- return 1; //One root node to define the custom group
- else if(parent.parent().isValid())
- return 0; //Completion-items have no children
- else
- return m_matches.rowCount();
+ if (!parent.isValid() && !(m_matches.rowCount() == 0)) {
+ return 1; //One root node to define the custom group
+ } else if (parent.parent().isValid()) {
+ return 0; //Completion-items have no children
+ } else {
+ return m_matches.rowCount();
+ }
}
-
-bool KateProjectCompletion::shouldStartCompletion(KTextEditor::View* view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position)
+bool KateProjectCompletion::shouldStartCompletion(KTextEditor::View *view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position)
{
- if (!userInsertion) return false;
- if(insertedText.isEmpty())
+ if (!userInsertion) {
+ return false;
+ }
+ if (insertedText.isEmpty()) {
return false;
+ }
QString text = view->document()->line(position.line()).left(position.column());
-
- uint check=3;//v->config()->wordCompletionMinimalWordLength();
-
- if (check<=0) return true;
- int start=text.length();
- int end=text.length()-check;
- if (end<0) return false;
- for (int i=start-1;i>=end;i--) {
- QChar c=text.at(i);
- if (! (c.isLetter() || (c.isNumber()) || c==QLatin1Char('_')) ) return false;
+
+ uint check = 3; //v->config()->wordCompletionMinimalWordLength();
+
+ if (check <= 0) {
+ return true;
+ }
+ int start = text.length();
+ int end = text.length() - check;
+ if (end < 0) {
+ return false;
+ }
+ for (int i = start - 1; i >= end; i--) {
+ QChar c = text.at(i);
+ if (!(c.isLetter() || (c.isNumber()) || c == QLatin1Char('_'))) {
+ return false;
+ }
}
return true;
}
-bool KateProjectCompletion::shouldAbortCompletion(KTextEditor::View* view, const KTextEditor::Range &range, const QString ¤tCompletion) {
+bool KateProjectCompletion::shouldAbortCompletion(KTextEditor::View *view, const KTextEditor::Range &range, const QString ¤tCompletion)
+{
if (m_automatic) {
- if (currentCompletion.length() < 3 /*v->config()->wordCompletionMinimalWordLength()*/) return true;
+ if (currentCompletion.length() < 3 /*v->config()->wordCompletionMinimalWordLength()*/) {
+ return true;
+ }
}
- return CodeCompletionModelControllerInterface::shouldAbortCompletion(view,range,currentCompletion);
+ return CodeCompletionModelControllerInterface::shouldAbortCompletion(view, range, currentCompletion);
}
-void KateProjectCompletion::completionInvoked(KTextEditor::View* view, const KTextEditor::Range& range, InvocationType it)
+void KateProjectCompletion::completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType it)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectcompletion.h
^
|
@@ -33,21 +33,21 @@
*/
class KateProjectCompletion : public KTextEditor::CodeCompletionModel, public KTextEditor::CodeCompletionModelControllerInterface
{
- Q_OBJECT
-
- Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface)
+ Q_OBJECT
- public:
+ Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface)
+
+public:
/**
* Construct project completion.
* @param plugin our plugin
*/
- KateProjectCompletion (class KateProjectPlugin *plugin);
+ KateProjectCompletion(class KateProjectPlugin *plugin);
/**
* Deconstruct project completion.
*/
- ~KateProjectCompletion ();
+ ~KateProjectCompletion();
/**
* This function is responsible to generating / updating the list of current
@@ -59,29 +59,26 @@
* @param view The view to generate completions for
* @param range The range of text to generate completions for
* */
- void completionInvoked(KTextEditor::View* view, const KTextEditor::Range& range, InvocationType invocationType);
+ void completionInvoked(KTextEditor::View *view, const KTextEditor::Range &range, InvocationType invocationType);
-
- bool shouldStartCompletion(KTextEditor::View* view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position);
- bool shouldAbortCompletion(KTextEditor::View* view, const KTextEditor::Range &range, const QString ¤tCompletion);
+ bool shouldStartCompletion(KTextEditor::View *view, const QString &insertedText, bool userInsertion, const KTextEditor::Cursor &position);
+ bool shouldAbortCompletion(KTextEditor::View *view, const KTextEditor::Range &range, const QString ¤tCompletion);
-
-
- void saveMatches( KTextEditor::View* view,
- const KTextEditor::Range& range);
+ void saveMatches(KTextEditor::View *view,
+ const KTextEditor::Range &range);
- int rowCount ( const QModelIndex & parent ) const;
+ int rowCount(const QModelIndex &parent) const;
- QVariant data(const QModelIndex& index, int role) const;
- virtual QModelIndex index(int row, int column, const QModelIndex& parent=QModelIndex()) const;
- virtual QModelIndex parent(const QModelIndex& index) const;
- virtual MatchReaction matchingItem(const QModelIndex& matched);
+ QVariant data(const QModelIndex &index, int role) const;
+ virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+ virtual QModelIndex parent(const QModelIndex &index) const;
+ virtual MatchReaction matchingItem(const QModelIndex &matched);
- virtual KTextEditor::Range completionRange(KTextEditor::View* view, const KTextEditor::Cursor &position);
+ virtual KTextEditor::Range completionRange(KTextEditor::View *view, const KTextEditor::Cursor &position);
- void allMatches( QStandardItemModel &model, KTextEditor::View *view, const KTextEditor::Range &range ) const;
+ void allMatches(QStandardItemModel &model, KTextEditor::View *view, const KTextEditor::Range &range) const;
- private:
+private:
/**
* our plugin view
*/
@@ -91,7 +88,7 @@
* model with matching data
*/
QStandardItemModel m_matches;
-
+
/**
* automatic invocation?
*/
@@ -100,4 +97,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectconfigpage.cpp
^
|
@@ -0,0 +1,109 @@
+/* This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "kateprojectconfigpage.h"
+#include "kateprojectplugin.h"
+
+#include <QLabel>
+#include <QVBoxLayout>
+#include <QCheckBox>
+#include <QGroupBox>
+#include <KLocalizedString>
+
+KateProjectConfigPage::KateProjectConfigPage(QWidget *parent, KateProjectPlugin *plugin)
+ : KTextEditor::ConfigPage(parent)
+ , m_plugin(plugin)
+ , m_changed(false)
+{
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->setMargin(0);
+
+ QVBoxLayout *vbox = new QVBoxLayout;
+ QGroupBox *group = new QGroupBox(i18n("Autoload repositories"), this);
+ group->setWhatsThis(i18n(
+ "Project plugin is able to autoload repository working copies in case "
+ "there is .kateproject file already defined"));
+
+ m_cbAutoGit = new QCheckBox(i18n("&Git"), this);
+ vbox->addWidget(m_cbAutoGit);
+
+ m_cbAutoSubversion = new QCheckBox(i18n("&Subversion"), this);
+ vbox->addWidget(m_cbAutoSubversion);
+ m_cbAutoMercurial = new QCheckBox(i18n("&Mercurial"), this);
+ vbox->addWidget(m_cbAutoMercurial);
+
+ vbox->addStretch(1);
+ group->setLayout(vbox);
+
+ layout->addWidget(group);
+ layout->insertStretch(-1, 10);
+
+ reset();
+
+ connect(m_cbAutoGit, &QCheckBox::stateChanged, this, &KateProjectConfigPage::slotMyChanged);
+ connect(m_cbAutoSubversion, &QCheckBox::stateChanged, this, &KateProjectConfigPage::slotMyChanged);
+ connect(m_cbAutoMercurial, &QCheckBox::stateChanged, this, &KateProjectConfigPage::slotMyChanged);
+}
+
+QString KateProjectConfigPage::name() const
+{
+ return QString(i18n("Projects"));
+}
+
+QString KateProjectConfigPage::fullName() const
+{
+ return QString(i18n("Projects properties"));
+}
+
+QIcon KateProjectConfigPage::icon() const
+{
+ return QIcon::fromTheme(QLatin1String("view-list-tree"));
+}
+
+void KateProjectConfigPage::apply()
+{
+ if (!m_changed) {
+ return;
+ }
+
+ m_changed = false;
+
+ m_plugin->setAutoRepository(
+ m_cbAutoGit->checkState() == Qt::Checked,
+ m_cbAutoSubversion->checkState() == Qt::Checked,
+ m_cbAutoMercurial->checkState() == Qt::Checked);
+}
+
+void KateProjectConfigPage::reset()
+{
+ m_cbAutoGit->setCheckState(m_plugin->autoGit() ? Qt::Checked : Qt::Unchecked);
+ m_cbAutoSubversion->setCheckState(m_plugin->autoSubversion() ? Qt::Checked : Qt::Unchecked);
+ m_cbAutoMercurial->setCheckState(m_plugin->autoMercurial() ? Qt::Checked : Qt::Unchecked);
+ m_changed = false;
+}
+
+void KateProjectConfigPage::defaults()
+{
+ reset();
+}
+
+void KateProjectConfigPage::slotMyChanged()
+{
+ m_changed = true;
+ emit changed();
+}
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectconfigpage.h
^
|
@@ -0,0 +1,55 @@
+/* This file is part of the KDE project
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KATE_PROJECT_CONFIGPAGE_H
+#define KATE_PROJECT_CONFIGPAGE_H
+
+#include <ktexteditor/configpage.h>
+
+class KateProjectPlugin;
+class QWidget;
+class QCheckBox;
+
+class KateProjectConfigPage : public KTextEditor::ConfigPage
+{
+ Q_OBJECT
+public:
+ explicit KateProjectConfigPage(QWidget *parent = nullptr, KateProjectPlugin *plugin = nullptr);
+ ~KateProjectConfigPage() {};
+
+ virtual QString name() const;
+ virtual QString fullName() const;
+ virtual QIcon icon() const;
+
+public Q_SLOTS:
+ void apply();
+ void defaults();
+ void reset();
+
+private Q_SLOTS:
+ void slotMyChanged();
+
+private:
+ QCheckBox *m_cbAutoGit;
+ QCheckBox *m_cbAutoSubversion;
+ QCheckBox *m_cbAutoMercurial;
+ KateProjectPlugin *m_plugin;
+ bool m_changed;
+};
+
+#endif /* KATE_PROJECT_CONFIGPAGE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectindex.cpp
^
|
@@ -28,166 +28,174 @@
*/
#include "ctags/readtags.c"
-KateProjectIndex::KateProjectIndex (const QStringList &files)
- : m_ctagsIndexFile (QDir::tempPath () + QStringLiteral("/kate.project.ctags"))
- , m_ctagsIndexHandle (0)
+KateProjectIndex::KateProjectIndex(const QStringList &files)
+ : m_ctagsIndexFile(QDir::tempPath() + QStringLiteral("/kate.project.ctags"))
+ , m_ctagsIndexHandle(0)
{
- /**
- * load ctags
- */
- loadCtags (files);
+ /**
+ * load ctags
+ */
+ loadCtags(files);
}
-KateProjectIndex::~KateProjectIndex ()
+KateProjectIndex::~KateProjectIndex()
{
- /**
- * delete ctags handle if any
- */
- if (m_ctagsIndexHandle) {
- tagsClose (m_ctagsIndexHandle);
- m_ctagsIndexHandle = 0;
- }
+ /**
+ * delete ctags handle if any
+ */
+ if (m_ctagsIndexHandle) {
+ tagsClose(m_ctagsIndexHandle);
+ m_ctagsIndexHandle = 0;
+ }
}
-void KateProjectIndex::loadCtags (const QStringList &files)
+void KateProjectIndex::loadCtags(const QStringList &files)
{
- /**
- * create temporary file
- * if not possible, fail
- */
- if (!m_ctagsIndexFile.open ())
- return;
-
- /**
- * close file again, other process will use it
- */
- m_ctagsIndexFile.close ();
-
- /**
- * try to run ctags for all files in this project
- * output to our ctags index file
- */
- QProcess ctags;
- QStringList args;
- args << QStringLiteral("-L") << QStringLiteral("-") << QStringLiteral("-f") << m_ctagsIndexFile.fileName() << QStringLiteral("--fields=+K+n");
- ctags.start(QStringLiteral("ctags"), args);
- if (!ctags.waitForStarted())
- return;
-
- /**
- * write files list and close write channel
- */
- ctags.write(files.join(QStringLiteral("\n")).toLocal8Bit());
- ctags.closeWriteChannel();
-
- /**
- * wait for done
- */
- if (!ctags.waitForFinished())
- return;
-
- /**
- * file not openable, bad
- */
- if (!m_ctagsIndexFile.open ())
- return;
-
- /**
- * get size
- */
- qint64 size = m_ctagsIndexFile.size ();
-
- /**
- * close again
- */
- m_ctagsIndexFile.close ();
-
- /**
- * empty file, bad
- */
- if (!size)
- return;
-
- /**
- * try to open ctags file
- */
- tagFileInfo info;
- memset (&info, 0, sizeof (tagFileInfo));
- m_ctagsIndexHandle = tagsOpen (m_ctagsIndexFile.fileName().toLocal8Bit().constData(), &info);
+ /**
+ * create temporary file
+ * if not possible, fail
+ */
+ if (!m_ctagsIndexFile.open()) {
+ return;
+ }
+
+ /**
+ * close file again, other process will use it
+ */
+ m_ctagsIndexFile.close();
+
+ /**
+ * try to run ctags for all files in this project
+ * output to our ctags index file
+ */
+ QProcess ctags;
+ QStringList args;
+ args << QStringLiteral("-L") << QStringLiteral("-") << QStringLiteral("-f") << m_ctagsIndexFile.fileName() << QStringLiteral("--fields=+K+n");
+ ctags.start(QStringLiteral("ctags"), args);
+ if (!ctags.waitForStarted()) {
+ return;
+ }
+
+ /**
+ * write files list and close write channel
+ */
+ ctags.write(files.join(QStringLiteral("\n")).toLocal8Bit());
+ ctags.closeWriteChannel();
+
+ /**
+ * wait for done
+ */
+ if (!ctags.waitForFinished()) {
+ return;
+ }
+
+ /**
+ * file not openable, bad
+ */
+ if (!m_ctagsIndexFile.open()) {
+ return;
+ }
+
+ /**
+ * get size
+ */
+ qint64 size = m_ctagsIndexFile.size();
+
+ /**
+ * close again
+ */
+ m_ctagsIndexFile.close();
+
+ /**
+ * empty file, bad
+ */
+ if (!size) {
+ return;
+ }
+
+ /**
+ * try to open ctags file
+ */
+ tagFileInfo info;
+ memset(&info, 0, sizeof(tagFileInfo));
+ m_ctagsIndexHandle = tagsOpen(m_ctagsIndexFile.fileName().toLocal8Bit().constData(), &info);
}
-void KateProjectIndex::findMatches (QStandardItemModel &model, const QString &searchWord, MatchType type)
+void KateProjectIndex::findMatches(QStandardItemModel &model, const QString &searchWord, MatchType type)
{
- /**
- * abort if no ctags index
- */
- if (!m_ctagsIndexHandle)
- return;
-
- /**
- * word to complete
- * abort if empty
- */
- QByteArray word = searchWord.toLocal8Bit();
- if (word.isEmpty())
- return;
-
- /**
- * try to search entry
- * fail if none found
- */
- tagEntry entry;
- if (tagsFind (m_ctagsIndexHandle, &entry, word.constData(), TAG_PARTIALMATCH | TAG_OBSERVECASE) != TagSuccess)
- return;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectindex.h
^
|
@@ -42,18 +42,18 @@
*/
class KateProjectIndex
{
- public:
+public:
/**
* construct new index for given files
* @param files files to index
*/
- KateProjectIndex (const QStringList &files);
+ KateProjectIndex(const QStringList &files);
/**
* deconstruct project
*/
- ~KateProjectIndex ();
-
+ ~KateProjectIndex();
+
/**
* Which kind of match items should be created in the passed model
* of the findMatches function?
@@ -63,7 +63,7 @@
* Completion matches, containing only name and same name only once
*/
CompletionMatches,
-
+
/**
* Find matches, containing name, kind, file, line, ...
*/
@@ -77,31 +77,30 @@
* @param searchWord word to search for
* @param type type of matches
*/
- void findMatches (QStandardItemModel &model, const QString &searchWord, MatchType type);
+ void findMatches(QStandardItemModel &model, const QString &searchWord, MatchType type);
/**
* Check if running ctags was successful. This can be used
* as indicator whether ctags is installed or not.
* @return true if a valid index exists, otherwise false
*/
- bool isValid () const
- {
- return m_ctagsIndexHandle;
+ bool isValid() const {
+ return m_ctagsIndexHandle;
}
- private:
+private:
/**
* Load ctags tags.
* @param files files to index
*/
- void loadCtags (const QStringList &files);
-
- private:
+ void loadCtags(const QStringList &files);
+
+private:
/**
* ctags index file
*/
QTemporaryFile m_ctagsIndexFile;
-
+
/**
* handle to ctags file for querying, if possible
*/
@@ -110,4 +109,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectinfoview.cpp
^
|
@@ -27,34 +27,33 @@
#include "klocalizedstring.h"
-KateProjectInfoView::KateProjectInfoView (KateProjectPluginView *pluginView, KateProject *project)
- : QTabWidget ()
- , m_pluginView (pluginView)
- , m_project (project)
+KateProjectInfoView::KateProjectInfoView(KateProjectPluginView *pluginView, KateProject *project)
+ : QTabWidget()
+ , m_pluginView(pluginView)
+ , m_project(project)
{
- /**
- * terminal
- */
- addTab (new KateProjectInfoViewTerminal (pluginView, project), i18n("Terminal"));
-
- /**
- * index
- */
- addTab (new KateProjectInfoViewIndex (pluginView, project), i18n("Code Index"));
-
- /**
- * code analysis
- */
- addTab (new KateProjectInfoViewCodeAnalysis (pluginView, project), i18n("Code Analysis"));
-
- /**
- * notes
- */
- addTab (new KateProjectInfoViewNotes (pluginView, project), i18n("Notes"));
+ /**
+ * terminal
+ */
+ addTab(new KateProjectInfoViewTerminal(pluginView, project), i18n("Terminal"));
+
+ /**
+ * index
+ */
+ addTab(new KateProjectInfoViewIndex(pluginView, project), i18n("Code Index"));
+
+ /**
+ * code analysis
+ */
+ addTab(new KateProjectInfoViewCodeAnalysis(pluginView, project), i18n("Code Analysis"));
+
+ /**
+ * notes
+ */
+ addTab(new KateProjectInfoViewNotes(pluginView, project), i18n("Notes"));
}
-KateProjectInfoView::~KateProjectInfoView ()
+KateProjectInfoView::~KateProjectInfoView()
{
}
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectinfoview.h
^
|
@@ -33,31 +33,30 @@
*/
class KateProjectInfoView : public QTabWidget
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
/**
* construct project info view for given project
* @param pluginView our plugin view
* @param project project this view is for
*/
- KateProjectInfoView (KateProjectPluginView *pluginView, KateProject *project);
+ KateProjectInfoView(KateProjectPluginView *pluginView, KateProject *project);
/**
* deconstruct info view
*/
- ~KateProjectInfoView ();
+ ~KateProjectInfoView();
/**
* our project.
* @return project
*/
- KateProject *project () const
- {
- return m_project;
+ KateProject *project() const {
+ return m_project;
}
- private:
+private:
/**
* our plugin view
*/
@@ -71,4 +70,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectinfoviewcodeanalysis.cpp
^
|
@@ -29,160 +29,162 @@
#include <klocalizedstring.h>
#include <kmessagewidget.h>
-KateProjectInfoViewCodeAnalysis::KateProjectInfoViewCodeAnalysis (KateProjectPluginView *pluginView, KateProject *project)
- : QWidget ()
- , m_pluginView (pluginView)
- , m_project (project)
- , m_messageWidget (0)
- , m_startStopAnalysis (new QPushButton(i18n("Start Analysis...")))
- , m_treeView (new QTreeView())
- , m_model (new QStandardItemModel (m_treeView))
- , m_analyzer (0)
+KateProjectInfoViewCodeAnalysis::KateProjectInfoViewCodeAnalysis(KateProjectPluginView *pluginView, KateProject *project)
+ : QWidget()
+ , m_pluginView(pluginView)
+ , m_project(project)
+ , m_messageWidget(0)
+ , m_startStopAnalysis(new QPushButton(i18n("Start Analysis...")))
+ , m_treeView(new QTreeView())
+ , m_model(new QStandardItemModel(m_treeView))
+ , m_analyzer(0)
{
- /**
- * default style
- */
- m_treeView->setEditTriggers (QAbstractItemView::NoEditTriggers);
- m_treeView->setUniformRowHeights (true);
- m_treeView->setRootIsDecorated (false);
- m_model->setHorizontalHeaderLabels (QStringList () << QStringLiteral("File") << QStringLiteral("Line") << QStringLiteral("Severity") << QStringLiteral("Message"));
-
- /**
- * attach model
- * kill selection model
- */
- QItemSelectionModel *m = m_treeView->selectionModel();
- m_treeView->setModel (m_model);
- delete m;
-
- /**
- * layout widget
- */
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setSpacing (0);
- layout->addWidget (m_treeView);
- QHBoxLayout *hlayout = new QHBoxLayout;
- layout->addLayout (hlayout);
- hlayout->setSpacing (0);
- hlayout->addStretch();
- hlayout->addWidget (m_startStopAnalysis);
- setLayout (layout);
-
- /**
- * connect needed signals
- */
- connect (m_startStopAnalysis, SIGNAL(clicked (bool)), this, SLOT(slotStartStopClicked ()));
- connect (m_treeView, SIGNAL(clicked (const QModelIndex &)), this, SLOT(slotClicked (const QModelIndex &)));
+ /**
+ * default style
+ */
+ m_treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
+ m_treeView->setUniformRowHeights(true);
+ m_treeView->setRootIsDecorated(false);
+ m_model->setHorizontalHeaderLabels(QStringList() << QStringLiteral("File") << QStringLiteral("Line") << QStringLiteral("Severity") << QStringLiteral("Message"));
+
+ /**
+ * attach model
+ * kill selection model
+ */
+ QItemSelectionModel *m = m_treeView->selectionModel();
+ m_treeView->setModel(m_model);
+ delete m;
+
+ /**
+ * layout widget
+ */
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->setSpacing(0);
+ layout->addWidget(m_treeView);
+ QHBoxLayout *hlayout = new QHBoxLayout;
+ layout->addLayout(hlayout);
+ hlayout->setSpacing(0);
+ hlayout->addStretch();
+ hlayout->addWidget(m_startStopAnalysis);
+ setLayout(layout);
+
+ /**
+ * connect needed signals
+ */
+ connect(m_startStopAnalysis, SIGNAL(clicked(bool)), this, SLOT(slotStartStopClicked()));
+ connect(m_treeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotClicked(const QModelIndex &)));
}
-KateProjectInfoViewCodeAnalysis::~KateProjectInfoViewCodeAnalysis ()
+KateProjectInfoViewCodeAnalysis::~KateProjectInfoViewCodeAnalysis()
{
}
-void KateProjectInfoViewCodeAnalysis::slotStartStopClicked ()
+void KateProjectInfoViewCodeAnalysis::slotStartStopClicked()
{
- /**
- * get files for cppcheck
- */
- QStringList files = m_project->files ().filter (QRegExp (QStringLiteral("\\.(cpp|cxx|cc|c\\+\\+|c|tpp|txx)$")));
-
- /**
- * clear existing entries
- */
- m_model->removeRows(0,m_model->rowCount(),QModelIndex());
-
- /**
- * launch cppcheck
- */
- m_analyzer = new QProcess (this);
- m_analyzer->setProcessChannelMode(QProcess::MergedChannels);
-
- connect (m_analyzer, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
-
- QStringList args;
- args << QStringLiteral("-q") << QStringLiteral("--inline-suppr") << QStringLiteral("--enable=all") << QStringLiteral("--template={file}////{line}////{severity}////{message}") << QStringLiteral("--file-list=-");
- m_analyzer->start(QStringLiteral("cppcheck"), args);
-
- if (m_messageWidget) {
- delete m_messageWidget;
- m_messageWidget=0;
- }
-
- if (!m_analyzer->waitForStarted()) {
- m_messageWidget = new KMessageWidget();
- m_messageWidget->setCloseButtonVisible(true);
- m_messageWidget->setMessageType(KMessageWidget::Warning);
- m_messageWidget->setWordWrap(false);
- m_messageWidget->setText(i18n("Please install 'cppcheck'."));
- static_cast<QVBoxLayout*>(layout ())->insertWidget(0, m_messageWidget);
- m_messageWidget->animatedShow ();
- return;
- }
- /**
- * write files list and close write channel
- */
- m_analyzer->write(files.join(QStringLiteral("\n")).toLocal8Bit());
- m_analyzer->closeWriteChannel();
+ /**
+ * get files for cppcheck
+ */
+ QStringList files = m_project->files().filter(QRegExp(QStringLiteral("\\.(cpp|cxx|cc|c\\+\\+|c|tpp|txx)$")));
+
+ /**
+ * clear existing entries
+ */
+ m_model->removeRows(0, m_model->rowCount(), QModelIndex());
+
+ /**
+ * launch cppcheck
+ */
+ m_analyzer = new QProcess(this);
+ m_analyzer->setProcessChannelMode(QProcess::MergedChannels);
+
+ connect(m_analyzer, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
+
+ QStringList args;
+ args << QStringLiteral("-q") << QStringLiteral("--inline-suppr") << QStringLiteral("--enable=all") << QStringLiteral("--template={file}////{line}////{severity}////{message}") << QStringLiteral("--file-list=-");
+ m_analyzer->start(QStringLiteral("cppcheck"), args);
+
+ if (m_messageWidget) {
+ delete m_messageWidget;
+ m_messageWidget = 0;
+ }
+
+ if (!m_analyzer->waitForStarted()) {
+ m_messageWidget = new KMessageWidget();
+ m_messageWidget->setCloseButtonVisible(true);
+ m_messageWidget->setMessageType(KMessageWidget::Warning);
+ m_messageWidget->setWordWrap(false);
+ m_messageWidget->setText(i18n("Please install 'cppcheck'."));
+ static_cast<QVBoxLayout *>(layout())->insertWidget(0, m_messageWidget);
+ m_messageWidget->animatedShow();
+ return;
+ }
+ /**
+ * write files list and close write channel
+ */
+ m_analyzer->write(files.join(QStringLiteral("\n")).toLocal8Bit());
+ m_analyzer->closeWriteChannel();
}
-void KateProjectInfoViewCodeAnalysis::slotReadyRead ()
+void KateProjectInfoViewCodeAnalysis::slotReadyRead()
{
- /**
- * get results of analysis
- */
- while (m_analyzer->canReadLine()) {
- /**
- * get one line, split it, skip it, if too few elements
- */
- QString line = QString::fromLocal8Bit (m_analyzer->readLine());
- QStringList elements = line.split (QRegExp(QStringLiteral("////")), QString::SkipEmptyParts);
- if (elements.size() < 4)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectinfoviewcodeanalysis.h
^
|
@@ -36,48 +36,47 @@
*/
class KateProjectInfoViewCodeAnalysis : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
/**
* construct project info view for given project
* @param pluginView our plugin view
* @param project project this view is for
*/
- KateProjectInfoViewCodeAnalysis (KateProjectPluginView *pluginView, KateProject *project);
+ KateProjectInfoViewCodeAnalysis(KateProjectPluginView *pluginView, KateProject *project);
/**
* deconstruct info view
*/
- ~KateProjectInfoViewCodeAnalysis ();
+ ~KateProjectInfoViewCodeAnalysis();
/**
* our project.
* @return project
*/
- KateProject *project () const
- {
- return m_project;
+ KateProject *project() const {
+ return m_project;
}
- private Q_SLOTS:
+private Q_SLOTS:
/**
* Called if start/stop button is clicked.
*/
- void slotStartStopClicked ();
+ void slotStartStopClicked();
/**
* More checker output is available
*/
- void slotReadyRead ();
+ void slotReadyRead();
/**
* item got clicked, do stuff, like open document
* @param index model index of clicked item
*/
- void slotClicked (const QModelIndex &index);
+ void slotClicked(const QModelIndex &index);
- private:
+private:
/**
* our plugin view
*/
@@ -116,4 +115,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectinfoviewindex.cpp
^
|
@@ -25,130 +25,135 @@
#include <klocalizedstring.h>
#include <kmessagewidget.h>
-KateProjectInfoViewIndex::KateProjectInfoViewIndex (KateProjectPluginView *pluginView, KateProject *project)
- : QWidget ()
- , m_pluginView (pluginView)
- , m_project (project)
- , m_messageWidget (0)
- , m_lineEdit (new QLineEdit())
- , m_treeView (new QTreeView())
- , m_model (new QStandardItemModel (m_treeView))
+KateProjectInfoViewIndex::KateProjectInfoViewIndex(KateProjectPluginView *pluginView, KateProject *project)
+ : QWidget()
+ , m_pluginView(pluginView)
+ , m_project(project)
+ , m_messageWidget(0)
+ , m_lineEdit(new QLineEdit())
+ , m_treeView(new QTreeView())
+ , m_model(new QStandardItemModel(m_treeView))
{
- /**
- * default style
- */
- m_treeView->setEditTriggers (QAbstractItemView::NoEditTriggers);
- m_treeView->setUniformRowHeights (true);
- m_treeView->setRootIsDecorated (false);
- m_model->setHorizontalHeaderLabels (QStringList () << i18n ("Name") << i18n ("Kind") << i18n ("File") << i18n ("Line"));
-
- /**
- * attach model
- * kill selection model
- */
- QItemSelectionModel *m = m_treeView->selectionModel();
- m_treeView->setModel (m_model);
- delete m;
-
- /**
- * layout widget
- */
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setSpacing (0);
- layout->addWidget (m_lineEdit);
- layout->addWidget (m_treeView);
- setLayout (layout);
-
- /**
- * connect needed signals
- */
- connect (m_lineEdit, SIGNAL(textChanged (const QString &)), this, SLOT(slotTextChanged (const QString &)));
- connect (m_treeView, SIGNAL(clicked (const QModelIndex &)), this, SLOT(slotClicked (const QModelIndex &)));
- connect (m_project, SIGNAL(indexChanged ()), this, SLOT(indexAvailable ()));
-
- /**
- * trigger once search with nothing
- */
- slotTextChanged (QString());
+ /**
+ * default style
+ */
+ m_treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
+ m_treeView->setUniformRowHeights(true);
+ m_treeView->setRootIsDecorated(false);
+ m_model->setHorizontalHeaderLabels(QStringList() << i18n("Name") << i18n("Kind") << i18n("File") << i18n("Line"));
+ m_lineEdit->setPlaceholderText(i18n("Search"));
+ m_lineEdit->setClearButtonEnabled(true);
+
+ /**
+ * attach model
+ * kill selection model
+ */
+ QItemSelectionModel *m = m_treeView->selectionModel();
+ m_treeView->setModel(m_model);
+ delete m;
+
+ /**
+ * layout widget
+ */
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->setSpacing(0);
+ layout->addWidget(m_lineEdit);
+ layout->addWidget(m_treeView);
+ setLayout(layout);
+
+ /**
+ * connect needed signals
+ */
+ connect(m_lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotTextChanged(const QString &)));
+ connect(m_treeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotClicked(const QModelIndex &)));
+ connect(m_project, SIGNAL(indexChanged()), this, SLOT(indexAvailable()));
+
+ /**
+ * trigger once search with nothing
+ */
+ slotTextChanged(QString());
}
-KateProjectInfoViewIndex::~KateProjectInfoViewIndex ()
+KateProjectInfoViewIndex::~KateProjectInfoViewIndex()
{
}
-void KateProjectInfoViewIndex::slotTextChanged (const QString &text)
+void KateProjectInfoViewIndex::slotTextChanged(const QString &text)
{
- /**
- * init
- */
- m_treeView->setSortingEnabled (false);
- m_model->setRowCount(0);
-
- /**
- * get results
- */
- if (m_project->projectIndex() && !text.isEmpty())
- m_project->projectIndex()->findMatches (*m_model, text, KateProjectIndex::FindMatches);
-
- /**
- * tree view polish ;)
- */
- m_treeView->setSortingEnabled (true);
- m_treeView->resizeColumnToContents (2);
- m_treeView->resizeColumnToContents (1);
- m_treeView->resizeColumnToContents (0);
+ /**
+ * init
+ */
+ m_treeView->setSortingEnabled(false);
+ m_model->setRowCount(0);
+
+ /**
+ * get results
+ */
+ if (m_project->projectIndex() && !text.isEmpty()) {
+ m_project->projectIndex()->findMatches(*m_model, text, KateProjectIndex::FindMatches);
+ }
+
+ /**
+ * tree view polish ;)
+ */
+ m_treeView->setSortingEnabled(true);
+ m_treeView->resizeColumnToContents(2);
+ m_treeView->resizeColumnToContents(1);
+ m_treeView->resizeColumnToContents(0);
}
-void KateProjectInfoViewIndex::slotClicked (const QModelIndex &index)
+void KateProjectInfoViewIndex::slotClicked(const QModelIndex &index)
{
- /**
- * get path
- */
- QString filePath = m_model->item (index.row(), 2)->text();
- if (filePath.isEmpty())
- return;
-
- /**
- * create view
- */
- KTextEditor::View *view = m_pluginView->mainWindow()->openUrl (QUrl::fromLocalFile (filePath));
- if (!view)
- return;
-
- /**
- * set cursor, if possible
- */
- int line = m_model->item (index.row(), 3)->text().toInt();
- if (line >= 1)
- view->setCursorPosition (KTextEditor::Cursor (line - 1, 0));
+ /**
+ * get path
+ */
+ QString filePath = m_model->item(index.row(), 2)->text();
+ if (filePath.isEmpty()) {
+ return;
+ }
+
+ /**
+ * create view
+ */
+ KTextEditor::View *view = m_pluginView->mainWindow()->openUrl(QUrl::fromLocalFile(filePath));
+ if (!view) {
+ return;
+ }
+
+ /**
+ * set cursor, if possible
+ */
+ int line = m_model->item(index.row(), 3)->text().toInt();
+ if (line >= 1) {
+ view->setCursorPosition(KTextEditor::Cursor(line - 1, 0));
+ }
}
-void KateProjectInfoViewIndex::indexAvailable ()
+void KateProjectInfoViewIndex::indexAvailable()
{
- /**
- * update enabled state of widgets
- */
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectinfoviewindex.h
^
|
@@ -35,50 +35,49 @@
*/
class KateProjectInfoViewIndex : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
/**
* construct project info view for given project
* @param pluginView our plugin view
* @param project project this view is for
*/
- KateProjectInfoViewIndex (KateProjectPluginView *pluginView, KateProject *project);
+ KateProjectInfoViewIndex(KateProjectPluginView *pluginView, KateProject *project);
/**
* deconstruct info view
*/
- ~KateProjectInfoViewIndex ();
+ ~KateProjectInfoViewIndex();
/**
* our project.
* @return project
*/
- KateProject *project () const
- {
- return m_project;
+ KateProject *project() const {
+ return m_project;
}
-
- private Q_SLOTS:
+
+private Q_SLOTS:
/**
* Called if text in lineedit changes, then we need to search
* @param text new text
*/
- void slotTextChanged (const QString &text);
-
+ void slotTextChanged(const QString &text);
+
/**
* item got clicked, do stuff, like open document
* @param index model index of clicked item
*/
- void slotClicked (const QModelIndex &index);
+ void slotClicked(const QModelIndex &index);
/**
* called whenever the index of the project was updated. Here,
* it's used to show a warning, if ctags is not installed.
*/
- void indexAvailable ();
+ void indexAvailable();
- private:
+private:
/**
* our plugin view
*/
@@ -103,7 +102,7 @@
* tree view for results
*/
QTreeView *m_treeView;
-
+
/**
* standard item model for results
*/
@@ -112,4 +111,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectinfoviewnotes.cpp
^
|
@@ -23,24 +23,23 @@
#include <QVBoxLayout>
-KateProjectInfoViewNotes::KateProjectInfoViewNotes (KateProjectPluginView *pluginView, KateProject *project)
- : QWidget ()
- , m_pluginView (pluginView)
- , m_project (project)
- , m_edit (new QPlainTextEdit ())
+KateProjectInfoViewNotes::KateProjectInfoViewNotes(KateProjectPluginView *pluginView, KateProject *project)
+ : QWidget()
+ , m_pluginView(pluginView)
+ , m_project(project)
+ , m_edit(new QPlainTextEdit())
{
- /*
- * layout widget
- */
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setSpacing (0);
- layout->addWidget (m_edit);
- setLayout (layout);
- m_edit->setDocument(project->notesDocument());
+ /*
+ * layout widget
+ */
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->setSpacing(0);
+ layout->addWidget(m_edit);
+ setLayout(layout);
+ m_edit->setDocument(project->notesDocument());
}
-KateProjectInfoViewNotes::~KateProjectInfoViewNotes ()
+KateProjectInfoViewNotes::~KateProjectInfoViewNotes()
{
}
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectinfoviewnotes.h
^
|
@@ -33,31 +33,30 @@
*/
class KateProjectInfoViewNotes : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
/**
* construct project info view for given project
* @param pluginView our plugin view
* @param project project this view is for
*/
- KateProjectInfoViewNotes (KateProjectPluginView *pluginView, KateProject *project);
+ KateProjectInfoViewNotes(KateProjectPluginView *pluginView, KateProject *project);
/**
* deconstruct info view
*/
- ~KateProjectInfoViewNotes ();
+ ~KateProjectInfoViewNotes();
/**
* our project.
* @return project
*/
- KateProject *project () const
- {
- return m_project;
+ KateProject *project() const {
+ return m_project;
}
- private:
+private:
/**
* our plugin view
*/
@@ -67,7 +66,7 @@
* our project
*/
KateProject *m_project;
-
+
/**
* edit widget bound to notes document of project
*/
@@ -76,4 +75,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectinfoviewterminal.cpp
^
|
@@ -23,87 +23,90 @@
#include <klocalizedstring.h>
#include <kde_terminal_interface.h>
-#include <kservice.h>
+#include <KPluginLoader>
+#include <KPluginFactory>
-KateProjectInfoViewTerminal::KateProjectInfoViewTerminal (KateProjectPluginView *pluginView, KateProject *project)
- : QWidget ()
- , m_pluginView (pluginView)
- , m_project (project)
- , m_konsolePart (0)
+KateProjectInfoViewTerminal::KateProjectInfoViewTerminal(KateProjectPluginView *pluginView, KateProject *project)
+ : QWidget()
+ , m_pluginView(pluginView)
+ , m_project(project)
+ , m_konsolePart(0)
{
- /**
- * layout widget
- */
- m_layout = new QVBoxLayout (this);
- m_layout->setSpacing (0);
- m_layout->setContentsMargins(0, 0, 0, 0);
-
- /**
- * initial terminal creation
- */
- loadTerminal ();
+ /**
+ * layout widget
+ */
+ m_layout = new QVBoxLayout(this);
+ m_layout->setSpacing(0);
+ m_layout->setContentsMargins(0, 0, 0, 0);
+
+ /**
+ * initial terminal creation
+ */
+ loadTerminal();
}
-KateProjectInfoViewTerminal::~KateProjectInfoViewTerminal ()
+KateProjectInfoViewTerminal::~KateProjectInfoViewTerminal()
{
- /**
- * avoid endless loop
- */
- if (m_konsolePart)
- disconnect (m_konsolePart, SIGNAL(destroyed()), this, SLOT(loadTerminal()));
+ /**
+ * avoid endless loop
+ */
+ if (m_konsolePart) {
+ disconnect(m_konsolePart, SIGNAL(destroyed()), this, SLOT(loadTerminal()));
+ }
}
-void KateProjectInfoViewTerminal::loadTerminal ()
+void KateProjectInfoViewTerminal::loadTerminal()
{
- /**
- * null in any case, if loadTerminal fails below and we are in the destroyed event
- */
- m_konsolePart = 0;
-
- /**
- * get konsole part service
- */
- KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("konsolepart"));
- if (!service)
- return;
-
- /**
- * create part
- */
- m_konsolePart = service->createInstance<KParts::ReadOnlyPart>(this, this, QVariantList());
- if (!m_konsolePart)
- return;
-
- /**
- * init locale translation stuff
- */
- // FIXME KF5 KGlobal::locale()->insertCatalog("konsole");
-
- /**
- * switch to right directory
- */
- qobject_cast<TerminalInterface*>(m_konsolePart)->showShellInDir (QFileInfo (m_project->fileName()).absolutePath());
-
- /**
- * add to widget
- */
- m_layout->addWidget (m_konsolePart->widget());
- setFocusProxy(m_konsolePart->widget());
-
- /**
- * guard destruction, create new terminal!
- */
- connect (m_konsolePart, SIGNAL(destroyed()), this, SLOT(loadTerminal()));
- connect (m_konsolePart, SIGNAL(overrideShortcut(QKeyEvent*,bool&)),
- this, SLOT(overrideShortcut(QKeyEvent*,bool&)));
+ /**
+ * null in any case, if loadTerminal fails below and we are in the destroyed event
+ */
+ m_konsolePart = 0;
+
+ /**
+ * get konsole part factory
+ */
+ KPluginFactory *factory = KPluginLoader(QStringLiteral("konsolepart")).factory();
+ if (!factory) {
+ return;
+ }
+
+ /**
+ * create part
+ */
+ m_konsolePart = factory->create<KParts::ReadOnlyPart>(this, this);
+ if (!m_konsolePart) {
+ return;
+ }
+
+ /**
+ * init locale translation stuff
+ */
+ // FIXME KF5 KGlobal::locale()->insertCatalog("konsole");
+
+ /**
+ * switch to right directory
+ */
+ qobject_cast<TerminalInterface *>(m_konsolePart)->showShellInDir(QFileInfo(m_project->fileName()).absolutePath());
+
+ /**
+ * add to widget
+ */
+ m_layout->addWidget(m_konsolePart->widget());
+ setFocusProxy(m_konsolePart->widget());
+
+ /**
+ * guard destruction, create new terminal!
+ */
+ connect(m_konsolePart, SIGNAL(destroyed()), this, SLOT(loadTerminal()));
+ connect(m_konsolePart, SIGNAL(overrideShortcut(QKeyEvent *, bool &)),
+ this, SLOT(overrideShortcut(QKeyEvent *, bool &)));
}
-void KateProjectInfoViewTerminal::overrideShortcut (QKeyEvent *, bool &override)
+void KateProjectInfoViewTerminal::overrideShortcut(QKeyEvent *, bool &override)
{
- /**
- * let konsole handle all shortcuts
- */
- override = true;
+ /**
+ * let konsole handle all shortcuts
+ */
+ override = true;
}
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectinfoviewterminal.h
^
|
@@ -36,42 +36,41 @@
*/
class KateProjectInfoViewTerminal : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
/**
* construct project info view for given project
* @param pluginView our plugin view
* @param project project this view is for
*/
- KateProjectInfoViewTerminal (KateProjectPluginView *pluginView, KateProject *project);
+ KateProjectInfoViewTerminal(KateProjectPluginView *pluginView, KateProject *project);
/**
* deconstruct info view
*/
- ~KateProjectInfoViewTerminal ();
+ ~KateProjectInfoViewTerminal();
/**
* our project.
* @return project
*/
- KateProject *project () const
- {
- return m_project;
+ KateProject *project() const {
+ return m_project;
}
- private Q_SLOTS:
+private Q_SLOTS:
/**
* Construct a new terminal for this view
*/
- void loadTerminal ();
-
+ void loadTerminal();
+
/**
* Handle that shortcuts are not eaten by console
*/
- void overrideShortcut (QKeyEvent *event, bool &override);
+ void overrideShortcut(QKeyEvent *event, bool &override);
- private:
+private:
/**
* our plugin view
*/
@@ -81,7 +80,7 @@
* our project
*/
KateProject *m_project;
-
+
/**
* our layout
*/
@@ -95,4 +94,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectitem.cpp
^
|
@@ -31,115 +31,114 @@
#include <KIconLoader>
#include <KTextEditor/Document>
-KateProjectItem::KateProjectItem (Type type, const QString &text)
- : QStandardItem (text)
- , m_type (type)
- , m_icon (0)
- , m_emblem (0)
+KateProjectItem::KateProjectItem(Type type, const QString &text)
+ : QStandardItem(text)
+ , m_type(type)
+ , m_icon(0)
+ , m_emblem(0)
{
}
-KateProjectItem::~KateProjectItem ()
+KateProjectItem::~KateProjectItem()
{
- /**
- * cleanup
- */
- delete m_icon;
- delete m_emblem;
+ /**
+ * cleanup
+ */
+ delete m_icon;
+ delete m_emblem;
}
void KateProjectItem::slotModifiedChanged(KTextEditor::Document *doc)
{
- if (m_icon) {
- delete m_icon;
- m_icon = 0;
- }
+ if (m_icon) {
+ delete m_icon;
+ m_icon = 0;
+ }
- if (doc->isModified()) {
- if (m_emblem) {
- QStringList emblems;
- emblems << *m_emblem;
- m_icon = new QIcon (KIconLoader::global ()->loadIcon (QStringLiteral("document-save") , KIconLoader::Small, 0, KIconLoader::DefaultState, emblems));
- } else {
- m_icon = new QIcon (KIconLoader::global ()->loadIcon (QStringLiteral("document-save"), KIconLoader::Small));
+ if (doc->isModified()) {
+ if (m_emblem) {
+ QStringList emblems;
+ emblems << *m_emblem;
+ m_icon = new QIcon(KIconLoader::global()->loadIcon(QStringLiteral("document-save") , KIconLoader::Small, 0, KIconLoader::DefaultState, emblems));
+ } else {
+ m_icon = new QIcon(KIconLoader::global()->loadIcon(QStringLiteral("document-save"), KIconLoader::Small));
+ }
}
- }
- emitDataChanged();
+ emitDataChanged();
}
-void KateProjectItem::slotModifiedOnDisk (KTextEditor::Document *document,
- bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason)
+void KateProjectItem::slotModifiedOnDisk(KTextEditor::Document *document,
+ bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason)
{
- Q_UNUSED(document)
- Q_UNUSED(isModified)
+ Q_UNUSED(document)
+ Q_UNUSED(isModified)
- if (m_icon) {
- delete m_icon;
- m_icon = 0;
- }
-
- if (m_emblem) {
- delete m_emblem;
- m_emblem = 0;
- }
+ if (m_icon) {
+ delete m_icon;
+ m_icon = 0;
+ }
+
+ if (m_emblem) {
+ delete m_emblem;
+ m_emblem = 0;
+ }
- if (reason != KTextEditor::ModificationInterface::OnDiskUnmodified) {
- m_emblem = new QString(QStringLiteral("emblem-important"));
- }
- emitDataChanged();
+ if (reason != KTextEditor::ModificationInterface::OnDiskUnmodified) {
+ m_emblem = new QString(QStringLiteral("emblem-important"));
+ }
+ emitDataChanged();
}
-QVariant KateProjectItem::data (int role) const
+QVariant KateProjectItem::data(int role) const
{
- /**
- * create icons on demand
- */
- if (role == Qt::DecorationRole) {
/**
- * this should only happen in main thread
- * the background thread should only construct this elements and fill data
- * but never query gui stuff!
+ * create icons on demand
*/
- Q_ASSERT (QThread::currentThread () == QCoreApplication::instance()->thread ());
-
- /**
- * create icon, on demand
- */
- if (!m_icon) {
- /**
- * use right type
- */
- switch (m_type) {
- case Project:
- m_icon = new QIcon (KIconLoader::global ()->loadIcon (QStringLiteral("folder-documents"), KIconLoader::Small));
- break;
-
- case Directory:
- m_icon = new QIcon (KIconLoader::global ()->loadIcon (QStringLiteral("folder"), KIconLoader::Small));
- break;
-
- case File: {
- QString iconName = QMimeDatabase().mimeTypeForUrl(QUrl::fromLocalFile(data(Qt::UserRole).toString())).iconName();
- QStringList emblems;
- if (m_emblem) {
- emblems << *m_emblem;
- }
- m_icon = new QIcon (KIconLoader::global ()->loadMimeTypeIcon (iconName, KIconLoader::Small, 0, KIconLoader::DefaultState, emblems));
- break;
+ if (role == Qt::DecorationRole) {
+ /**
+ * this should only happen in main thread
+ * the background thread should only construct this elements and fill data
+ * but never query gui stuff!
+ */
+ Q_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread());
+
+ /**
+ * create icon, on demand
+ */
+ if (!m_icon) {
+ /**
+ * use right type
+ */
+ switch (m_type) {
+ case Project:
+ m_icon = new QIcon(KIconLoader::global()->loadIcon(QStringLiteral("folder-documents"), KIconLoader::Small));
+ break;
+
+ case Directory:
+ m_icon = new QIcon(KIconLoader::global()->loadIcon(QStringLiteral("folder"), KIconLoader::Small));
+ break;
+
+ case File: {
+ QString iconName = QMimeDatabase().mimeTypeForUrl(QUrl::fromLocalFile(data(Qt::UserRole).toString())).iconName();
+ QStringList emblems;
+ if (m_emblem) {
+ emblems << *m_emblem;
+ }
+ m_icon = new QIcon(KIconLoader::global()->loadMimeTypeIcon(iconName, KIconLoader::Small, 0, KIconLoader::DefaultState, emblems));
+ break;
+ }
+ }
}
- }
+
+ /**
+ * return the cached icon
+ */
+ return QVariant(*m_icon);
}
/**
- * return the cached icon
+ * use normal data method
*/
- return QVariant (*m_icon);
- }
-
- /**
- * use normal data method
- */
- return QStandardItem::data (role);
+ return QStandardItem::data(role);
}
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectitem.h
^
|
@@ -24,9 +24,10 @@
#include <QStandardItem>
#include <KTextEditor/ModificationInterface>
-namespace KTextEditor {
- class Document;
-
+namespace KTextEditor
+{
+class Document;
+
}
/**
@@ -36,14 +37,14 @@
class KateProjectItem : public QStandardItem
{
- public:
+public:
/**
* Possible Types
*/
enum Type {
Project
- , Directory
- , File
+ , Directory
+ , File
};
/**
@@ -51,21 +52,21 @@
* @param type type for this item
* @param text text for this item
*/
- KateProjectItem (Type type, const QString &text);
+ KateProjectItem(Type type, const QString &text);
/**
* deconstruct project
*/
- ~KateProjectItem ();
+ ~KateProjectItem();
/**
* Overwritten data methode for on-demand icon creation and co.
* @param role role to get data for
* @return data for role
*/
- QVariant data (int role = Qt::UserRole + 1) const;
+ QVariant data(int role = Qt::UserRole + 1) const;
- private:
+private:
/**
* type
*/
@@ -80,15 +81,13 @@
* for document icons
*/
QString *m_emblem;
-
- public:
- void slotModifiedChanged(KTextEditor::Document*);
- void slotModifiedOnDisk (KTextEditor::Document *document,
- bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason);
-
+public:
+ void slotModifiedChanged(KTextEditor::Document *);
+ void slotModifiedOnDisk(KTextEditor::Document *document,
+ bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason);
+
};
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectplugin.cpp
^
|
@@ -22,12 +22,16 @@
#include "kateprojectplugin.moc"
#include "kateproject.h"
+#include "kateprojectconfigpage.h"
#include "kateprojectpluginview.h"
#include <ktexteditor/editor.h>
#include <ktexteditor/application.h>
#include <ktexteditor/document.h>
+#include <KSharedConfig>
+#include <KConfigGroup>
+
#include <QFileInfo>
#include <QTime>
@@ -41,222 +45,302 @@
#include <unistd.h>
#endif
-KateProjectPlugin::KateProjectPlugin (QObject* parent, const QList<QVariant>&)
- : KTextEditor::Plugin (parent)
- , m_completion (this)
-{
- /**
- * register some data types
- */
- qRegisterMetaType<KateProjectSharedQStandardItem>("KateProjectSharedQStandardItem");
- qRegisterMetaType<KateProjectSharedQMapStringItem>("KateProjectSharedQMapStringItem");
- qRegisterMetaType<KateProjectSharedProjectIndex>("KateProjectSharedProjectIndex");
-
- /**
- * connect to important signals, e.g. for auto project loading
- */
- connect (KTextEditor::Editor::instance()->application(), SIGNAL(documentCreated (KTextEditor::Document *)), this, SLOT(slotDocumentCreated (KTextEditor::Document *)));
- connect (&m_fileWatcher, SIGNAL(directoryChanged (const QString &)), this, SLOT(slotDirectoryChanged (const QString &)));
-
-#ifdef HAVE_CTERMID
- /**
- * open project for our current working directory, if this kate has a terminal
- * http://stackoverflow.com/questions/1312922/detect-if-stdin-is-a-terminal-or-pipe-in-c-c-qt
- */
- char tty[L_ctermid+1] = {0};
- ctermid (tty);
- int fd = ::open(tty, O_RDONLY);
- if (fd >= 0) {
- /**
- * open project for working dir!
- */
- projectForDir (QDir::current ());
+namespace
+{
+const QString ProjectFileName = QStringLiteral(".kateproject");
+const QString GitFolderName = QStringLiteral(".git");
+const QString SubversionFolderName = QStringLiteral(".svn");
+const QString MercurialFolderName = QStringLiteral(".hg");
+
+const QString GitConfig = QStringLiteral("git");
+const QString SubversionConfig = QStringLiteral("subversion");
+const QString MercurialConfig = QStringLiteral("mercurial");
+
+const QStringList DefaultConfig = QStringList() << GitConfig << SubversionConfig << MercurialConfig;
+}
+KateProjectPlugin::KateProjectPlugin(QObject *parent, const QList<QVariant> &)
+ : KTextEditor::Plugin(parent)
+ , m_completion(this)
+ , m_autoGit(true)
+ , m_autoSubversion(true)
+ , m_autoMercurial(true)
+{
+ qRegisterMetaType<KateProjectSharedQStandardItem>("KateProjectSharedQStandardItem");
+ qRegisterMetaType<KateProjectSharedQMapStringItem>("KateProjectSharedQMapStringItem");
+ qRegisterMetaType<KateProjectSharedProjectIndex>("KateProjectSharedProjectIndex");
+
+ connect(KTextEditor::Editor::instance()->application(), &KTextEditor::Application::documentCreated, this, &KateProjectPlugin::slotDocumentCreated);
+ connect(&m_fileWatcher, &QFileSystemWatcher::directoryChanged, this, &KateProjectPlugin::slotDirectoryChanged);
+
+#ifdef HAVE_CTERMID
/**
- * close again
+ * open project for our current working directory, if this kate has a terminal
+ * http://stackoverflow.com/questions/1312922/detect-if-stdin-is-a-terminal-or-pipe-in-c-c-qt
*/
- ::close (fd);
- }
+ char tty[L_ctermid + 1] = {0};
+ ctermid(tty);
+ int fd = ::open(tty, O_RDONLY);
+
+ if (fd >= 0) {
+ projectForDir(QDir::current());
+ ::close(fd);
+ }
#endif
-
- /**
- * connect for all already existing documents
- */
- foreach (KTextEditor::Document *document, KTextEditor::Editor::instance()->application()->documents())
- slotDocumentCreated (document);
+
+ readConfig();
+
+ foreach(KTextEditor::Document * document, KTextEditor::Editor::instance()->application()->documents()) {
+ slotDocumentCreated(document);
+ }
}
KateProjectPlugin::~KateProjectPlugin()
{
- /**
- * cleanup open projects
- */
- foreach (KateProject *project, m_projects) {
- /**
- * remove path
- */
- m_fileWatcher.removePath (QFileInfo (project->fileName()).canonicalPath());
+ Q_FOREACH(KateProject * project, m_projects) {
+ m_fileWatcher.removePath(QFileInfo(project->fileName()).canonicalPath());
+ delete project;
+ }
+ m_projects.clear();
+}
- /**
- * let events still be handled!
- */
- delete project;
- }
+QObject *KateProjectPlugin::createView(KTextEditor::MainWindow *mainWindow)
+{
+ return new KateProjectPluginView(this, mainWindow);
+}
- /**
- * cleanup list
- */
- m_projects.clear ();
+int KateProjectPlugin::configPages() const
+{
+ return 1;
}
-QObject *KateProjectPlugin::createView( KTextEditor::MainWindow *mainWindow )
+KTextEditor::ConfigPage *KateProjectPlugin::configPage(int number, QWidget *parent)
{
- return new KateProjectPluginView ( this, mainWindow );
+ if (number != 0) {
+ return 0;
+ }
+ return new KateProjectConfigPage(parent, this);
}
-KateProject *KateProjectPlugin::createProjectForFileName (const QString &fileName)
+KateProject *KateProjectPlugin::createProjectForFileName(const QString &fileName)
{
- /**
- * try to load or fail
- */
- KateProject *project = new KateProject ();
- if (!project->load (fileName)) {
- delete project;
- return 0;
- }
+ KateProject *project = new KateProject();
- /**
- * remember project and emit & return it
- */
- m_projects.append(project);
- m_fileWatcher.addPath (QFileInfo(fileName).canonicalPath());
- emit projectCreated (project);
- return project;
-}
-
-KateProject *KateProjectPlugin::projectForDir (QDir dir)
-{
- /**
- * search projects upwards
- * with recursion guard
- */
- QSet<QString> seenDirectories;
- while (!seenDirectories.contains (dir.absolutePath ())) {
- /**
- * fill recursion guard
- */
- seenDirectories.insert (dir.absolutePath ());
+ if (!project->loadFromFile(fileName)) {
+ delete project;
+ return 0;
+ }
+
+ m_projects.append(project);
+ m_fileWatcher.addPath(QFileInfo(fileName).canonicalPath());
+ emit projectCreated(project);
+ return project;
+}
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectplugin.h
^
|
@@ -35,13 +35,16 @@
class KateProjectPlugin : public KTextEditor::Plugin
{
- Q_OBJECT
+ Q_OBJECT
- public:
- explicit KateProjectPlugin( QObject* parent = 0, const QList<QVariant>& = QList<QVariant>() );
+public:
+ explicit KateProjectPlugin(QObject *parent = 0, const QList<QVariant> & = QList<QVariant>());
virtual ~KateProjectPlugin();
- QObject *createView( KTextEditor::MainWindow *mainWindow );
+ QObject *createView(KTextEditor::MainWindow *mainWindow);
+
+ virtual int configPages() const;
+ virtual KTextEditor::ConfigPage *configPage (int number = 0, QWidget *parent = 0);
/**
* Create new project for given project filename.
@@ -50,8 +53,8 @@
* @param fileName canonicalized file name for the project
* @return project or null if not openable
*/
- KateProject *createProjectForFileName (const QString &fileName);
-
+ KateProject *createProjectForFileName(const QString &fileName);
+
/**
* Search and open project for given dir, if possible.
* Will search upwards for .kateproject file.
@@ -59,8 +62,8 @@
* @param dir dir to search matching project for
* @return project or null if not openable
*/
- KateProject *projectForDir (QDir dir);
-
+ KateProject *projectForDir(QDir dir);
+
/**
* Search and open project that contains given url, if possible.
* Will search upwards for .kateproject file, if the url is a local file.
@@ -68,68 +71,79 @@
* @param url url to search matching project for
* @return project or null if not openable
*/
- KateProject *projectForUrl (const QUrl &url);
+ KateProject *projectForUrl(const QUrl &url);
/**
* get list of all current open projects
* @return list of all open projects
*/
- QList<KateProject *> projects () const
- {
- return m_projects;
+ QList<KateProject *> projects() const {
+ return m_projects;
}
-
+
/**
* Get global code completion.
* @return global completion object for KTextEditor::View
*/
- KateProjectCompletion *completion ()
- {
- return &m_completion;
+ KateProjectCompletion *completion() {
+ return &m_completion;
}
-
+
/**
* Map current open documents to projects.
* @param document document we want to know which project it belongs to
* @return project or 0 if none found for this document
*/
- KateProject *projectForDocument (KTextEditor::Document *document)
- {
- return m_document2Project.value (document);
+ KateProject *projectForDocument(KTextEditor::Document *document) {
+ return m_document2Project.value(document);
}
- Q_SIGNALS:
+ void setAutoRepository(bool onGit, bool onSubversion, bool onMercurial);
+ bool autoGit() const;
+ bool autoSubversion() const;
+ bool autoMercurial() const;
+
+Q_SIGNALS:
/**
* Signal that a new project got created.
* @param project new created project
*/
- void projectCreated (KateProject *project);
+ void projectCreated(KateProject *project);
- public Q_SLOTS:
+public Q_SLOTS:
/**
* New document got created, we need to update our connections
* @param document new created document
*/
- void slotDocumentCreated (KTextEditor::Document *document);
+ void slotDocumentCreated(KTextEditor::Document *document);
/**
* Document got destroyed.
* @param document deleted document
*/
- void slotDocumentDestroyed (QObject *document);
+ void slotDocumentDestroyed(QObject *document);
/**
* Url changed, to auto-load projects
*/
- void slotDocumentUrlChanged (KTextEditor::Document *document);
+ void slotDocumentUrlChanged(KTextEditor::Document *document);
/**
* did some project file change?
* @param path name of directory that did change
*/
- void slotDirectoryChanged (const QString &path);
+ void slotDirectoryChanged(const QString &path);
+
+private:
+ KateProject *createProjectForRepository(const QString &type, const QDir &dir);
+ KateProject *detectGit(const QDir &dir);
+ KateProject *detectSubversion(const QDir &dir);
+ KateProject *detectMercurial(const QDir &dir);
- private:
+ void readConfig();
+ void writeConfig();
+
+private:
/**
* open plugins, maps project base directory => project
*/
@@ -140,19 +154,20 @@
* and auto-reload
*/
QFileSystemWatcher m_fileWatcher;
-
+
/**
* Mapping document => project
*/
QHash<QObject *, KateProject *> m_document2Project;
-
+
/**
* Project completion
*/
KateProjectCompletion m_completion;
+
+ bool m_autoGit : 1;
+ bool m_autoSubversion : 1;
+ bool m_autoMercurial : 1;
};
#endif
-
-// kate: space-indent on; indent-width 2; replace-tabs on;
-
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectpluginview.cpp
^
|
@@ -39,366 +39,396 @@
#include <QHBoxLayout>
#include <QVBoxLayout>
-K_PLUGIN_FACTORY_WITH_JSON (KateProjectPluginFactory, "kateprojectplugin.json", registerPlugin<KateProjectPlugin>();)
+K_PLUGIN_FACTORY_WITH_JSON(KateProjectPluginFactory, "kateprojectplugin.json", registerPlugin<KateProjectPlugin>();)
-KateProjectPluginView::KateProjectPluginView( KateProjectPlugin *plugin, KTextEditor::MainWindow *mainWin )
- : QObject ( mainWin )
- , m_plugin (plugin)
- , m_mainWindow (mainWin)
- , m_toolView (nullptr)
- , m_toolInfoView (nullptr)
-{
- KXMLGUIClient::setComponentName (QStringLiteral("kateproject"), i18n ("Kate Project Manager"));
- setXMLFile( QStringLiteral("ui.rc") );
-
- /**
- * create views for all already existing projects
- * will create toolviews on demand!
- */
- foreach (KateProject *project, m_plugin->projects())
- viewForProject (project);
-
- /**
- * connect to important signals, e.g. for auto project view creation
- */
- connect (m_plugin, SIGNAL(projectCreated (KateProject *)), this, SLOT(viewForProject (KateProject *)));
- connect (m_mainWindow, SIGNAL(viewChanged (KTextEditor::View *)), this, SLOT(slotViewChanged ()));
- connect (m_mainWindow, SIGNAL(viewCreated (KTextEditor::View *)), this, SLOT(slotViewCreated (KTextEditor::View *)));
-
- /**
- * connect for all already existing views
- */
- foreach (KTextEditor::View *view, m_mainWindow->views())
- slotViewCreated (view);
-
- /**
- * trigger once view change, to highlight right document
- */
- slotViewChanged ();
-
- /**
- * back + forward
- */
- actionCollection()->addAction (KStandardAction::Back, QStringLiteral("projects_prev_project"), this, SLOT(slotProjectPrev()))->setShortcut (Qt::CTRL | Qt::ALT | Qt::Key_Left);
- actionCollection()->addAction (KStandardAction::Forward, QStringLiteral("projects_next_project"), this, SLOT(slotProjectNext()))->setShortcut (Qt::CTRL | Qt::ALT | Qt::Key_Right);
-
- /**
- * add us to gui
- */
- m_mainWindow->guiFactory()->addClient( this );
+KateProjectPluginView::KateProjectPluginView(KateProjectPlugin *plugin, KTextEditor::MainWindow *mainWin)
+ : QObject(mainWin)
+ , m_plugin(plugin)
+ , m_mainWindow(mainWin)
+ , m_toolView(nullptr)
+ , m_toolInfoView(nullptr)
+{
+ KXMLGUIClient::setComponentName(QStringLiteral("kateproject"), i18n("Kate Project Manager"));
+ setXMLFile(QStringLiteral("ui.rc"));
+
+ /**
+ * create views for all already existing projects
+ * will create toolviews on demand!
+ */
+ foreach(KateProject * project, m_plugin->projects())
+ viewForProject(project);
+
+ /**
+ * connect to important signals, e.g. for auto project view creation
+ */
+ connect(m_plugin, &KateProjectPlugin::projectCreated, this, &KateProjectPluginView::viewForProject);
+ connect(m_mainWindow, &KTextEditor::MainWindow::viewChanged, this, &KateProjectPluginView::slotViewChanged);
+ connect(m_mainWindow, &KTextEditor::MainWindow::viewCreated, this, &KateProjectPluginView::slotViewCreated);
+
+ /**
+ * connect for all already existing views
+ */
+ foreach(KTextEditor::View * view, m_mainWindow->views())
+ slotViewCreated(view);
+
+ /**
+ * trigger once view change, to highlight right document
+ */
+ slotViewChanged();
+
+ /**
+ * back + forward
+ */
+ auto a = actionCollection()->addAction(KStandardAction::Back, QStringLiteral("projects_prev_project"), this, SLOT(slotProjectPrev()));
+ actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_Left));
+ a = actionCollection()->addAction(KStandardAction::Forward, QStringLiteral("projects_next_project"), this, SLOT(slotProjectNext()));
+ actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_Right));
+
+ /**
+ * add us to gui
+ */
+ m_mainWindow->guiFactory()->addClient(this);
}
KateProjectPluginView::~KateProjectPluginView()
{
- /**
- * cleanup for all views
- */
- foreach (QObject *view, m_textViews) {
+ /**
+ * cleanup for all views
+ */
+ foreach(QObject * view, m_textViews) {
+ KTextEditor::CodeCompletionInterface *cci = qobject_cast<KTextEditor::CodeCompletionInterface *>(view);
+ if (cci) {
+ cci->unregisterCompletionModel(m_plugin->completion());
+ }
+ }
+
+ /**
+ * cu toolviews
+ */
+ delete m_toolView;
+ m_toolView = nullptr;
+ delete m_toolInfoView;
+ m_toolInfoView = nullptr;
+
+ /**
+ * cu gui client
+ */
+ m_mainWindow->guiFactory()->removeClient(this);
+}
+
+QPair<KateProjectView *, KateProjectInfoView *> KateProjectPluginView::viewForProject(KateProject *project)
+{
+ /**
+ * needs valid project
+ */
+ Q_ASSERT(project);
+
+ /**
+ * create toolviews on demand
+ */
+ if (!m_toolView) {
+ /**
+ * create toolviews
+ */
+ m_toolView = m_mainWindow->createToolView(m_plugin, QStringLiteral("kateproject"), KTextEditor::MainWindow::Left, SmallIcon(QStringLiteral("project-open")), i18n("Projects"));
+ m_toolInfoView = m_mainWindow->createToolView(m_plugin, QStringLiteral("kateprojectinfo"), KTextEditor::MainWindow::Bottom, SmallIcon(QStringLiteral("view-choose")), i18n("Current Project"));
+
+ /**
+ * create the combo + buttons for the toolViews + stacked widgets
+ */
+ m_projectsCombo = new QComboBox(m_toolView);
+ m_reloadButton = new QToolButton(m_toolView);
+ m_reloadButton->setIcon(SmallIcon(QStringLiteral("view-refresh")));
+ QHBoxLayout *layout = new QHBoxLayout();
+ layout->setSpacing(0);
+ layout->addWidget(m_projectsCombo);
+ layout->addWidget(m_reloadButton);
+ m_toolView->layout()->addItem(layout);
+ m_toolView->layout()->setSpacing(0);
+
+ m_stackedProjectViews = new QStackedWidget(m_toolView);
+ m_stackedProjectInfoViews = new QStackedWidget(m_toolInfoView);
+
+ connect(m_projectsCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentChanged(int)));
+ connect(m_reloadButton, &QToolButton::clicked, this, &KateProjectPluginView::slotProjectReload);
+ }
+
+ /**
+ * existing view?
+ */
+ if (m_project2View.contains(project)) {
+ return m_project2View.value(project);
+ }
+
+ /**
+ * create new views
+ */
+ KateProjectView *view = new KateProjectView(this, project);
+ KateProjectInfoView *infoView = new KateProjectInfoView(this, project);
+
+ /**
+ * attach to toolboxes
+ * first the views, then the combo, that triggers signals
+ */
+ m_stackedProjectViews->addWidget(view);
+ m_stackedProjectInfoViews->addWidget(infoView);
+ m_projectsCombo->addItem(SmallIcon(QStringLiteral("project-open")), project->name(), project->fileName());
+
+ /**
+ * remember and return it
+ */
+ return (m_project2View[project] = QPair<KateProjectView *, KateProjectInfoView *> (view, infoView));
+}
+
+QString KateProjectPluginView::projectFileName() const
+{
+ // nothing there, skip
+ if (!m_toolView) {
+ return QString();
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectpluginview.h
^
|
@@ -43,114 +43,113 @@
Q_PROPERTY(QVariantMap projectMap READ projectMap NOTIFY projectMapChanged)
Q_PROPERTY(QStringList projectFiles READ projectFiles)
- public:
- KateProjectPluginView( KateProjectPlugin *plugin, KTextEditor::MainWindow *mainWindow );
+public:
+ KateProjectPluginView(KateProjectPlugin *plugin, KTextEditor::MainWindow *mainWindow);
~KateProjectPluginView();
/**
* content of current active project, as variant map
* @return empty map if no project active, else content of project JSON
*/
- QVariantMap projectMap () const;
+ QVariantMap projectMap() const;
/**
* which project file is currently active?
* @return empty string if none, else project file name
*/
- QString projectFileName () const;
+ QString projectFileName() const;
- /**
+ /**
* Returns the name of the project
*/
- QString projectName () const;
+ QString projectName() const;
- /**
+ /**
* Returns the base directory of the project
*/
- QString projectBaseDir () const;
+ QString projectBaseDir() const;
/**
* files for the current active project?
* @return empty list if none, else project files as stringlist
*/
- QStringList projectFiles () const;
-
+ QStringList projectFiles() const;
+
/**
* the main window we belong to
* @return our main window
*/
- KTextEditor::MainWindow *mainWindow () const
- {
- return m_mainWindow;
+ KTextEditor::MainWindow *mainWindow() const {
+ return m_mainWindow;
}
- public Q_SLOTS:
+public Q_SLOTS:
/**
* Create views for given project.
* Either gives existing ones or creates new one
* @param project project we want view for
* @return views (normal + info view)
*/
- QPair<KateProjectView *,KateProjectInfoView *> viewForProject (KateProject *project);
+ QPair<KateProjectView *, KateProjectInfoView *> viewForProject(KateProject *project);
- private Q_SLOTS:
+private Q_SLOTS:
/**
* New view got created, we need to update our connections
* @param view new created view
*/
- void slotViewCreated (KTextEditor::View *view);
+ void slotViewCreated(KTextEditor::View *view);
/**
* View got destroyed.
* @param view deleted view
*/
- void slotViewDestroyed (QObject *view);
+ void slotViewDestroyed(QObject *view);
/**
* Activate the previous project.
*/
- void slotProjectPrev ();
+ void slotProjectPrev();
/**
* Activate the next project.
*/
- void slotProjectNext ();
+ void slotProjectNext();
/**
* Reload current project, if any.
* This will trigger a reload with force.
*/
- void slotProjectReload ();
+ void slotProjectReload();
- Q_SIGNALS:
+Q_SIGNALS:
/**
* Emitted if projectFileName changed.
*/
- void projectFileNameChanged ();
+ void projectFileNameChanged();
/**
* Emitted if projectMap changed.
*/
- void projectMapChanged ();
+ void projectMapChanged();
- private Q_SLOTS:
+private Q_SLOTS:
/**
* This slot is called whenever the active view changes in our main window.
*/
- void slotViewChanged ();
+ void slotViewChanged();
/**
* Current project changed.
* @param index index in toolbox
*/
- void slotCurrentChanged (int index);
+ void slotCurrentChanged(int index);
/**
* Url changed, to auto-load projects
*/
- void slotDocumentUrlChanged (KTextEditor::Document *document);
+ void slotDocumentUrlChanged(KTextEditor::Document *document);
- private:
+private:
/**
* our plugin
*/
@@ -160,7 +159,7 @@
* the main window we belong to
*/
KTextEditor::MainWindow *m_mainWindow;
-
+
/**
* our projects toolview
*/
@@ -194,7 +193,7 @@
/**
* project => view
*/
- QMap<KateProject *, QPair<KateProjectView *,KateProjectInfoView *> > m_project2View;
+ QMap<KateProject *, QPair<KateProjectView *, KateProjectInfoView *> > m_project2View;
/**
* remember current active view text editor view
@@ -210,5 +209,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
-
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectview.cpp
^
|
@@ -24,64 +24,64 @@
#include <ktexteditor/document.h>
#include <ktexteditor/view.h>
-#include <QContextMenuEvent>
-#include <QSortFilterProxyModel>
-#include <KMimeTypeTrader>
-#include <QMenu>
-#include <KRun>
#include <KLineEdit>
+#include <KLocalizedString>
+
+#include <QSortFilterProxyModel>
#include <QVBoxLayout>
#include <QTimer>
-KateProjectView::KateProjectView (KateProjectPluginView *pluginView, KateProject *project)
- : QWidget ()
- , m_pluginView (pluginView)
- , m_project (project)
- , m_treeView (new KateProjectViewTree(pluginView, project))
- , m_filter (new KLineEdit ())
+KateProjectView::KateProjectView(KateProjectPluginView *pluginView, KateProject *project)
+ : QWidget()
+ , m_pluginView(pluginView)
+ , m_project(project)
+ , m_treeView(new KateProjectViewTree(pluginView, project))
+ , m_filter(new KLineEdit())
{
- /**
- * layout tree view and co.
- */
- QVBoxLayout *layout = new QVBoxLayout ();
- layout->setSpacing (0);
- layout->setContentsMargins (0, 0, 0, 0);
- layout->addWidget (m_treeView);
- layout->addWidget (m_filter);
- setLayout (layout);
-
- /**
- * do some stuff if line edit is changed
- */
- connect (m_filter, SIGNAL(textChanged(QString)), this, SLOT(filterTextChanged(QString)));
+ /**
+ * layout tree view and co.
+ */
+ QVBoxLayout *layout = new QVBoxLayout();
+ layout->setSpacing(0);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(m_treeView);
+ layout->addWidget(m_filter);
+ setLayout(layout);
+
+ /**
+ * setup filter line edit
+ */
+ m_filter->setPlaceholderText(i18n("Search"));
+ m_filter->setClearButtonEnabled(true);
+ connect(m_filter, &KLineEdit::textChanged, this, &KateProjectView::filterTextChanged);
}
-KateProjectView::~KateProjectView ()
+KateProjectView::~KateProjectView()
{
}
-void KateProjectView::selectFile (const QString &file)
+void KateProjectView::selectFile(const QString &file)
{
- m_treeView->selectFile (file);
+ m_treeView->selectFile(file);
}
-void KateProjectView::openSelectedDocument ()
+void KateProjectView::openSelectedDocument()
{
- m_treeView->openSelectedDocument ();
+ m_treeView->openSelectedDocument();
}
-void KateProjectView::filterTextChanged (QString filterText)
+void KateProjectView::filterTextChanged(QString filterText)
{
- /**
- * filter
- */
- static_cast<QSortFilterProxyModel *>(m_treeView->model ())->setFilterFixedString (filterText);
-
- /**
- * expand
- */
- if (!filterText.isEmpty())
- QTimer::singleShot (100, m_treeView, SLOT(expandAll ()));
+ /**
+ * filter
+ */
+ static_cast<QSortFilterProxyModel *>(m_treeView->model())->setFilterFixedString(filterText);
+
+ /**
+ * expand
+ */
+ if (!filterText.isEmpty()) {
+ QTimer::singleShot(100, m_treeView, SLOT(expandAll()));
+ }
}
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectview.h
^
|
@@ -33,49 +33,48 @@
*/
class KateProjectView : public QWidget
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
/**
* construct project view for given project
* @param pluginView our plugin view
* @param project project this view is for
*/
- KateProjectView (KateProjectPluginView *pluginView, KateProject *project);
+ KateProjectView(KateProjectPluginView *pluginView, KateProject *project);
/**
* deconstruct project
*/
- ~KateProjectView ();
+ ~KateProjectView();
/**
* our project.
* @return project
*/
- KateProject *project () const
- {
- return m_project;
+ KateProject *project() const {
+ return m_project;
}
/**
* Select given file in the view.
* @param file select this file in the view, will be shown if invisible
*/
- void selectFile (const QString &file);
+ void selectFile(const QString &file);
/**
* Open the selected document, if any.
*/
- void openSelectedDocument ();
-
- private Q_SLOTS:
+ void openSelectedDocument();
+
+private Q_SLOTS:
/**
* React on filter change
* @param filterText new filter text
*/
- void filterTextChanged (QString filterText);
+ void filterTextChanged(QString filterText);
- private:
+private:
/**
* our plugin view
*/
@@ -85,12 +84,12 @@
* our project
*/
KateProject *m_project;
-
+
/**
* our tree view
*/
KateProjectViewTree *m_treeView;
-
+
/**
* filter
*/
@@ -99,4 +98,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectviewtree.cpp
^
|
@@ -28,122 +28,125 @@
#include <QContextMenuEvent>
#include <krecursivefilterproxymodel.h>
-KateProjectViewTree::KateProjectViewTree (KateProjectPluginView *pluginView, KateProject *project)
- : QTreeView ()
- , m_pluginView (pluginView)
- , m_project (project)
-{
- /**
- * default style
- */
- setHeaderHidden (true);
- setEditTriggers (QAbstractItemView::NoEditTriggers);
-
- /**
- * attach view => project
- * do this once, model is stable for whole project life time
- * kill selection model
- * create sort proxy model
- */
- QItemSelectionModel *m = selectionModel();
- QSortFilterProxyModel *sortModel = new KRecursiveFilterProxyModel (this);
- //sortModel->setFilterRole(SortFilterRole);
- //sortModel->setSortRole(SortFilterRole);
- sortModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
- sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
- sortModel->setSourceModel (m_project->model ());
- setModel (sortModel);
- delete m;
-
- /**
- * connect needed signals
- */
- connect (this, SIGNAL(clicked (const QModelIndex &)), this, SLOT(slotClicked (const QModelIndex &)));
- connect (m_project, SIGNAL(modelChanged ()), this, SLOT(slotModelChanged ()));
-
- /**
- * trigger once some slots
- */
- slotModelChanged ();
-}
-
-KateProjectViewTree::~KateProjectViewTree ()
-{
-}
-
-void KateProjectViewTree::selectFile (const QString &file)
-{
- /**
- * get item if any
- */
- QStandardItem *item = m_project->itemForFile (file);
- if (!item)
- return;
-
- /**
- * select it
- */
- QModelIndex index = static_cast<QSortFilterProxyModel *>(model())->mapFromSource (m_project->model()->indexFromItem (item));
- scrollTo (index, QAbstractItemView::EnsureVisible);
- selectionModel()->setCurrentIndex (index, QItemSelectionModel::Clear | QItemSelectionModel::Select);
-}
-
-void KateProjectViewTree::openSelectedDocument ()
-{
- /**
- * anything selected?
- */
- QModelIndexList selecteStuff = selectedIndexes ();
- if (selecteStuff.isEmpty())
- return;
-
- /**
- * open document for first element, if possible
- */
- QString filePath = selecteStuff[0].data (Qt::UserRole).toString();
- if (!filePath.isEmpty())
- m_pluginView->mainWindow()->openUrl (QUrl::fromLocalFile (filePath));
-}
-
-void KateProjectViewTree::slotClicked (const QModelIndex &index)
-{
- /**
- * open document, if any usable user data
- */
- QString filePath = index.data (Qt::UserRole).toString();
- if (!filePath.isEmpty()) {
- m_pluginView->mainWindow()->openUrl (QUrl::fromLocalFile (filePath));
- selectionModel()->setCurrentIndex (index, QItemSelectionModel::Clear | QItemSelectionModel::Select);
- }
-}
-
-void KateProjectViewTree::slotModelChanged ()
-{
- /**
- * model was updated
- * perhaps we need to highlight again new file
- */
- KTextEditor::View *activeView = m_pluginView->mainWindow()->activeView ();
- if (activeView && activeView->document()->url().isLocalFile())
- selectFile (activeView->document()->url().toLocalFile ());
-}
-
-void KateProjectViewTree::contextMenuEvent (QContextMenuEvent *event)
-{
- /**
- * get path file path or don't do anything
- */
- QModelIndex index = selectionModel()->currentIndex();
- QString filePath = index.data (Qt::UserRole).toString();
- if (filePath.isEmpty()) {
- QTreeView::contextMenuEvent (event);
- return;
- }
+KateProjectViewTree::KateProjectViewTree(KateProjectPluginView *pluginView, KateProject *project)
+ : QTreeView()
+ , m_pluginView(pluginView)
+ , m_project(project)
+{
+ /**
+ * default style
+ */
+ setHeaderHidden(true);
+ setEditTriggers(QAbstractItemView::NoEditTriggers);
+
+ /**
+ * attach view => project
+ * do this once, model is stable for whole project life time
+ * kill selection model
+ * create sort proxy model
+ */
+ QItemSelectionModel *m = selectionModel();
+ QSortFilterProxyModel *sortModel = new KRecursiveFilterProxyModel(this);
+ //sortModel->setFilterRole(SortFilterRole);
+ //sortModel->setSortRole(SortFilterRole);
+ sortModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
+ sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
+ sortModel->setSourceModel(m_project->model());
+ setModel(sortModel);
+ delete m;
+
+ /**
+ * connect needed signals
+ */
+ connect(this, SIGNAL(clicked(const QModelIndex &)), this, SLOT(slotClicked(const QModelIndex &)));
+ connect(m_project, SIGNAL(modelChanged()), this, SLOT(slotModelChanged()));
+
+ /**
+ * trigger once some slots
+ */
+ slotModelChanged();
+}
+
+KateProjectViewTree::~KateProjectViewTree()
+{
+}
+
+void KateProjectViewTree::selectFile(const QString &file)
+{
+ /**
+ * get item if any
+ */
+ QStandardItem *item = m_project->itemForFile(file);
+ if (!item) {
+ return;
+ }
+
+ /**
+ * select it
+ */
+ QModelIndex index = static_cast<QSortFilterProxyModel *>(model())->mapFromSource(m_project->model()->indexFromItem(item));
+ scrollTo(index, QAbstractItemView::EnsureVisible);
+ selectionModel()->setCurrentIndex(index, QItemSelectionModel::Clear | QItemSelectionModel::Select);
+}
+
+void KateProjectViewTree::openSelectedDocument()
+{
+ /**
+ * anything selected?
+ */
+ QModelIndexList selecteStuff = selectedIndexes();
+ if (selecteStuff.isEmpty()) {
+ return;
+ }
+
+ /**
+ * open document for first element, if possible
+ */
+ QString filePath = selecteStuff[0].data(Qt::UserRole).toString();
+ if (!filePath.isEmpty()) {
+ m_pluginView->mainWindow()->openUrl(QUrl::fromLocalFile(filePath));
+ }
+}
+
+void KateProjectViewTree::slotClicked(const QModelIndex &index)
+{
+ /**
+ * open document, if any usable user data
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectviewtree.h
^
|
@@ -32,62 +32,61 @@
*/
class KateProjectViewTree : public QTreeView
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
/**
* construct project view for given project
* @param pluginView our plugin view
* @param project project this view is for
*/
- KateProjectViewTree (KateProjectPluginView *pluginView, KateProject *project);
+ KateProjectViewTree(KateProjectPluginView *pluginView, KateProject *project);
/**
* deconstruct project
*/
- ~KateProjectViewTree ();
+ ~KateProjectViewTree();
/**
* our project.
* @return project
*/
- KateProject *project () const
- {
- return m_project;
+ KateProject *project() const {
+ return m_project;
}
/**
* Select given file in the view.
* @param file select this file in the view, will be shown if invisible
*/
- void selectFile (const QString &file);
+ void selectFile(const QString &file);
/**
* Open the selected document, if any.
*/
- void openSelectedDocument ();
+ void openSelectedDocument();
- private Q_SLOTS:
+private Q_SLOTS:
/**
* item got clicked, do stuff, like open document
* @param index model index of clicked item
*/
- void slotClicked (const QModelIndex &index);
+ void slotClicked(const QModelIndex &index);
/**
* Triggered on model changes.
* This includes the files list, itemForFile mapping!
*/
- void slotModelChanged ();
+ void slotModelChanged();
- protected:
+protected:
/**
* Create matching context menu.
* @param event context menu event
*/
- void contextMenuEvent (QContextMenuEvent *event);
+ void contextMenuEvent(QContextMenuEvent *event);
- private:
+private:
/**
* our plugin view
*/
@@ -101,4 +100,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectworker.cpp
^
|
@@ -29,77 +29,78 @@
#include <QSet>
#include <QTime>
-KateProjectWorker::KateProjectWorker (QObject *project)
- : QObject ()
- , m_project (project)
+KateProjectWorker::KateProjectWorker(QObject *project)
+ : QObject()
+ , m_project(project)
{
}
-KateProjectWorker::~KateProjectWorker ()
+KateProjectWorker::~KateProjectWorker()
{
}
-void KateProjectWorker::loadProject (QString baseDir, QVariantMap projectMap)
+void KateProjectWorker::loadProject(QString baseDir, QVariantMap projectMap)
{
- /**
- * setup project base directory
- * this should be FIX after initial setting
- */
- Q_ASSERT (m_baseDir.isEmpty() || (m_baseDir == baseDir));
- m_baseDir = baseDir;
+ /**
+ * setup project base directory
+ * this should be FIX after initial setting
+ */
+ Q_ASSERT(m_baseDir.isEmpty() || (m_baseDir == baseDir));
+ m_baseDir = baseDir;
- /**
- * Create dummy top level parent item and empty map inside shared pointers
- * then load the project recursively
- */
- KateProjectSharedQStandardItem topLevel (new QStandardItem ());
- KateProjectSharedQMapStringItem file2Item (new QMap<QString, KateProjectItem *> ());
- loadProject (topLevel.data(), projectMap, file2Item.data());
+ /**
+ * Create dummy top level parent item and empty map inside shared pointers
+ * then load the project recursively
+ */
+ KateProjectSharedQStandardItem topLevel(new QStandardItem());
+ KateProjectSharedQMapStringItem file2Item(new QMap<QString, KateProjectItem *> ());
+ loadProject(topLevel.data(), projectMap, file2Item.data());
- /**
- * create some local backup of some data we need for further processing!
- */
- QStringList files = file2Item->keys ();
+ /**
+ * create some local backup of some data we need for further processing!
+ */
+ QStringList files = file2Item->keys();
- /**
- * feed back our results
- */
- QMetaObject::invokeMethod (m_project, "loadProjectDone", Qt::QueuedConnection, Q_ARG(KateProjectSharedQStandardItem, topLevel), Q_ARG(KateProjectSharedQMapStringItem, file2Item));
+ /**
+ * feed back our results
+ */
+ QMetaObject::invokeMethod(m_project, "loadProjectDone", Qt::QueuedConnection, Q_ARG(KateProjectSharedQStandardItem, topLevel), Q_ARG(KateProjectSharedQMapStringItem, file2Item));
- /**
- * load index
- */
- loadIndex (files);
+ /**
+ * load index
+ */
+ loadIndex(files);
}
-void KateProjectWorker::loadProject (QStandardItem *parent, const QVariantMap &project, QMap<QString, KateProjectItem *> *file2Item)
+void KateProjectWorker::loadProject(QStandardItem *parent, const QVariantMap &project, QMap<QString, KateProjectItem *> *file2Item)
{
- /**
- * recurse to sub-projects FIRST
- */
- QVariantList subGroups = project[QStringLiteral("projects")].toList ();
- foreach (const QVariant &subGroupVariant, subGroups) {
/**
- * convert to map and get name, else skip
+ * recurse to sub-projects FIRST
*/
- QVariantMap subProject = subGroupVariant.toMap ();
- if (subProject[QStringLiteral("name")].toString().isEmpty())
- continue;
+ QVariantList subGroups = project[QStringLiteral("projects")].toList();
+ foreach(const QVariant & subGroupVariant, subGroups) {
+ /**
+ * convert to map and get name, else skip
+ */
+ QVariantMap subProject = subGroupVariant.toMap();
+ if (subProject[QStringLiteral("name")].toString().isEmpty()) {
+ continue;
+ }
+
+ /**
+ * recurse
+ */
+ QStandardItem *subProjectItem = new KateProjectItem(KateProjectItem::Project, subProject[QStringLiteral("name")].toString());
+ loadProject(subProjectItem, subProject, file2Item);
+ parent->appendRow(subProjectItem);
+ }
/**
- * recurse
+ * load all specified files
*/
- QStandardItem *subProjectItem = new KateProjectItem (KateProjectItem::Project, subProject[QStringLiteral("name")].toString());
- loadProject (subProjectItem, subProject, file2Item);
- parent->appendRow (subProjectItem);
- }
-
- /**
- * load all specified files
- */
- QVariantList files = project[QStringLiteral("files")].toList ();
- foreach (const QVariant &fileVariant, files)
- loadFilesEntry (parent, fileVariant.toMap (), file2Item);
+ QVariantList files = project[QStringLiteral("files")].toList();
+ foreach(const QVariant & fileVariant, files)
+ loadFilesEntry(parent, fileVariant.toMap(), file2Item);
}
/**
@@ -108,294 +109,292 @@
* @param path current path we need item for
* @return correct parent item for given path, will reuse existing ones
*/
-static QStandardItem *directoryParent (QMap<QString, QStandardItem *> &dir2Item, QString path)
+static QStandardItem *directoryParent(QMap<QString, QStandardItem *> &dir2Item, QString path)
{
- /**
- * throw away simple /
- */
- if (path == QStringLiteral("/"))
- path = QString();
-
- /**
- * quick check: dir already seen?
- */
- if (dir2Item.contains (path))
- return dir2Item[path];
-
- /**
- * else: construct recursively
- */
- int slashIndex = path.lastIndexOf (QLatin1Char('/'));
-
- /**
- * no slash?
- * simple, no recursion, append new item toplevel
- */
- if (slashIndex < 0) {
- dir2Item[path] = new KateProjectItem (KateProjectItem::Directory, path);
- dir2Item[QString()]->appendRow (dir2Item[path]);
- return dir2Item[path];
- }
-
- /**
- * else, split and recurse
- */
- QString leftPart = path.left (slashIndex);
- QString rightPart = path.right (path.size() - (slashIndex + 1));
-
- /**
- * special handling if / with nothing on one side are found
- */
- if (leftPart.isEmpty() || rightPart.isEmpty ())
- return directoryParent (dir2Item, leftPart.isEmpty() ? rightPart : leftPart);
-
- /**
- * else: recurse on left side
- */
- dir2Item[path] = new KateProjectItem (KateProjectItem::Directory, rightPart);
- directoryParent (dir2Item, leftPart)->appendRow (dir2Item[path]);
- return dir2Item[path];
-}
-
-void KateProjectWorker::loadFilesEntry (QStandardItem *parent, const QVariantMap &filesEntry, QMap<QString, KateProjectItem *> *file2Item)
-{
- /**
- * get directory to open or skip
- */
- QDir dir (m_baseDir);
- if (!dir.cd (filesEntry[QStringLiteral("directory")].toString()))
- return;
-
- /**
- * get recursive attribute, default is TRUE
- */
- const bool recursive = !filesEntry.contains (QStringLiteral("recursive")) || filesEntry[QStringLiteral("recursive")].toBool();
-
- /**
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/project/kateprojectworker.h
^
|
@@ -26,32 +26,34 @@
#include "kateprojectitem.h"
+class QDir;
+
/**
* Class representing a project background worker.
* This worker will build up the model for the project on load and do other stuff in the background.
*/
class KateProjectWorker : public QObject
{
- Q_OBJECT
+ Q_OBJECT
- public:
+public:
/**
* Type for QueuedConnection
*/
typedef QMap<QString, KateProjectItem *> MapString2Item;
-
+
/**
* construct project worker for given project
* @param project our project
*/
- KateProjectWorker (QObject *project);
+ KateProjectWorker(QObject *project);
/**
* deconstruct worker
*/
- ~KateProjectWorker ();
-
- private Q_SLOTS:
+ ~KateProjectWorker();
+
+private Q_SLOTS:
/**
* Load the project.
* Will be used to load project in background.
@@ -59,9 +61,9 @@
* @param baseDir project file name, should stay the same after initial setup
* @param projectMap full map containing the whole project as copy to work on
*/
- void loadProject (QString baseDir, QVariantMap projectMap);
-
- private:
+ void loadProject(QString baseDir, QVariantMap projectMap);
+
+private:
/**
* Load one project inside the project tree.
* Fill data from JSON storage to model and recurse to sub-projects.
@@ -69,7 +71,7 @@
* @param project variant map for this group
* @param file2Item mapping file => item, will be filled
*/
- void loadProject (QStandardItem *parent, const QVariantMap &project, QMap<QString, KateProjectItem *> *file2Item);
+ void loadProject(QStandardItem *parent, const QVariantMap &project, QMap<QString, KateProjectItem *> *file2Item);
/**
* Load one files entry in the current parent item.
@@ -77,20 +79,27 @@
* @param filesEntry one files entry specification to load
* @param file2Item mapping file => item, will be filled
*/
- void loadFilesEntry (QStandardItem *parent, const QVariantMap &filesEntry, QMap<QString, KateProjectItem *> *file2Item);
-
+ void loadFilesEntry(QStandardItem *parent, const QVariantMap &filesEntry, QMap<QString, KateProjectItem *> *file2Item);
+
/**
* Load index for whole project.
* @param files list of all project files to index
*/
- void loadIndex (const QStringList &files);
-
- private:
+ void loadIndex(const QStringList &files);
+
+ QStringList findFiles(const QDir &dir, const QVariantMap &filesEntry);
+
+ QStringList filesFromGit(const QDir &dir, bool recursive);
+ QStringList filesFromMercurial(const QDir &dir, bool recursive);
+ QStringList filesFromSubversion(const QDir &dir, bool recursive);
+ QStringList filesFromDirectory(const QDir &dir, bool recursive, const QStringList &filters);
+
+private:
/**
* our project, only as QObject, we only send messages back and forth!
*/
QObject *m_project;
-
+
/**
* project base directory name
*/
@@ -99,4 +108,3 @@
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/search/CMakeLists.txt
^
|
@@ -17,9 +17,8 @@
Qt5::Script KF5::ItemViews)
########### install files ###############
-install(TARGETS katesearchplugin DESTINATION ${PLUGIN_INSTALL_DIR})
+install(TARGETS katesearchplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
install(FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/katesearch)
-kservice_desktop_to_json (katesearchplugin katesearch.desktop)
-install(FILES katesearch.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+kcoreaddons_desktop_to_json (katesearchplugin katesearch.desktop)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/search/katesearch.desktop
^
|
@@ -2,7 +2,6 @@
Type=Service
ServiceTypes=KTextEditor/Plugin
X-KDE-Library=katesearchplugin
-X-KTextEditor-Load-Default=kate
Name=Search & Replace
Name[bg]=Търсене и &замяна
Name[bs]=Pretraži i zamjeni
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/CMakeLists.txt
^
|
@@ -1,13 +1,4 @@
project(katesessionapplet)
-set(katesessionapplet_SRCS
- katesessionapplet.cpp)
-
-kde4_add_ui_files(katesessionapplet_SRCS
- katesessionConfig.ui)
-
-kde4_add_plugin(plasma_applet_katesession ${katesessionapplet_SRCS})
-target_link_libraries(plasma_applet_katesession ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS})
-
-install(TARGETS plasma_applet_katesession DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES plasma-applet-katesession.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+plasma_install_package(applet org.kde.plasma.katesessions)
+add_subdirectory(engine)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/Messages.sh
^
|
@@ -1,2 +1,4 @@
#! /usr/bin/env bash
-$XGETTEXT *.cpp -o $podir/plasma_applet_katesession.pot
+$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
+$XGETTEXT `find . -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.plasma.katesessions.pot
+rm -f rc.cpp
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/applet/contents/ui/KateSessionsItemDelegate.qml
^
|
@@ -0,0 +1,146 @@
+/********************************************************************
+This file is part of the KDE project.
+
+Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org>
+
+Based on the clipboard applet:
+Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
+Copyright 2014 Sebastian Kügler <sebas@kde.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+import QtQuick 2.0
+import QtQuick.Layouts 1.1
+import org.kde.plasma.components 2.0 as PlasmaComponents
+import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
+import org.kde.plasma.core 2.0 as PlasmaCore
+
+
+PlasmaComponents.ListItem {
+ id: menuItem
+
+ signal itemSelected(string uuid)
+ signal newSession(string sessionname)
+ signal remove(string uuid)
+
+ property bool showInput: false
+
+ width: parent.width - units.gridUnit * 2
+ height: Math.max(Math.max(label.height, toolButtonsLayout.implicitHeight),sessionnameditlayout.implicitHeight) + 2 * units.smallSpacing
+
+ x: -listMargins.left
+
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true
+
+ onClicked: {
+ if (TypeRole!=1)
+ menuItem.itemSelected(UuidRole);
+ else {
+ showInput=true;
+ }
+ }
+ onEntered: menuListView.currentIndex = index
+ onExited: menuListView.currentIndex = -1
+
+ Item {
+ id: label
+ height: childrenRect.height
+ anchors {
+ left: parent.left
+ leftMargin: units.gridUnit / 2
+ right: parent.right
+ verticalCenter: parent.verticalCenter
+ }
+ PlasmaComponents.Label {
+ height: implicitHeight
+ anchors {
+ left: parent.left
+ right: parent.right
+ rightMargin: units.gridUnit * 2
+ leftMargin: units.gridUnit * 2
+ }
+ maximumLineCount: 1
+ text: DisplayRole.trim()
+ visible: !showInput // TypeRole: 0: Text, 1: Image, 2: Url
+ elide: Text.ElideRight
+ wrapMode: Text.Wrap
+ }
+
+ PlasmaCore.IconItem {
+ width: units.iconSizes.small
+ height: width
+ z: 900
+ source: DecorationRole
+ enabled: true
+ visible: true
+ }
+
+ }
+
+ RowLayout {
+ id:sessionnameditlayout
+ visible:showInput
+ height: implicitHeight
+ anchors {
+ left: parent.left
+ right: parent.right
+ rightMargin: 0
+ leftMargin: units.gridUnit * 2
+ }
+ /*Layout.fillWidth: true*/
+ Item {
+ width: units.gridUnit / 2 - parent.spacing
+ height: 1
+ }
+ PlasmaComponents.TextField {
+ id: sessionname
+ placeholderText: i18n("Session name")
+ clearButtonShown: true
+ Layout.fillWidth: true
+
+ }
+ PlasmaComponents.ToolButton {
+ iconSource: "dialog-ok"
+ tooltip: i18n("Create new session and start Kate")
+ enabled: sessionname.text.replace(/^\s+|\s+$/g, '').length>0
+ onClicked: {menuItem.newSession(sessionname.text.replace(/^\s+|\s+$/g, '')); showInput=false;}
+ }
+ PlasmaComponents.ToolButton {
+ iconSource: "dialog-cancel"
+ tooltip: i18n("Cancel session creation")
+ onClicked: showInput=false
+ }
+ }
+
+ RowLayout {
+ id: toolButtonsLayout
+ anchors {
+ right: label.right
+ verticalCenter: parent.verticalCenter
+ }
+
+ PlasmaComponents.ToolButton {
+ iconSource: "edit-delete"
+ tooltip: i18n("Delete session")
+ onClicked: menuItem.remove(UuidRole)
+ }
+
+ Component.onCompleted: {
+ toolButtonsLayout.visible = Qt.binding(function () { return (TypeRole==2) && (menuListView.currentIndex == index); });
+ }
+ }
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/applet/contents/ui/katesessions.qml
^
|
@@ -0,0 +1,167 @@
+/********************************************************************
+This file is part of the KDE project.
+
+Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org>
+
+Based on the clipboard applet:
+Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
+Copyright (C) 2014 Kai Uwe Broulik <kde@privat.broulik.de>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+import QtQuick 2.0
+import QtQuick.Layouts 1.1
+import org.kde.plasma.plasmoid 2.0
+import org.kde.plasma.core 2.0 as PlasmaCore
+import org.kde.plasma.components 2.0 as PlasmaComponents
+import org.kde.plasma.extras 2.0 as PlasmaExtras
+
+Item {
+ id: main
+ width: (Plasmoid.formFactor==PlasmaCore.Types.Planar)? units.gridUnit * 14 : undefined
+ height: (Plasmoid.formFactor==PlasmaCore.Types.Planar)? units.gridUnit * 16: undefined
+
+
+ Plasmoid.switchWidth: units.gridUnit * 6
+ Plasmoid.switchHeight: units.gridUnit * 5
+ Plasmoid.status: PlasmaCore.Types.ActiveStatus
+ Plasmoid.toolTipMainText: i18n("Kate Sessions")
+ Plasmoid.icon: "kate"
+
+
+ Component.onCompleted: {
+ plasmoid.removeAction("configure");
+ }
+
+ PlasmaCore.DataSource {
+ id: clipboardSource
+ property bool editing: false;
+ engine: "org.kde.plasma.katesessions"
+ connectedSources: "katesessions"
+ function service(uuid, op) {
+ var service = clipboardSource.serviceForSource(uuid);
+ var operation = service.operationDescription(op);
+ return service.startOperationCall(operation);
+ }
+ function newSession(sessionName) {
+ var service = clipboardSource.serviceForSource("");
+ var operation = service.operationDescription("newSession");
+ operation.sessionName=sessionName;
+ return service.startOperationCall(operation);
+ }
+
+ }
+
+ Plasmoid.fullRepresentation: Item {
+
+ id: dialogItem
+ Layout.minimumWidth: units.iconSizes.medium * 9
+ Layout.minimumHeight: units.gridUnit * 16
+
+ focus: true
+
+ property alias listMargins: listItemSvg.margins
+
+ PlasmaCore.FrameSvgItem {
+ id : listItemSvg
+ imagePath: "widgets/listitem"
+ prefix: "normal"
+ visible: false
+ }
+
+ Keys.onPressed: {
+ switch(event.key) {
+ case Qt.Key_Up: {
+ clipboardMenu.view.decrementCurrentIndex();
+ event.accepted = true;
+ break;
+ }
+ case Qt.Key_Down: {
+ clipboardMenu.view.incrementCurrentIndex();
+ event.accepted = true;
+ break;
+ }
+ case Qt.Key_Enter:
+ case Qt.Key_Return: {
+ if (clipboardMenu.view.currentIndex >= 0) {
+ var uuid = clipboardMenu.model.get(clipboardMenu.view.currentIndex).UuidRole
+ if (uuid) {
+ clipboardSource.service(uuid, "invoke")
+ clipboardMenu.view.currentIndex = 0
+ }
+ }
+ break;
+ }
+ case Qt.Key_Escape: {
+ if (filter.text == "") {
+ plasmoid.expanded = false;
+ } else {
+ filter.text = "";
+ }
+ event.accepted = true;
+ break;
+ }
+ default: { // forward key to filter
+ // filter.text += event.text wil break if the key is backspace
+ if (event.key == Qt.Key_Backspace && filter.text == "") {
+ return;
+ }
+ if (event.text != "" && !filter.activeFocus) {
+ clipboardMenu.view.currentIndex = -1
+ if (event.text == "v" && event.modifiers & Qt.ControlModifier) {
+ filter.paste();
+ } else {
+ filter.text = "";
+ filter.text += event.text;
+ }
+ filter.forceActiveFocus();
+ event.accepted = true;
+ }
+ }
+ }
+ }
+ ColumnLayout {
+ anchors.fill: parent
+ RowLayout {
+ Layout.fillWidth: true
+ Item {
+ width: units.gridUnit / 2 - parent.spacing
+ height: 1
+ }
+ PlasmaComponents.TextField {
+ id: filter
+ placeholderText: i18n("Search")
+ clearButtonShown: true
+ Layout.fillWidth: true
+ }
+ }
+ Menu {
+ id: clipboardMenu
+ model: PlasmaCore.SortFilterModel {
+ sourceModel: clipboardSource.models.katesessions
+ filterRole: "DisplayRole"
+ filterRegExp: filter.text
+ }
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ onItemSelected: clipboardSource.service(uuid, "invoke")
+ onRemove: clipboardSource.service(uuid, "remove")
+ onNewSession:clipboardSource.newSession(sessionName)
+ }
+ NewSessionDialog {
+ id: newsessiondialog
+ }
+ }
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/applet/metadata.desktop
^
|
@@ -0,0 +1,127 @@
+[Desktop Entry]
+Name=Kate Session Applet
+Name[ast]=Miniaplicación de sesiones de Kate
+Name[bg]=Сесии на Kate
+Name[bs]=Programčić Kate sesije
+Name[ca]=Miniaplicació de sessió del Kate
+Name[ca@valencia]=Miniaplicació de sessió del Kate
+Name[cs]=Applet sezení Kate
+Name[da]=Panelprogram til Kate-session
+Name[de]=Kate-Sitzungsverwaltung
+Name[el]=Μικροεφαρμογή συνεδρίας Kate
+Name[en_GB]=Kate Session Applet
+Name[es]=Miniaplicación de sesiones de Kate
+Name[et]=Kate seansi aplett
+Name[eu]=Kate saioaren miniaplikazioa
+Name[fi]=Kate-istuntosovelma
+Name[fr]=Applet de sessions pour Kate
+Name[ga]=Feidhmchláirín Seisiúin Kate
+Name[gl]=Applet de sesións de Kate
+Name[he]=יישומון הפעלות של Kate
+Name[hu]=Kate munkamenet-menü
+Name[ia]=Applet de session de Kate
+Name[it]=Applet di sessioni di Kate
+Name[ja]=Kate セッションアプレット
+Name[kk]=Kate сеанс апплеті
+Name[km]=អាប់ភ្លេតសម័យ Kate
+Name[ko]=Kate 세션 애플릿
+Name[lt]=Kate sesijų programėlė
+Name[lv]=Kate sesiju sīklietotne
+Name[mr]=केट सत्र एप्लेट
+Name[nb]=Kate øktvelger
+Name[nds]=Kate-Törnlüttprogramm
+Name[nl]=Kate sessieapplet
+Name[nn]=Kate-øktveljar
+Name[pa]=ਕੇਟ ਸ਼ੈਸ਼ਨ ਐਪਲਿਟ
+Name[pl]=Aplet sesji Kate
+Name[pt]='Applet' de Sessões do Kate
+Name[pt_BR]=Miniaplicativo de sessões do Kate
+Name[ro]=Miniaplicație de sesiune Kate
+Name[ru]=Kate: сеансы
+Name[si]=Kate වාර ඇප්ලටය
+Name[sk]=Applet Kate sedenia
+Name[sl]=Aplet sej za Kate
+Name[sr]=Кејтине сесије
+Name[sr@ijekavian]=Кејтине сесије
+Name[sr@ijekavianlatin]=Kateine sesije
+Name[sr@latin]=Kateine sesije
+Name[sv]=Kate sessionsminiprogram
+Name[tg]=Барномаи мониторинги Кейт
+Name[tr]=Kate Oturum Programcığı
+Name[ug]=Kate ئەڭگىمە قوللانچاق
+Name[uk]=Аплет сеансів Kate
+Name[x-test]=xxKate Session Appletxx
+Name[zh_CN]=Kate 会话小程序
+Name[zh_TW]=Kate 工作階段小程式
+Comment=Kate Session Launcher
+Comment[ast]=Llanzador de sesiones de Kate
+Comment[bg]=Зареждане на сесии на Kate
+Comment[bs]=Pokretač Kate sesija
+Comment[ca]=Llançador de la sessió del Kate
+Comment[ca@valencia]=Llançador de sessió del Kate
+Comment[cs]=Spouštěč sezení Kate
+Comment[da]=Kate sessionstarter
+Comment[de]=Kate-Sitzung starten
+Comment[el]=Εκτελεστής συνεδρίας Kate
+Comment[en_GB]=Kate Session Launcher
+Comment[es]=Lanzador de sesiones de Kate
+Comment[et]=Kate seansi käivitaja
+Comment[eu]=Kate saioaren abiarazlea
+Comment[fi]=Kate-istunnonkäynnistin
+Comment[fr]=Lanceur de sessions pour Kate
+Comment[ga]=Tosaitheoir Seisiúin Kate
+Comment[gl]=Iniciador de sesións de Kate
+Comment[he]=מפעיל הפעלות של Kate
+Comment[hu]=Kate munkamenet-indító
+Comment[ia]=Lanceator de session de Kate
+Comment[is]=Kate seturæsir
+Comment[it]=Avviatore di sessioni di Kate
+Comment[ja]=Kate のセッションを開始します
+Comment[kk]=Kate сеанс жеккіші
+Comment[km]=កម្មវិធីចាប់ផ្ដើមសម័យ Kate
+Comment[ko]=Kate 세션 실행기
+Comment[lt]=Kate sesijų paleidiklis
+Comment[lv]=Kate sesiju palaidējs
+Comment[mr]=केट सत्र प्रक्षेपक
+Comment[nb]=Kate øktstarter
+Comment[nds]=Kate-Törnstarter
+Comment[nl]=Kate sessiestarter
+Comment[nn]=Start Kate-økter
+Comment[pa]=ਕੇਟ ਸ਼ੈਸ਼ਨ ਲਾਂਚਰ
+Comment[pl]=Program uruchamiający sesję Kate
+Comment[pt]=Lançador de Sessões do Kate
+Comment[pt_BR]=Lançamento de sessões do Kate
+Comment[ro]=Lansator de sesiuni Kate
+Comment[ru]=Программа запуска сеанса Kate
+Comment[si]=Kate වාර ආරම්භකය
+Comment[sk]=Spúšťač Kate sedenia
+Comment[sl]=Zaganjalnik sej za Kate
+Comment[sr]=Покретач Кејтиних сесија
+Comment[sr@ijekavian]=Покретач Кејтиних сесија
+Comment[sr@ijekavianlatin]=Pokretač Kateinih sesija
+Comment[sr@latin]=Pokretač Kateinih sesija
+Comment[sv]=Kate sessionsstart
+Comment[tg]=Оғозкунандаи мониторинги Кейт
+Comment[tr]=Kate Oturum Başlatıcı
+Comment[ug]=Kate ئەڭگىمە قوزغاتقۇچ
+Comment[uk]=Запуск сеансів Kate
+Comment[x-test]=xxKate Session Launcherxx
+Comment[zh_CN]=Kate 会话启动器
+Comment[zh_TW]=Kate 工作階段啟動器
+
+Type=Service
+Icon=kate
+X-KDE-ServiceTypes=Plasma/Applet,Plasma/PopupApplet
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/katesessions.qml
+X-Plasma-NotificationArea=true
+
+X-KDE-PluginInfo-Author=Joseph Wenninger
+X-KDE-PluginInfo-Email=jowenn@kde.org
+X-KDE-PluginInfo-Name=org.kde.plasma.katesessions
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Category=Utilities
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/CMakeLists.txt
^
|
@@ -0,0 +1,27 @@
+# Plasma Data Engine
+set(plasma_engine_katesessions_SRCS katesessionsengine.cpp katesessionsmodel.cpp katesessionsjob.cpp katesessionsservice.cpp)
+add_library(plasma_engine_katesessions MODULE ${plasma_engine_katesessions_SRCS})
+kservice_desktop_to_json(plasma_engine_katesessions plasma-dataengine-katesessions.desktop)
+target_link_libraries(plasma_engine_katesessions
+# Qt5::DBus
+ Qt5::Widgets # QAction
+# KF5::ConfigGui
+# KF5::Completion # klineedit - port away?
+# KF5::CoreAddons # KUrlMimeData
+# KF5::GlobalAccel
+ KF5::IconThemes
+# KF5::KIOWidgets # PreviewJob
+ KF5::Plasma
+ KF5::Service
+ KF5::I18n
+# KF5::TextWidgets # KTextEdit
+# KF5::WidgetsAddons # KMessageBox
+# KF5::WindowSystem
+# KF5::XmlGui # KActionCollection
+# ${ZLIB_LIBRARY}
+)
+
+install(TARGETS plasma_engine_katesessions DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
+install(FILES plasma-dataengine-katesessions.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+install(FILES org.kde.plasma.katesessions.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)
+
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/katesessionsengine.cpp
^
|
@@ -0,0 +1,51 @@
+/********************************************************************
+This file is part of the KDE project.
+
+Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org>
+based on clipboard engine:
+Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+#include "katesessionsengine.h"
+#include "katesessionsmodel.h"
+#include "katesessionsservice.h"
+#include <QDebug>
+
+static const QString s_clipboardSourceName = QStringLiteral("katesessions");
+
+KateSessionsEngine::KateSessionsEngine(QObject *parent, const QVariantList &args)
+ : Plasma::DataEngine(parent, args)
+{
+ qDebug()<<"JOWENN";
+ setData(s_clipboardSourceName,QStringLiteral("test_data"),QLatin1String("This is just for testing"));
+ setModel(s_clipboardSourceName,new KateSessionsModel(this));
+}
+
+KateSessionsEngine::~KateSessionsEngine()
+{
+
+}
+
+Plasma::Service *KateSessionsEngine::serviceForSource(const QString &source)
+{
+ qDebug()<< "Creating KateSessionService";
+ Plasma::Service *service = new KateSessionsService(this, source);
+ service->setParent(this);
+ return service;
+}
+
+K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(org.kde.plasma.katesessions, KateSessionsEngine, "plasma-dataengine-katesessions.json")
+
+#include "katesessionsengine.moc"
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/katesessionsengine.h
^
|
@@ -0,0 +1,38 @@
+/********************************************************************
+This file is part of the KDE project.
+
+Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org>
+based on clipboard engine:
+Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+#ifndef KATESESSIONS_ENGINE_H
+#define KATESESSIONS_ENGINE_H
+
+#include <Plasma/DataEngine>
+
+
+class KateSessionsEngine : public Plasma::DataEngine
+{
+ Q_OBJECT
+public:
+ KateSessionsEngine(QObject *parent, const QVariantList &args);
+ ~KateSessionsEngine();
+
+ Plasma::Service *serviceForSource (const QString &source) override;
+
+};
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/katesessionsjob.cpp
^
|
@@ -0,0 +1,84 @@
+/********************************************************************
+This file is part of the KDE project.
+
+Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org>
+based on clipboard engine:
+Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
+partly based on code:
+Copyright (C) 2008 by Montel Laurent <montel@kde.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+#include "katesessionsjob.h"
+#include "katesessionsengine.h"
+#include <QDebug>
+#include <KToolInvocation>
+#include <QUrl>
+
+static const QString s_clipboardSourceName = QStringLiteral("katesessions");
+
+KateSessionsJob::KateSessionsJob(KateSessionsEngine *engine, const QString &destination, const QString &operation, const QVariantMap ¶meters, QObject *parent)
+ : Plasma::ServiceJob(destination, operation, parameters, parent)
+ , m_engine(engine)
+{
+}
+
+void KateSessionsJob::start()
+{
+ qDebug()<<"Job started:"<<operationName()<<" "<<destination();
+ const QString operation = operationName();
+ // first check for operations not needing an item
+ if (operation == QLatin1String("newSession")) {
+ QString sessionName=parameters().value(QLatin1String("sessionName")).toString();
+ if (sessionName.isEmpty()) {
+ setResult(false);
+ emitResult();
+ return;
+ }
+ //CHECK IF SESSION EXISTS
+ QStringList args;
+ args <<QLatin1String("-n")<<QLatin1String("--start")<< sessionName;
+ KToolInvocation::kdeinitExec(QLatin1String("kate"), args);
+ setResult(true);
+ emitResult();
+ return;
+ } else if (operation == QLatin1String("invoke")) {
+ QString dest=destination();
+ QStringList args;
+ if (dest==QLatin1String("_kate_noargs")) {
+ //do nothing
+ } else if (dest==QLatin1String("_kate_anon_newsession")) {
+ args << QLatin1String("--startanon");
+ } else if (dest==QLatin1String("_kate_newsession")) {
+ args << QLatin1String("--startanon");
+ qDebug()<<"This should not be reached";
+ } else {
+ dest.chop(12); // .katesession
+ args <<QLatin1String("-n")<<QLatin1String("--start")<<QUrl::fromPercentEncoding(dest.toLatin1());
+ //args <<"-n"<< "--start"<<m_sessions[ id-3 ];
+ }
+
+ KToolInvocation::kdeinitExec(QLatin1String("kate"), args);
+ setResult(true);
+ emitResult();
+ return;
+ } else if (operation == QLatin1String("remove")) {
+ qDebug()<<operation<<destination();
+ setResult(true);
+ emitResult();
+ return;
+ }
+ setResult(false);
+ emitResult();
+}
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/katesessionsjob.h
^
|
@@ -0,0 +1,41 @@
+/********************************************************************
+This file is part of the KDE project.
+
+Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org>
+based on clipboard engine:
+Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+#ifndef KLIPPER_CLIPBOARDJOB_H
+#define KLIPPER_CLIPBOARDJOB_H
+
+#include <Plasma/ServiceJob>
+
+class KateSessionsEngine;
+
+class KateSessionsJob : public Plasma::ServiceJob
+{
+ Q_OBJECT
+public:
+ KateSessionsJob(KateSessionsEngine* engine,const QString &destination, const QString &operation, const QVariantMap ¶meters, QObject *parent=0);
+ ~KateSessionsJob() = default;
+
+ void start() override;
+
+private:
+ KateSessionsEngine *m_engine;
+};
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/katesessionsmodel.cpp
^
|
@@ -0,0 +1,133 @@
+/***************************************************************************
+ * Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org> *
+ * Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
+ ***************************************************************************/
+
+#include "katesessionsmodel.h"
+#include <QStyleOptionGraphicsItem>
+#include <QTreeView>
+#include <QVBoxLayout>
+#include <QGraphicsGridLayout>
+#include <KIconLoader>
+#include <QGraphicsProxyWidget>
+#include <QListWidgetItem>
+#include <QStandardItemModel>
+#include <KToolInvocation>
+#include <KDirWatch>
+#include <QGraphicsLinearLayout>
+#include <KStringHandler>
+#include <QFile>
+#include <QDir>
+#include <QIcon>
+#include <KLocalizedString>
+#include <QStandardPaths>
+#include <QDebug>
+
+bool katesessions_compare_sessions(const QString &s1, const QString &s2) {
+ //return KStringHandler::naturalCompare(s1,s2)==-1;
+ return s1.compare(s2)==-1;
+}
+
+
+KateSessionsModel::KateSessionsModel(QObject *parent)
+ : QStandardItemModel(parent) /*, m_config(0)*/
+{
+ KDirWatch *dirwatch = new KDirWatch( this );
+ m_sessionsDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/kate/sessions");
+
+ dirwatch->addDir( m_sessionsDir );
+
+ connect( dirwatch, SIGNAL(dirty(QString)), this, SLOT(slotUpdateSessionMenu()) );
+ slotUpdateSessionMenu();
+}
+
+KateSessionsModel::~KateSessionsModel()
+{
+}
+
+
+void KateSessionsModel::slotUpdateSessionMenu()
+{
+ clear();
+ m_sessions.clear();
+ m_fullList.clear();
+ initSessionFiles();
+}
+
+void KateSessionsModel::initSessionFiles()
+{
+
+ QStandardItem *item = new QStandardItem();
+ item->setData(i18n("Start Kate (no arguments)"), Qt::DisplayRole);
+ item->setData( QIcon::fromTheme( QStringLiteral("kate") ), Qt::DecorationRole );
+ item->setData( QStringLiteral("_kate_noargs"), Uuid );
+ item->setData(0,TypeRole);
+ m_fullList << item->data(Qt::DisplayRole).toString();
+ appendRow(item);
+
+ item = new QStandardItem();
+ item->setData( i18n("New Kate Session"), Qt::DisplayRole);
+ item->setData( QIcon::fromTheme( QStringLiteral("document-new") ), Qt::DecorationRole );
+ qDebug()<<QIcon::fromTheme( QStringLiteral("document-new"));
+ item->setData( QStringLiteral("_kate_newsession"), Uuid );
+ item->setData(1,TypeRole);
+ m_fullList << item->data(Qt::DisplayRole).toString();
+ appendRow(item);
+
+ item = new QStandardItem();
+ item->setData( i18n("New Anonymous Session"), Qt::DisplayRole);
+ item->setData( QStringLiteral("_kate_anon_newsession"), Uuid );
+ item->setData(0,TypeRole);
+ item->setData( QIcon::fromTheme( QStringLiteral("document-new") ), Qt::DecorationRole );
+ m_fullList << item->data(Qt::DisplayRole).toString();
+ appendRow(item);
+
+ QDir dir(m_sessionsDir, QStringLiteral("*.katesession"));
+
+ for (unsigned int i = 0; i < dir.count(); ++i) {
+ QString name = dir[i];
+ name.chop(12); // .katesession
+ m_sessions << QUrl::fromPercentEncoding(name.toLatin1());
+ }
+
+
+ qSort(m_sessions.begin(),m_sessions.end(),katesessions_compare_sessions);
+ QLatin1String ext(".katesession");
+ for(QStringList::ConstIterator it=m_sessions.constBegin();it!=m_sessions.constEnd();++it)
+ {
+ m_fullList << *it;
+ item = new QStandardItem();
+ item->setData(*it, Qt::DisplayRole);
+ item->setData( QString((*it)+ext), Uuid );
+ item->setData( QIcon::fromTheme( QStringLiteral("document-open") ), Qt::DecorationRole );
+ item->setData(2,TypeRole);
+ appendRow( item);
+ }
+}
+
+QHash< int, QByteArray > KateSessionsModel::roleNames() const
+{
+ QHash<int, QByteArray> hash;
+ hash.insert(Qt::DisplayRole, QByteArrayLiteral("DisplayRole"));
+ hash.insert(Qt::DecorationRole, QByteArrayLiteral("DecorationRole"));
+ hash.insert(Qt::UserRole+3, QByteArrayLiteral("UuidRole"));
+ hash.insert(Qt::UserRole+4, QByteArrayLiteral("TypeRole"));
+ return hash;
+}
+
+#include "katesessionsmodel.moc"
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/katesessionsmodel.h
^
|
@@ -0,0 +1,68 @@
+/***************************************************************************
+ * Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org> *
+ * Copyright (C) 2008 by Montel Laurent <montel@kde.org> *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
+ ***************************************************************************/
+
+#ifndef _KATESESSIONSMODEL_H_
+#define _KATESESSIONSMODEL_H_
+
+/*
+#include <plasma/popupapplet.h>
+
+#include "ui_katesessionConfig.h"
+*/
+
+#include <QStandardItemModel>
+
+class QTreeView;
+class QGraphicsProxyWidget;
+
+class QModelIndex;
+class KConfigDialog;
+class QStringList;
+
+class KateSessionsModel : public QStandardItemModel
+{
+ Q_OBJECT
+public:
+ KateSessionsModel(QObject *parent);
+ ~KateSessionsModel();
+ QHash< int, QByteArray > roleNames() const override;
+ enum SpecificRoles {
+ Uuid = Qt::UserRole+3,
+ TypeRole = Qt::UserRole+4
+ };
+
+
+protected Q_SLOTS:
+// void slotOnItemClicked(const QModelIndex &index);
+ void slotUpdateSessionMenu();
+// void slotSaveConfig();
+
+protected:
+ void initSessionFiles();
+/* void createConfigurationInterface(KConfigDialog *parent);
+ void configChanged();*/
+private:
+
+ QStringList m_sessions;
+ QStringList m_fullList;
+ QString m_sessionsDir;
+// KateSessionConfigInterface *m_config;
+};
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/katesessionsservice.cpp
^
|
@@ -0,0 +1,38 @@
+/********************************************************************
+This file is part of the KDE project.
+
+Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org>
+based on clipboard engine:
+Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+#include "katesessionsengine.h"
+#include "katesessionsjob.h"
+#include "katesessionsservice.h"
+#include <QDebug>
+
+KateSessionsService::KateSessionsService(KateSessionsEngine *engine, const QString &uuid)
+ : Plasma::Service()
+ , m_engine(engine)
+ , m_uuid(uuid)
+{
+ setName(QStringLiteral("org.kde.plasma.katesessions"));
+}
+
+Plasma::ServiceJob *KateSessionsService::createJob(const QString &operation, QVariantMap ¶meters)
+{
+ qDebug()<<"creating KateSessionsJob";
+ return new KateSessionsJob(m_engine, m_uuid, operation, parameters, this);
+}
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/katesessionsservice.h
^
|
@@ -0,0 +1,43 @@
+/********************************************************************
+This file is part of the KDE project.
+
+Copyright (C) 2014 Joseph Wenninger <jowenn@kde.org>
+based on clipboard engine:
+Copyright (C) 2014 Martin Gräßlin <mgraesslin@kde.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+#ifndef KLIPPER_CLIPBOARDSERVICE_H
+#define KLIPPER_CLIPBOARDSERVICE_H
+
+#include <Plasma/Service>
+
+class KateSessionsEngine;
+
+class KateSessionsService : public Plasma::Service
+{
+ Q_OBJECT
+public:
+ KateSessionsService(KateSessionsEngine *engine, const QString &uuid);
+ ~KateSessionsService() = default;
+
+protected:
+ Plasma::ServiceJob *createJob(const QString &operation, QVariantMap ¶meters) override;
+
+private:
+ KateSessionsEngine *m_engine;
+ QString m_uuid;
+};
+
+#endif
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/org.kde.plasma.katesessions.operations
^
|
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE kcfg SYSTEM
+ "http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
+<kcfg>
+ <group name="newSession">
+ <entry name="sessionName" type="String">
+ <label>The name of the session to be created</label>
+ </entry>
+ </group>
+ <group name="invoke">
+ </group>
+ <group name="remove">
+ </group>
+</kcfg>
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/sessionapplet/engine/plasma-dataengine-katesessions.desktop
^
|
@@ -0,0 +1,126 @@
+[Desktop Entry]
+Name=Kate Session Applet
+Name[ast]=Miniaplicación de sesiones de Kate
+Name[bg]=Сесии на Kate
+Name[bs]=Programčić Kate sesije
+Name[ca]=Miniaplicació de sessió del Kate
+Name[ca@valencia]=Miniaplicació de sessió del Kate
+Name[cs]=Applet sezení Kate
+Name[da]=Panelprogram til Kate-session
+Name[de]=Kate-Sitzungsverwaltung
+Name[el]=Μικροεφαρμογή συνεδρίας Kate
+Name[en_GB]=Kate Session Applet
+Name[es]=Miniaplicación de sesiones de Kate
+Name[et]=Kate seansi aplett
+Name[eu]=Kate saioaren miniaplikazioa
+Name[fi]=Kate-istuntosovelma
+Name[fr]=Applet de sessions pour Kate
+Name[ga]=Feidhmchláirín Seisiúin Kate
+Name[gl]=Applet de sesións de Kate
+Name[he]=יישומון הפעלות של Kate
+Name[hu]=Kate munkamenet-menü
+Name[ia]=Applet de session de Kate
+Name[it]=Applet di sessioni di Kate
+Name[ja]=Kate セッションアプレット
+Name[kk]=Kate сеанс апплеті
+Name[km]=អាប់ភ្លេតសម័យ Kate
+Name[ko]=Kate 세션 애플릿
+Name[lt]=Kate sesijų programėlė
+Name[lv]=Kate sesiju sīklietotne
+Name[mr]=केट सत्र एप्लेट
+Name[nb]=Kate øktvelger
+Name[nds]=Kate-Törnlüttprogramm
+Name[nl]=Kate sessieapplet
+Name[nn]=Kate-øktveljar
+Name[pa]=ਕੇਟ ਸ਼ੈਸ਼ਨ ਐਪਲਿਟ
+Name[pl]=Aplet sesji Kate
+Name[pt]='Applet' de Sessões do Kate
+Name[pt_BR]=Miniaplicativo de sessões do Kate
+Name[ro]=Miniaplicație de sesiune Kate
+Name[ru]=Kate: сеансы
+Name[si]=Kate වාර ඇප්ලටය
+Name[sk]=Applet Kate sedenia
+Name[sl]=Aplet sej za Kate
+Name[sr]=Кејтине сесије
+Name[sr@ijekavian]=Кејтине сесије
+Name[sr@ijekavianlatin]=Kateine sesije
+Name[sr@latin]=Kateine sesije
+Name[sv]=Kate sessionsminiprogram
+Name[tg]=Барномаи мониторинги Кейт
+Name[tr]=Kate Oturum Programcığı
+Name[ug]=Kate ئەڭگىمە قوللانچاق
+Name[uk]=Аплет сеансів Kate
+Name[x-test]=xxKate Session Appletxx
+Name[zh_CN]=Kate 会话小程序
+Name[zh_TW]=Kate 工作階段小程式
+Comment=Kate Session Launcher
+Comment[ast]=Llanzador de sesiones de Kate
+Comment[bg]=Зареждане на сесии на Kate
+Comment[bs]=Pokretač Kate sesija
+Comment[ca]=Llançador de la sessió del Kate
+Comment[ca@valencia]=Llançador de sessió del Kate
+Comment[cs]=Spouštěč sezení Kate
+Comment[da]=Kate sessionstarter
+Comment[de]=Kate-Sitzung starten
+Comment[el]=Εκτελεστής συνεδρίας Kate
+Comment[en_GB]=Kate Session Launcher
+Comment[es]=Lanzador de sesiones de Kate
+Comment[et]=Kate seansi käivitaja
+Comment[eu]=Kate saioaren abiarazlea
+Comment[fi]=Kate-istunnonkäynnistin
+Comment[fr]=Lanceur de sessions pour Kate
+Comment[ga]=Tosaitheoir Seisiúin Kate
+Comment[gl]=Iniciador de sesións de Kate
+Comment[he]=מפעיל הפעלות של Kate
+Comment[hu]=Kate munkamenet-indító
+Comment[ia]=Lanceator de session de Kate
+Comment[is]=Kate seturæsir
+Comment[it]=Avviatore di sessioni di Kate
+Comment[ja]=Kate のセッションを開始します
+Comment[kk]=Kate сеанс жеккіші
+Comment[km]=កម្មវិធីចាប់ផ្ដើមសម័យ Kate
+Comment[ko]=Kate 세션 실행기
+Comment[lt]=Kate sesijų paleidiklis
+Comment[lv]=Kate sesiju palaidējs
+Comment[mr]=केट सत्र प्रक्षेपक
+Comment[nb]=Kate øktstarter
+Comment[nds]=Kate-Törnstarter
+Comment[nl]=Kate sessiestarter
+Comment[nn]=Start Kate-økter
+Comment[pa]=ਕੇਟ ਸ਼ੈਸ਼ਨ ਲਾਂਚਰ
+Comment[pl]=Program uruchamiający sesję Kate
+Comment[pt]=Lançador de Sessões do Kate
+Comment[pt_BR]=Lançamento de sessões do Kate
+Comment[ro]=Lansator de sesiuni Kate
+Comment[ru]=Программа запуска сеанса Kate
+Comment[si]=Kate වාර ආරම්භකය
+Comment[sk]=Spúšťač Kate sedenia
+Comment[sl]=Zaganjalnik sej za Kate
+Comment[sr]=Покретач Кејтиних сесија
+Comment[sr@ijekavian]=Покретач Кејтиних сесија
+Comment[sr@ijekavianlatin]=Pokretač Kateinih sesija
+Comment[sr@latin]=Pokretač Kateinih sesija
+Comment[sv]=Kate sessionsstart
+Comment[tg]=Оғозкунандаи мониторинги Кейт
+Comment[tr]=Kate Oturum Başlatıcı
+Comment[ug]=Kate ئەڭگىمە قوزغاتقۇچ
+Comment[uk]=Запуск сеансів Kate
+Comment[x-test]=xxKate Session Launcherxx
+Comment[zh_CN]=Kate 会话启动器
+Comment[zh_TW]=Kate 工作階段啟動器
+
+Type=Service
+Icon=kate
+X-KDE-ServiceTypes=Plasma/DataEngine
+
+X-KDE-Library=plasma_engine_clipboard
+
+
+X-KDE-PluginInfo-Author=Joseph Wenninger
+X-KDE-PluginInfo-Email=jowenn@kde.org
+X-KDE-PluginInfo-Name=org.kde.plasma.katesessions
+X-KDE-PluginInfo-Version=1.0
+X-KDE-PluginInfo-Category=Utilities
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/CMakeLists.txt
^
|
@@ -10,7 +10,6 @@
snippetview.cpp
snippetstore.cpp
snippetrepository.cpp
-snippetfilterproxymodel.cpp
snippetcompletionmodel.cpp
snippetcompletionitem.cpp
snippet.cpp
@@ -29,13 +28,12 @@
KF5::Parts KF5::I18n
KF5::NewStuff Qt5::Script KF5::ItemViews KF5::IconThemes)
-install(TARGETS katesnippetsplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katesnippetsplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
########### install files ###############
-kservice_desktop_to_json (katesnippetsplugin katesnippetsplugin.desktop)
-install( FILES katesnippetsplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+kcoreaddons_desktop_to_json (katesnippetsplugin katesnippetsplugin.desktop)
# install the snippet stuff
install( FILES ktexteditor_codesnippets_core.knsrc DESTINATION ${CONFIG_INSTALL_DIR} )
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/editrepository.cpp
^
|
@@ -4,6 +4,7 @@
* Copyright (C) 2007 Robert Gruber <rgruber@users.sourceforge.net>
* Copyright (C) 2010 Milian Wolff <mail@milianw.de>
* Copyright (C) 2012 Christoph Cullmann <cullmann@kde.org>
+ * Copyright (C) 2014 Sven Brauch <svenbrauch@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -38,97 +39,67 @@
EditRepository::EditRepository(SnippetRepository* repository, QWidget* parent)
: QDialog(parent), Ui::EditRepositoryBase(), m_repo(repository)
{
- QVBoxLayout *mainLayout = new QVBoxLayout;
- setLayout(mainLayout);
+ setupUi(this);
- QWidget *mainWidget = new QWidget;
- setupUi(mainWidget);
- mainWidget->layout()->setMargin(0);
- mainLayout->addWidget(mainWidget);
-
- connect(repoNameEdit, SIGNAL(textEdited(QString)), this, SLOT(validate()));
-
- QDialogButtonBox *buttons = new QDialogButtonBox(this);
- mainLayout->addWidget(buttons);
-
- m_okButton = new QPushButton;
- KGuiItem::assign(m_okButton, KStandardGuiItem::ok());
- buttons->addButton(m_okButton, QDialogButtonBox::AcceptRole);
- connect(m_okButton, SIGNAL(clicked()), this, SLOT(saveAndAccept()));
-
- m_applyButton = new QPushButton;
- KGuiItem::assign(m_applyButton, KStandardGuiItem::apply());
- buttons->addButton(m_applyButton, QDialogButtonBox::ApplyRole);
- connect(m_applyButton, SIGNAL(clicked()), this, SLOT(save()));
-
- QPushButton *cancelButton = new QPushButton;
- KGuiItem::assign(cancelButton, KStandardGuiItem::cancel());
- buttons->addButton(cancelButton, QDialogButtonBox::RejectRole);
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
- ///
-
- // fill list of available modes
- KTextEditor::Document *document = KTextEditor::Editor::instance()->createDocument(0);
- repoFileTypesList->addItems(document->highlightingModes());
- repoFileTypesList->sortItems();
- repoFileTypesList->setSelectionMode(QAbstractItemView::ExtendedSelection);
- connect(repoFileTypesList->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
- this, SLOT(updateFileTypes()));
-
- delete document;
-
- // add default licenses
- repoLicenseEdit->addItems(QStringList() << QLatin1String("Artistic") << QLatin1String("BSD") << QLatin1String("LGPL v2+") << QLatin1String("LGPL v3+"));
- repoLicenseEdit->setCurrentIndex(1); // preselect BSD
- repoLicenseEdit->setEditable(true);
-
- // if we edit a repo, add all existing data
- if ( m_repo ) {
- repoNameEdit->setText(m_repo->text());
- repoAuthorsEdit->setText(m_repo->authors());
- repoNamespaceEdit->setText(m_repo->completionNamespace());
- if ( !m_repo->license().isEmpty() ) {
- int index = repoLicenseEdit->findText(m_repo->license());
- if ( index == -1 ) {
- repoLicenseEdit->addItem(m_repo->license());
- repoLicenseEdit->model()->sort(0);
- index = repoLicenseEdit->findText(m_repo->license());
- }
- repoLicenseEdit->setCurrentIndex(index);
- }
- foreach ( const QString& type, m_repo->fileTypes() ) {
- foreach( QListWidgetItem* item, repoFileTypesList->findItems(type, Qt::MatchExactly) ) {
- item->setSelected(true);
- }
- }
-
- setWindowTitle(i18n("Edit Snippet Repository %1", m_repo->text()));
- } else {
- setWindowTitle(i18n("Create New Snippet Repository"));
- KUser user;
- repoAuthorsEdit->setText(user.property(KUser::FullName).toString());
- }
-
- validate();
- updateFileTypes();
- repoNameEdit->setFocus();
-}
+ connect(repoNameEdit, &KLineEdit::textEdited, this, &EditRepository::validate);
+ connect(this, &QDialog::accepted, this, &EditRepository::save);
-EditRepository::~EditRepository()
-{
+ auto ok = buttonBox->button(QDialogButtonBox::Ok);
+ KGuiItem::assign(ok, KStandardGuiItem::ok());
+ connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
+
+ auto cancel = buttonBox->button(QDialogButtonBox::Cancel);
+ KGuiItem::assign(cancel, KStandardGuiItem::cancel());
+ connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
+
+ // fill list of available modes
+ QSharedPointer<KTextEditor::Document> document(KTextEditor::Editor::instance()->createDocument(0));
+ repoFileTypesList->addItems(document->highlightingModes());
+ repoFileTypesList->sortItems();
+ repoFileTypesList->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ connect(repoFileTypesList->selectionModel(), &QItemSelectionModel::selectionChanged,
+ this, &EditRepository::updateFileTypes);
+
+ // add default licenses
+ repoLicenseEdit->addItems(QStringList() << QLatin1String("BSD") << QLatin1String("Artistic") << QLatin1String("LGPL v2+") << QLatin1String("LGPL v3+"));
+ repoLicenseEdit->setEditable(true);
+
+ // if we edit a repo, add all existing data
+ if ( m_repo ) {
+ repoNameEdit->setText(m_repo->text());
+ repoAuthorsEdit->setText(m_repo->authors());
+ repoNamespaceEdit->setText(m_repo->completionNamespace());
+ if ( !m_repo->license().isEmpty() ) {
+ int index = repoLicenseEdit->findText(m_repo->license());
+ if ( index == -1 ) {
+ repoLicenseEdit->addItem(m_repo->license());
+ repoLicenseEdit->model()->sort(0);
+ index = repoLicenseEdit->findText(m_repo->license());
+ }
+ repoLicenseEdit->setCurrentIndex(index);
+ }
+ foreach ( const QString& type, m_repo->fileTypes() ) {
+ foreach( QListWidgetItem* item, repoFileTypesList->findItems(type, Qt::MatchExactly) ) {
+ item->setSelected(true);
+ }
+ }
+
+ setWindowTitle(i18n("Edit Snippet Repository %1", m_repo->text()));
+ } else {
+ setWindowTitle(i18n("Create New Snippet Repository"));
+ KUser user;
+ repoAuthorsEdit->setText(user.property(KUser::FullName).toString());
+ }
+
+ validate();
+ updateFileTypes();
+ repoNameEdit->setFocus();
}
void EditRepository::validate()
{
- bool valid = !repoNameEdit->text().isEmpty() && !repoNameEdit->text().contains(QLatin1Char('/'));
- m_okButton->setEnabled(valid);
- m_applyButton->setEnabled(valid);
-}
-
-void EditRepository::saveAndAccept()
-{
- save();
- accept();
+ bool valid = !repoNameEdit->text().isEmpty() && !repoNameEdit->text().contains(QLatin1Char('/'));
+ buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
}
void EditRepository::save()
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/editrepository.h
^
|
@@ -43,16 +43,12 @@
public:
/// @p repo set to 0 when you want to create a new repository.
explicit EditRepository(SnippetRepository* repo, QWidget* parent = 0);
- virtual ~EditRepository();
private:
SnippetRepository* m_repo;
- QPushButton *m_okButton;
- QPushButton *m_applyButton;
private Q_SLOTS:
void save();
- void saveAndAccept();
void validate();
void updateFileTypes();
};
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/editrepository.ui
^
|
@@ -26,39 +26,18 @@
<item row="0" column="0">
<widget class="QLabel" name="repoNameLabel">
<property name="text">
- <string>&Name:</string>
- </property>
- <property name="buddy">
- <cstring>repoNameEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KLineEdit" name="repoNameEdit">
- <property name="toolTip">
- <string>The name of the repository. Must not be empty or contain forward slashes (/).</string>
+ <string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="repoNamespaceLabel">
<property name="text">
- <string>Na&mespace:</string>
- </property>
- <property name="buddy">
- <cstring>repoNamespaceEdit</cstring>
+ <string>Namespace:</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="KLineEdit" name="repoNamespaceEdit">
- <property name="toolTip">
- <string><p>If non-empty this will be used as a prefix for all snippets in this repository during code completion.</p>
-<p><b>Note:</b> No spaces allowed.</p></string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
+ <item row="3" column="0">
<widget class="QLabel" name="repoLicenseLabel">
<property name="text">
<string>&License:</string>
@@ -68,10 +47,10 @@
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="3" column="1">
<widget class="QComboBox" name="repoLicenseEdit"/>
</item>
- <item row="3" column="0">
+ <item row="4" column="0">
<widget class="QLabel" name="repoAuthorsLabel">
<property name="text">
<string>&Authors:</string>
@@ -81,10 +60,10 @@
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="4" column="1">
<widget class="KLineEdit" name="repoAuthorsEdit"/>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="repoFileTypesLabel">
<property name="text">
<string>&File types:</string>
@@ -94,16 +73,37 @@
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="5" column="1">
<widget class="QLabel" name="repoFileTypesListLabel">
<property name="text">
<string notr="true">list of selected filetypes</string>
</property>
</widget>
</item>
- <item row="5" column="0" colspan="2">
+ <item row="6" column="0" colspan="2">
<widget class="QListWidget" name="repoFileTypesList"/>
</item>
+ <item row="7" column="0" colspan="2">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="repoNameEdit">
+ <property name="placeholderText">
+ <string>A short name for the repository</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="repoNamespaceEdit">
+ <property name="placeholderText">
+ <string>Prefix to show in code completion</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/editsnippet.cpp
^
|
@@ -37,36 +37,21 @@
#include <QToolButton>
#include <QPushButton>
+#include <QWhatsThis>
#include <KTextEditor/Editor>
#include <KTextEditor/Document>
#include <KTextEditor/View>
-QPair<KTextEditor::View*, QToolButton*> getViewForTab(QWidget* tabWidget)
+KTextEditor::View* createView(QWidget* tabWidget)
{
- QVBoxLayout* layout = new QVBoxLayout;
- tabWidget->setLayout(layout);
+ auto document = KTextEditor::Editor::instance()->createDocument(tabWidget);
+ auto view = document->createView(tabWidget);
- KTextEditor::Document *document = KTextEditor::Editor::instance()->createDocument (tabWidget);
- KTextEditor::View *view = document->createView (tabWidget);
-
- Q_ASSERT(view);
- Q_ASSERT(view->action("file_save"));
view->action("file_save")->setEnabled(false);
-
- layout->addWidget(view);
-
- QHBoxLayout* hlayout = new QHBoxLayout;
- hlayout->addStretch();
-
- QToolButton* button = new QToolButton;
- button->setText(i18n("Help"));
- button->setIcon(QIcon::fromTheme(QLatin1String("help-contents")));
- button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- hlayout->addWidget(button);
- layout->addLayout(hlayout);
-
- return qMakePair(view, button);
+ tabWidget->layout()->addWidget(view);
+ view->setStatusBarEnabled(false);
+ return view;
}
EditSnippet::EditSnippet(SnippetRepository* repository, Snippet* snippet, QWidget* parent)
@@ -74,70 +59,54 @@
, m_snippet(snippet), m_topBoxModified(false)
{
Q_ASSERT(m_repo);
- QVBoxLayout *mainLayout = new QVBoxLayout;
- setLayout(mainLayout);
-
- QWidget *w = new QWidget(this);
- mainLayout->addWidget(w);
- m_ui->setupUi(w);
+ m_ui->setupUi(this);
- QDialogButtonBox *buttons = new QDialogButtonBox(this);
- mainLayout->addWidget(buttons);
+ connect(this, &QDialog::accepted, this, &EditSnippet::save);
- m_okButton = new QPushButton;
+ m_okButton = m_ui->buttons->button(QDialogButtonBox::Ok);
KGuiItem::assign(m_okButton, KStandardGuiItem::ok());
- buttons->addButton(m_okButton, QDialogButtonBox::AcceptRole);
- connect(m_okButton, SIGNAL(clicked()), this, SLOT(saveAndAccept()));
+ m_ui->buttons->addButton(m_okButton, QDialogButtonBox::AcceptRole);
+ connect(m_okButton, &QPushButton::clicked, this, &QDialog::accept);
- m_applyButton = new QPushButton;
- KGuiItem::assign(m_applyButton, KStandardGuiItem::apply());
- buttons->addButton(m_applyButton, QDialogButtonBox::ApplyRole);
- connect(m_applyButton, SIGNAL(clicked()), this, SLOT(save()));
-
- QPushButton *cancelButton = new QPushButton;
+ auto cancelButton = m_ui->buttons->button(QDialogButtonBox::Cancel);
KGuiItem::assign(cancelButton, KStandardGuiItem::cancel());
- buttons->addButton(cancelButton, QDialogButtonBox::RejectRole);
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
+ m_ui->buttons->addButton(cancelButton, QDialogButtonBox::RejectRole);
+ connect(cancelButton, &QPushButton::clicked, this, &QDialog::reject);
- ///TODO: highlighting and documentation of template handler variables
- QPair<KTextEditor::View*, QToolButton*> pair = getViewForTab(m_ui->snippetTab);
- m_snippetView = pair.first;
- if (!m_repo->fileTypes().isEmpty()) {
+ m_snippetView = createView(m_ui->snippetTab);
+ if ( !m_repo->fileTypes().isEmpty() ) {
m_snippetView->document()->setMode(m_repo->fileTypes().first());
}
- connect(pair.second, SIGNAL(clicked(bool)),
- this, SLOT(slotSnippetDocumentation()));
- ///TODO: highlighting and documentation of KTextEditor API
- pair = getViewForTab(m_ui->scriptTab);
- m_scriptsView = pair.first;
+
+ m_scriptsView = createView(m_ui->scriptTab);
m_scriptsView->document()->setMode(QLatin1String("JavaScript"));
m_scriptsView->document()->setText(m_repo->script());
m_scriptsView->document()->setModified(false);
- connect(pair.second, SIGNAL(clicked(bool)),
- this, SLOT(slotScriptDocumentation()));
-
- m_ui->verticalLayout->setMargin(0);
- m_ui->formLayout->setMargin(0);
- m_ui->snippetShortcutWidget->layout()->setMargin(0);
-
- connect(m_ui->snippetNameEdit, SIGNAL(textEdited(QString)), this, SLOT(topBoxModified()));
- connect(m_ui->snippetNameEdit, SIGNAL(textEdited(QString)), this, SLOT(validate()));
- connect(m_ui->snippetArgumentsEdit, SIGNAL(textEdited(QString)), this, SLOT(topBoxModified()));
- connect(m_ui->snippetPostfixEdit, SIGNAL(textEdited(QString)), this, SLOT(topBoxModified()));
- connect(m_ui->snippetPrefixEdit, SIGNAL(textEdited(QString)), this, SLOT(topBoxModified()));
- connect(m_ui->snippetShortcutWidget, SIGNAL(shortcutChanged(QList<QKeySequence>)), this, SLOT(topBoxModified()));
- connect(m_snippetView->document(), SIGNAL(textChanged(KTextEditor::Document*)), this, SLOT(validate()));
+ // view for testing the snippet
+ m_testView = createView(m_ui->testWidget);
+ // splitter default size ratio
+ m_ui->splitter->setSizes(QList<int>() << 400 << 150);
+ connect(m_ui->dotest_button, &QPushButton::clicked, this, &EditSnippet::test);
+
+ // modified notifications tuff
+ connect(m_ui->snippetNameEdit, &QLineEdit::textEdited, this, &EditSnippet::topBoxModified);
+ connect(m_ui->snippetNameEdit, &QLineEdit::textEdited, this, &EditSnippet::validate);
+ connect(m_ui->snippetShortcutWidget, &KShortcutWidget::shortcutChanged, this, &EditSnippet::topBoxModified);
+ connect(m_snippetView->document(), &KTextEditor::Document::textChanged, this, &EditSnippet::validate);
+
+ auto showHelp = [](const QString& text) {
+ QWhatsThis::showText(QCursor::pos(), text);
+ };
+ connect(m_ui->snippetLabel, &QLabel::linkActivated, showHelp);
+ connect(m_ui->scriptLabel, &QLabel::linkActivated, showHelp);
// if we edit a snippet, add all existing data
if ( m_snippet ) {
setWindowTitle(i18n("Edit Snippet %1 in %2", m_snippet->text(), m_repo->text()));
- m_ui->snippetArgumentsEdit->setText(m_snippet->arguments());
m_snippetView->document()->setText(m_snippet->snippet());
m_ui->snippetNameEdit->setText(m_snippet->text());
- m_ui->snippetPostfixEdit->setText(m_snippet->postfix());
- m_ui->snippetPrefixEdit->setText(m_snippet->prefix());
m_ui->snippetShortcutWidget->setShortcut(m_snippet->action()->shortcuts());
// unset modified flags
@@ -147,14 +116,25 @@
setWindowTitle(i18n("Create New Snippet in Repository %1", m_repo->text()));
}
+ m_ui->messageWidget->hide();
validate();
m_ui->snippetNameEdit->setFocus();
+ setTabOrder(m_ui->snippetNameEdit, m_snippetView);
QSize initSize = sizeHint();
initSize.setHeight( initSize.height() + 200 );
}
+void EditSnippet::test()
+{
+ m_testView->document()->clear();
+ m_testView->insertTemplate(KTextEditor::Cursor(0, 0),
+ m_snippetView->document()->text(),
+ m_scriptsView->document()->text());
+ m_testView->setFocus();
+}
+
EditSnippet::~EditSnippet()
{
delete m_ui;
@@ -170,29 +150,20 @@
{
const QString& name = m_ui->snippetNameEdit->text();
bool valid = !name.isEmpty() && !m_snippetView->document()->isEmpty();
- if (valid) {
- // make sure the snippetname includes no spaces
- for ( int i = 0; i < name.length(); ++i ) {
- if ( name.at(i).isSpace() ) {
- valid = false;
- m_ui->messageWidget->setText(i18n("Snippet name cannot contain spaces"));
- m_ui->messageWidget->animatedShow();
- break;
- }
- }
- if (valid) {
- // hide message widget if snippet does not include spaces
- m_ui->messageWidget->animatedHide();
- }
+ // make sure the snippetname includes no spaces
+ if ( name.contains(QLatin1Char(' ')) || name.contains(QLatin1Char('\t')) ) {
+ m_ui->messageWidget->setText(i18n("Snippet name cannot contain spaces"));
+ m_ui->messageWidget->animatedShow();
+ valid = false;
+ }
+ else {
+ // hide message widget if snippet does not include spaces
+ m_ui->messageWidget->animatedHide();
+ }
+ if ( valid ) {
+ m_ui->messageWidget->hide();
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/editsnippet.h
^
|
@@ -59,18 +59,15 @@
Snippet* m_snippet;
KTextEditor::View* m_snippetView;
KTextEditor::View* m_scriptsView;
+ KTextEditor::View* m_testView;
bool m_topBoxModified;
- QPushButton *m_okButton;
- QPushButton *m_applyButton;
+ QPushButton* m_okButton;
private Q_SLOTS:
+ void test();
void save();
- void saveAndAccept();
void validate();
void topBoxModified();
-
- void slotSnippetDocumentation();
- void slotScriptDocumentation();
};
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/editsnippet.ui
^
|
@@ -18,17 +18,14 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="KMessageWidget" name="messageWidget">
- <property name="visible">
- <bool>false</bool>
- </property>
- <property name="closeButtonVisible">
- <bool>false</bool>
- </property>
- <property name="messageType">
- <enum>KMessageWidget::Warning</enum>
- </property>
- </widget>
+ <widget class="KMessageWidget" name="messageWidget" native="true">
+ <property name="visible">
+ <bool>true</bool>
+ </property>
+ <property name="closeButtonVisible" stdset="0">
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
@@ -38,120 +35,140 @@
<item row="0" column="0">
<widget class="QLabel" name="snippetName">
<property name="text">
- <string>&Name:</string>
- </property>
- <property name="buddy">
- <cstring>snippetNameEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KLineEdit" name="snippetNameEdit">
- <property name="toolTip">
- <string><p>The name will also be used as the identifier during code completion.</p>
-<p><b>Note:</b> No spaces allowed.</p></string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="snippetPrefixLabel">
- <property name="text">
- <string>Display &Prefix:</string>
- </property>
- <property name="buddy">
- <cstring>snippetPrefixEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KLineEdit" name="snippetPrefixEdit">
- <property name="toolTip">
- <string>The display prefix will be shown during code completion.</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="snippetArgumentsLabel">
- <property name="text">
- <string>Display &Arguments:</string>
- </property>
- <property name="buddy">
- <cstring>snippetArgumentsEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="KLineEdit" name="snippetArgumentsEdit">
- <property name="toolTip">
- <string>The arguments will be shown during code completion.</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="snippetPostfixLabel">
- <property name="text">
- <string>Display P&ostfix:</string>
- </property>
- <property name="buddy">
- <cstring>snippetPostfixEdit</cstring>
+ <string>Name:</string>
</property>
</widget>
</item>
- <item row="3" column="1">
- <widget class="KLineEdit" name="snippetPostfixEdit">
- <property name="toolTip">
- <string>The postfix will be shown during code completion.</string>
- </property>
- </widget>
+ <item row="1" column="0" colspan="2">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="snippetShortcutLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Shortcut:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KShortcutWidget" name="snippetShortcutWidget"/>
+ </item>
+ </layout>
</item>
- <item row="4" column="0">
- <widget class="QLabel" name="snippetShortcutLabel">
- <property name="text">
- <string>Shortcut:</string>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="snippetNameEdit">
+ <property name="placeholderText">
+ <string>will be shown in the completion list</string>
</property>
</widget>
</item>
- <item row="4" column="1">
- <widget class="KShortcutWidget" name="snippetShortcutWidget" native="true"/>
- </item>
</layout>
</item>
<item>
- <widget class="QTabWidget" name="editorTabs">
- <property name="currentIndex">
- <number>0</number>
+ <widget class="QSplitter" name="splitter">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <widget class="QWidget" name="snippetTab">
- <attribute name="title">
- <string>&Snippet</string>
- </attribute>
+ <widget class="QTabWidget" name="editorTabs">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="snippetTab">
+ <attribute name="title">
+ <string>&Snippet</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="snippetLabel">
+ <property name="text">
+ <string><html><head/><body><p>The text your snippet will insert into the document. <a href="A snippet can contain editable fields. They can be cycled by pressing Tab. The following expressions can be used in the template text to create fields: &lt;br&gt;&lt;tt&gt;${field_name}&lt;/tt&gt; creates a simple, editable field. All subsequent occurences of the same field_name create fields which mirror the contents of the first during editing.&lt;br&gt;&lt;tt&gt;${field_name=default}&lt;/tt&gt; can be used to specify a default value for the field. &lt;tt&gt;default&lt;/tt&gt; can be any JavaScript expression.&lt;br&gt;Use &lt;tt&gt;${field_name=&quot;text&amp;quot;}&lt;/tt&gt; to specify a fixed string as default value.&lt;br&gt;&lt;tt&gt;${func(other_field1, other_field2, ...)}&lt;/tt&gt; can be used to create a field which evaluates a JavaScript function on each edit and contains its contents. See the &quot;Scripts&quot; tab for more information.&lt;br&gt;&lt;tt&gt;${cursor}&lt;/tt&gt; can be used to mark the end position of the cursor after everything else was filled in."><span style=" text-decoration: underline; color:#0000ff;">More...</span></a></p></body></html></string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::RichText</enum>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="scriptTab">
+ <attribute name="title">
+ <string>S&cripts</string>
+ </attribute>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QLabel" name="scriptLabel">
+ <property name="text">
+ <string>Write down JavaScript helper functions to use in your snippets here. <a href="All JavaScript functions should return the contents you want to place in a template field as a string.<br>Functions are called in a scope which contains the contents of all editable template fields as local variables. For example in a snippet containing <tt>${field}</tt>, a variable called <tt>field</tt> will be present which contains the up-to-date contents of the template field. Those variables can either be used in the function statically or passed as arguments, by using the <tt>${func(field)}</tt> or <tt>${field2=func(field)}</tt> syntax in the snippet string.<br>You can use the kate scripting API to get the selected text, full text, file name and more by using the appropriate methods of the <tt>document</tt> and <tt>view</tt> objects. Refer to the scripting API documentation for more information.">More...</a></string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</widget>
- <widget class="QWidget" name="scriptTab">
- <attribute name="title">
- <string>S&cripts</string>
- </attribute>
+ <widget class="QWidget" name="testWidget" native="true">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/katesnippetglobal.cpp
^
|
@@ -50,16 +50,14 @@
: QObject(parent)
{
s_self = this;
-
+
SnippetStore::init(this);
- m_model = new SnippetCompletionModel;
+ m_model.reset(new SnippetCompletionModel);
}
KateSnippetGlobal::~KateSnippetGlobal ()
{
- delete m_model;
delete SnippetStore::self();
-
s_self = nullptr;
}
@@ -94,7 +92,7 @@
m_activeViewForDialog = 0;
}
-QWidget *KateSnippetGlobal::snippetWidget ()
+SnippetView* KateSnippetGlobal::snippetWidget ()
{
return new SnippetView (this, 0);
}
@@ -114,12 +112,8 @@
// try to insert snippet
SnippetCompletionItem item(snippet, static_cast<SnippetRepository*>(snippet->parent()));
- KTextEditor::Range range = view->selectionRange();
- if ( !range.isValid() ) {
- range = KTextEditor::Range(view->cursorPosition(), view->cursorPosition());
- }
- item.execute(view, range);
-
+ item.execute(view, KTextEditor::Range(view->cursorPosition(), view->cursorPosition()));
+
// set focus to view
view->setFocus ();
}
@@ -135,9 +129,9 @@
void KateSnippetGlobal::createSnippet (KTextEditor::View *view)
{
- // no active view, bad
- if (!view)
- return;
+ // no active view, bad
+ if (!view)
+ return;
// get mode
QString mode = view->document()->highlightingModeAt(view->selectionRange().isValid() ? view->selectionRange().start() : view->cursorPosition());
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/katesnippetglobal.h
^
|
@@ -28,6 +28,7 @@
#include <KTextEditor/View>
+class SnippetView;
class SnippetCompletionModel;
class Snippet;
@@ -56,13 +57,13 @@
* Code completion model.
* @return code completion model for snippets
*/
- SnippetCompletionModel *completionModel () { return m_model; }
+ SnippetCompletionModel *completionModel () { return m_model.data(); }
/**
* Create a new snippet widget, to allow to manage and insert snippets
* @return new snippet widget
*/
- QWidget *snippetWidget ();
+ SnippetView *snippetWidget ();
public Q_SLOTS:
/**
@@ -82,7 +83,7 @@
private:
static KateSnippetGlobal *s_self;
- class SnippetCompletionModel* m_model;
+ QScopedPointer<SnippetCompletionModel> m_model;
QPointer<KTextEditor::View> m_activeViewForDialog;
};
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/katesnippets.cpp
^
|
@@ -21,8 +21,10 @@
#include "katesnippets.h"
#include "snippetcompletionmodel.h"
#include "katesnippetglobal.h"
+#include "snippetview.h"
#include <QAction>
+#include <QBoxLayout>
#include <KActionCollection>
#include <KXMLGUIFactory>
@@ -33,11 +35,11 @@
#include <KTextEditor/CodeCompletionInterface>
-K_PLUGIN_FACTORY_WITH_JSON (KateSnippetsPluginFactory, "katesnippetsplugin.json", registerPlugin<KateSnippetsPlugin>();)
+K_PLUGIN_FACTORY_WITH_JSON(KateSnippetsPluginFactory, "katesnippetsplugin.json", registerPlugin<KateSnippetsPlugin>();)
-KateSnippetsPlugin::KateSnippetsPlugin( QObject* parent, const QList<QVariant>& ):
- KTextEditor::Plugin ( parent )
- , m_snippetGlobal (new KateSnippetGlobal (this))
+KateSnippetsPlugin::KateSnippetsPlugin(QObject *parent, const QList<QVariant> &)
+ : KTextEditor::Plugin(parent)
+ , m_snippetGlobal(new KateSnippetGlobal(this))
{
}
@@ -45,106 +47,102 @@
{
}
-QObject *KateSnippetsPlugin::createView (KTextEditor::MainWindow *mainWindow)
+QObject *KateSnippetsPlugin::createView(KTextEditor::MainWindow *mainWindow)
{
- KateSnippetsPluginView *view = new KateSnippetsPluginView (this, mainWindow);
- return view;
+ KateSnippetsPluginView *view = new KateSnippetsPluginView(this, mainWindow);
+ return view;
}
-KateSnippetsPluginView::KateSnippetsPluginView (KateSnippetsPlugin* plugin, KTextEditor::MainWindow *mainWindow)
- : QObject (mainWindow), m_plugin(plugin), m_mainWindow(mainWindow), m_toolView (0), m_snippets(0)
+KateSnippetsPluginView::KateSnippetsPluginView(KateSnippetsPlugin *plugin, KTextEditor::MainWindow *mainWindow)
+ : QObject(mainWindow), m_plugin(plugin), m_mainWindow(mainWindow), m_toolView(0), m_snippets(0)
{
- KXMLGUIClient::setComponentName (QLatin1String("katesnippets"), i18n ("Snippets tool view"));
- setXMLFile(QLatin1String("ui.rc"));
-
- // Toolview for snippets
- m_toolView = mainWindow->createToolView (0, QLatin1String("kate_private_plugin_katesnippetsplugin"), KTextEditor::MainWindow::Right, SmallIcon(QLatin1String("document-new")), i18n("Snippets"));
-
- // add snippets widget
- m_snippets = KateSnippetGlobal::self()->snippetWidget();
- m_snippets->setParent (m_toolView);
-
- // snippets toolbar
- KToolBar *topToolbar = new KToolBar (m_toolView, "snippetsToolBar");
- topToolbar->setToolButtonStyle (Qt::ToolButtonIconOnly);
- topToolbar->addActions (m_snippets->actions());
-
- // register this view
- m_plugin->mViews.append ( this );
-
- // create actions
- QAction *a = actionCollection()->addAction( QLatin1String("tools_create_snippet") );
- a->setIcon (QIcon::fromTheme(QLatin1String("document-new")));
- a->setText( i18n("Create Snippet") );
- connect(a, SIGNAL(triggered(bool)), SLOT(createSnippet()));
-
- a = actionCollection()->addAction( QLatin1String("tools_snippets") );
- a->setText( i18n("Snippets...") );
- connect(a, SIGNAL(triggered(bool)), SLOT(showSnippetsDialog()));
-
- /**
- * connect for all already existing views
- */
- foreach (KTextEditor::View *view, mainWindow->views())
- slotViewCreated (view);
-
- m_mainWindow->guiFactory()->addClient (this);
-}
-
-KateSnippetsPluginView::~KateSnippetsPluginView ()
-{
- // cleanup for all views
- foreach (QObject *view, m_textViews)
- if (auto iface = qobject_cast<KTextEditor::CodeCompletionInterface *> (view))
- iface->unregisterCompletionModel (KateSnippetGlobal::self()->completionModel());
-
- m_mainWindow->guiFactory()->removeClient (this);
-
- // unregister this view
- m_plugin->mViews.removeAll (this);
-
- // cleanup, kill toolview
- delete m_snippets;
- delete m_toolView;
-}
-
-void KateSnippetsPluginView::slotViewCreated (KTextEditor::View *view)
-{
- /**
- * connect to destroyed
- */
- connect (view, SIGNAL(destroyed (QObject *)), this, SLOT(slotViewDestroyed (QObject *)));
-
- /**
- * remember for this view we need to cleanup!
- */
- m_textViews.insert (view);
-
- // add snippet completion
- if (auto iface = qobject_cast<KTextEditor::CodeCompletionInterface *> (view)) {
- iface->unregisterCompletionModel (KateSnippetGlobal::self()->completionModel());
- iface->registerCompletionModel (KateSnippetGlobal::self()->completionModel());
- }
-}
-
-void KateSnippetsPluginView::slotViewDestroyed (QObject *view)
-{
- /**
- * remove remembered views for which we need to cleanup on exit!
- */
- m_textViews.remove (view);
+ KXMLGUIClient::setComponentName(QLatin1String("katesnippets"), i18n("Snippets tool view"));
+ setXMLFile(QLatin1String("ui.rc"));
+
+ // Toolview for snippets
+ m_toolView.reset(mainWindow->createToolView(0, QLatin1String("kate_private_plugin_katesnippetsplugin"),
+ KTextEditor::MainWindow::Right,
+ SmallIcon(QLatin1String("document-new")),
+ i18n("Snippets")));
+
+ m_toolView->setLayout(new QHBoxLayout());
+ // add snippets widget
+ m_snippets.reset(KateSnippetGlobal::self()->snippetWidget());
+ m_snippets->setParent(m_toolView.data());
+ m_snippets->setupActionsForWindow(m_toolView.data());
+
+ // snippets toolbar
+ KToolBar *topToolbar = new KToolBar(m_toolView.data(), "snippetsToolBar");
+ topToolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ topToolbar->addActions(m_snippets->actions());
+ static_cast<QBoxLayout *>(m_toolView->layout())->insertWidget(0, topToolbar);
+
+ // register this view
+ m_plugin->mViews.append(this);
+
+ // create actions
+ QAction *a = actionCollection()->addAction(QLatin1String("tools_create_snippet"));
+ a->setIcon(QIcon::fromTheme(QLatin1String("document-new")));
+ a->setText(i18n("Create Snippet"));
+ connect(a, SIGNAL(triggered(bool)), SLOT(createSnippet()));
+
+ a = actionCollection()->addAction(QLatin1String("tools_snippets"));
+ a->setText(i18n("Snippets..."));
+ connect(a, SIGNAL(triggered(bool)), SLOT(showSnippetsDialog()));
+
+ connect(mainWindow, &KTextEditor::MainWindow::viewCreated,
+ this, &KateSnippetsPluginView::slotViewCreated);
+
+ /**
+ * connect for all already existing views
+ */
+ foreach (KTextEditor::View *view, mainWindow->views()) {
+ slotViewCreated(view);
+ }
+
+ auto factory = m_mainWindow->guiFactory();
+ if ( factory ) {
+ factory->addClient(this);
+ }
+}
+
+KateSnippetsPluginView::~KateSnippetsPluginView()
+{
+ // cleanup for all views
+ Q_FOREACH (auto view, m_textViews) {
+ if (! view) {
+ continue;
+ }
+ auto iface = qobject_cast<KTextEditor::CodeCompletionInterface *>(view);
+ iface->unregisterCompletionModel(KateSnippetGlobal::self()->completionModel());
+ }
+
+ m_mainWindow->guiFactory()->removeClient(this);
+
+ // unregister this view
+ m_plugin->mViews.removeAll(this);
+}
+
+void KateSnippetsPluginView::slotViewCreated(KTextEditor::View *view)
+{
+ m_textViews.append(QPointer<KTextEditor::View>(view));
+
+ // add snippet completion
+ auto model = KateSnippetGlobal::self()->completionModel();
+ auto iface = qobject_cast<KTextEditor::CodeCompletionInterface *>(view);
+ iface->unregisterCompletionModel(model);
+ iface->registerCompletionModel(model);
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/katesnippets.h
^
|
@@ -28,70 +28,64 @@
#include "katesnippetglobal.h"
+class SnippetView;
class KateSnippetsPluginView;
class KateSnippetsPlugin: public KTextEditor::Plugin
{
Q_OBJECT
-
- friend class KateSnippetsPluginView;
-
- public:
- explicit KateSnippetsPlugin( QObject* parent = 0, const QList<QVariant>& = QList<QVariant>() );
+
+ friend class KateSnippetsPluginView;
+
+public:
+ explicit KateSnippetsPlugin(QObject *parent = 0, const QList<QVariant> & = QList<QVariant>());
virtual ~KateSnippetsPlugin();
- QObject *createView (KTextEditor::MainWindow *mainWindow);
-
- private:
+ QObject *createView(KTextEditor::MainWindow *mainWindow);
+
+private:
KateSnippetGlobal *m_snippetGlobal;
- QList<KateSnippetsPluginView*> mViews;
+ QList<KateSnippetsPluginView *> mViews;
};
class KateSnippetsPluginView : public QObject, public KXMLGUIClient
{
Q_OBJECT
- public:
+public:
/**
* Constructor.
*/
- KateSnippetsPluginView (KateSnippetsPlugin* plugin, KTextEditor::MainWindow *mainWindow);
+ KateSnippetsPluginView(KateSnippetsPlugin *plugin, KTextEditor::MainWindow *mainWindow);
/**
* Virtual destructor.
*/
- ~KateSnippetsPluginView ();
+ ~KateSnippetsPluginView();
void readConfig();
-
- private Q_SLOTS:
+
+private Q_SLOTS:
/**
* New view got created, we need to update our connections
* @param view new created view
*/
- void slotViewCreated (KTextEditor::View *view);
+ void slotViewCreated(KTextEditor::View *view);
- /**
- * View got destroyed.
- * @param view deleted view
- */
- void slotViewDestroyed (QObject *view);
-
- void createSnippet ();
- void showSnippetsDialog ();
+ void createSnippet();
+ void showSnippetsDialog();
- private:
+private:
KateSnippetsPlugin *m_plugin;
KTextEditor::MainWindow *m_mainWindow;
- QWidget *m_toolView;
- QWidget *m_snippets;
+ QScopedPointer<QWidget> m_toolView;
+ QScopedPointer<SnippetView> m_snippets;
/**
* remember for which text views we might need to cleanup stuff
*/
- QSet<QObject *> m_textViews;
+ QVector< QPointer<KTextEditor::View> > m_textViews;
};
#endif
-// kate: space-indent on; indent-width 2; replace-tabs on;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/katesnippetsplugin.desktop
^
|
@@ -86,6 +86,7 @@
Comment[tg]=Абзори идоракунии порчаҳои дарунсохт
Comment[tr]=Gömülü bir uçbirim parçacığı yönetimi
Comment[uk]=Вбудована панель для керування фрагментами
+Comment[vi]=Toolview nhúng đoạn quản lý
Comment[x-test]=xxToolview embedding the snippets managementxx
Comment[zh_CN]=管理代码片段的嵌入工具视图
Comment[zh_TW]=嵌入片段管理的工具檢視
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/ktexteditor_codesnippets_core.knsrc
^
|
@@ -12,7 +12,7 @@
# # Note: if all three are missing, entry is considered remote resource
# StandardResource=wallpapers # becomes $KDEHOME/share/wallpapers
# becomes $KDEHOME/share/apps/appname/datadir
-TargetDir=/ktexteditor_snippets/ghns
+TargetDir=/kate/ktexteditor_snippets/ghns
# InstallPath=.dir/subdir # becomes $HOME/.dir/subdir
# # How to name the files?
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/snippet.cpp
^
|
@@ -23,6 +23,9 @@
#include "snippet.h"
#include "katesnippetglobal.h"
+#include "ktexteditor/editor.h"
+#include "ktexteditor/application.h"
+#include "ktexteditor/mainwindow.h"
#include <KLocalizedString>
#include <KColorScheme>
@@ -51,34 +54,12 @@
m_snippet = snippet;
}
-QString Snippet::prefix() const
+void Snippet::registerActionForView(QWidget* view)
{
- return m_prefix;
-}
-
-void Snippet::setPrefix(const QString& prefix)
-{
- m_prefix = prefix;
-}
-
-QString Snippet::postfix() const
-{
- return m_postfix;
-}
-
-void Snippet::setPostfix(const QString& postfix)
-{
- m_postfix = postfix;
-}
-
-QString Snippet::arguments() const
-{
- return m_arguments;
-}
-
-void Snippet::setArguments(const QString& arguments)
-{
- m_arguments = arguments;
+ if ( view->actions().contains(m_action) ) {
+ return;
+ }
+ view->addAction(m_action);
}
QAction* Snippet::action()
@@ -86,15 +67,11 @@
///TODO: this is quite ugly, or is it? if someone knows how to do it better, please refactor
if ( !m_action ) {
static int actionCount = 0;
+ actionCount += 1;
m_action = new QAction(QString::fromLatin1("insertSnippet%1").arg(actionCount), KateSnippetGlobal::self());
m_action->setData(QVariant::fromValue<Snippet*>(this));
- KateSnippetGlobal::self()->connect(m_action, SIGNAL(triggered()),
- KateSnippetGlobal::self(), SLOT(insertSnippetFromActionData()));
-
-#if 0 // FIXME
- // action needs to be added to a widget before it can work...
- KDevelop::ICore::self()->uiController()->activeMainWindow()->addAction(m_action);
-#endif
+ KateSnippetGlobal::self()->connect(m_action, &QAction::triggered,
+ KateSnippetGlobal::self(), &KateSnippetGlobal::insertSnippetFromActionData);
}
m_action->setText(i18n("insert snippet %1", text()));
return m_action;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/snippet.h
^
|
@@ -58,48 +58,17 @@
void setSnippet(const QString& snippet);
/**
- * Returns the display prefix of this snippet.
- */
- QString prefix() const;
- /**
- * Sets the display prefix of this snippet.
- */
- void setPrefix(const QString& prefix);
-
- /**
- * Returns the display postfix of this snippet.
- */
- QString postfix() const;
- /**
- * Sets the display postfix of this snippet.
- */
- void setPostfix(const QString& postfix);
-
- /**
- * Returns the display arguments of this snippet.
- */
- QString arguments() const;
- /**
- * Sets the display arguments of this snippet.
- */
- void setArguments(const QString& arguments);
-
- /**
* Action to trigger insertion of this snippet.
*/
QAction* action();
+ void registerActionForView(QWidget* view);
+
virtual QVariant data(int role = Qt::UserRole + 1) const;
private:
/// the actual snippet contents aka \code<fillin>\endcode
QString m_snippet;
- /// the display postfix aka \code<displaypostfix>\endcode
- QString m_postfix;
- /// the display prefix aka \code<displayprefix>\endcode
- QString m_prefix;
- /// the display arguments aka \code<displayarguments>\endcode
- QString m_arguments;
/// the insertion action for this snippet.
QAction* m_action;
};
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/snippetcompletionitem.cpp
^
|
@@ -27,8 +27,6 @@
#include <QTextEdit>
#include <QModelIndex>
-#include <ktexteditor/templateinterface.h>
-#include <ktexteditor/templateinterface2.h>
#include <ktexteditor/view.h>
#include <ktexteditor/codecompletioninterface.h>
#include <ktexteditor/codecompletionmodel.h>
@@ -38,18 +36,21 @@
SnippetCompletionItem::SnippetCompletionItem( Snippet* snippet, SnippetRepository* repo )
- : m_name(snippet->text()), m_snippet(snippet->snippet()), m_prefix(snippet->prefix()),
- m_arguments(snippet->arguments()), m_postfix(snippet->postfix()), m_repo(repo)
+ : m_name(snippet->text()), m_snippet(snippet->snippet()), m_repo(repo)
{
Q_ASSERT(m_repo);
- m_name.prepend( repo->completionNamespace() );
+ const auto& namespace_ = repo->completionNamespace();
+ if ( !namespace_.isEmpty() ) {
+ m_name.prepend( QLatin1String(":") );
+ m_name.prepend( repo->completionNamespace() );
+ }
}
SnippetCompletionItem::~SnippetCompletionItem()
{
}
-QVariant SnippetCompletionItem::data( const QModelIndex& index, int role, const KTextEditor::CodeCompletionModel2* model ) const
+QVariant SnippetCompletionItem::data( const QModelIndex& index, int role, const KTextEditor::CodeCompletionModel* model ) const
{
// as long as the snippet completion model is not a kdevelop code completion model,
// model will usually be 0. hence don't use it.
@@ -61,11 +62,11 @@
case KTextEditor::CodeCompletionModel::Name:
return m_name;
case KTextEditor::CodeCompletionModel::Prefix:
- return m_prefix;
+ return QString();
case KTextEditor::CodeCompletionModel::Postfix:
- return m_postfix;
+ return QString();
case KTextEditor::CodeCompletionModel::Arguments:
- return m_arguments;
+ return QString();
}
break;
case KTextEditor::CodeCompletionModel::IsExpandable:
@@ -89,15 +90,9 @@
return QVariant();
}
-void SnippetCompletionItem::execute( KTextEditor::View* view, const KTextEditor::Range& word )
+void SnippetCompletionItem::execute(KTextEditor::View* view, const KTextEditor::Range& word)
{
- QMap< QString, QString > values = QMap<QString, QString>();
- KTextEditor::TemplateInterface2* templateIface2 = qobject_cast<KTextEditor::TemplateInterface2*>(view);
- if (templateIface2)
- {
- // Replace matched text...
- view->document()->removeText(word);
- // ... with snippet content
- templateIface2->insertTemplateText(word.start(), m_snippet, values, m_repo->registeredScript());
- }
+ // insert snippet content
+ view->insertTemplate(view->cursorPosition(), m_snippet, m_repo->script());
+ view->document()->removeText(word);
}
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/snippetcompletionitem.h
^
|
@@ -35,7 +35,7 @@
namespace KTextEditor {
class View;
class Range;
- class CodeCompletionModel2;
+ class CodeCompletionModel;
}
class SnippetCompletionItem
@@ -44,16 +44,13 @@
SnippetCompletionItem(Snippet* snippet, SnippetRepository* repo);
~SnippetCompletionItem();
- void execute( KTextEditor::View* view, const KTextEditor::Range& word );
- QVariant data( const QModelIndex& index, int role, const KTextEditor::CodeCompletionModel2* model ) const;
+ void execute(KTextEditor::View* view, const KTextEditor::Range& word);
+ QVariant data( const QModelIndex& index, int role, const KTextEditor::CodeCompletionModel* model ) const;
private:
// we copy since the snippet itself can be deleted at any time
QString m_name;
QString m_snippet;
- QString m_prefix;
- QString m_arguments;
- QString m_postfix;
SnippetRepository* m_repo;
};
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/snippetrepository.cpp
^
|
@@ -37,6 +37,7 @@
#include <KLocalizedString>
#include <QApplication>
#include <QDebug>
+#include <QDir>
#include <KColorScheme>
@@ -44,11 +45,22 @@
#include "snippetstore.h"
+static const QString defaultScript = QStringLiteral(
+"function fileName() { return document.fileName(); }\n"
+"function fileUrl() { return document.url(); }\n"
+"function encoding() { return document.encoding(); }\n"
+"function selection() { return view.selectedText(); }\n"
+"function year() { return new Date().getFullYear(); }\n"
+"function upper(x) { return x.toUpperCase(); }\n"
+"function lower(x) { return x.toLowerCase(); }\n"
+);
+
SnippetRepository::SnippetRepository(const QString& file)
- : QStandardItem(i18n("<empty repository>")), m_file(file), m_registeredScript(0)
+ : QStandardItem(i18n("<empty repository>")), m_file(file), m_script(defaultScript)
{
setIcon( QIcon::fromTheme(QLatin1String("folder")) );
- bool activated = SnippetStore::self()->getConfig().readEntry<QStringList>("enabledRepositories", QStringList()).contains(file);
+ const auto& config = SnippetStore::self()->getConfig();
+ bool activated = config.readEntry<QStringList>("enabledRepositories", QStringList()).contains(file);
setCheckState(activated ? Qt::Checked : Qt::Unchecked);
if ( QFile::exists(file) ) {
@@ -65,15 +77,26 @@
removeRows( 0, rowCount() );
}
+QDir SnippetRepository::dataPath()
+{
+ auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
+ const auto& subdir = QLatin1String("ktexteditor_snippets/data/");
+ bool success = dir.mkpath(dir.absoluteFilePath(subdir));
+ Q_ASSERT(success);
+ dir.setPath(dir.path() + QLatin1String("/") + subdir);
+ return dir;
+}
+
SnippetRepository* SnippetRepository::createRepoFromName(const QString& name)
{
QString cleanName = name;
cleanName.replace(QLatin1Char('/'), QLatin1Char('-'));
- const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
- QLatin1String("ktexteditor_snippets/data/") + cleanName + QLatin1String(".xml"));
- SnippetRepository* repo = new SnippetRepository(path);
+ const auto& dir = dataPath();
+ const auto& path = dir.absoluteFilePath(cleanName + QLatin1String(".xml"));
+ qDebug() << "repo path:" << path << cleanName;
+ SnippetRepository* repo = new SnippetRepository(path);
repo->setText(name);
repo->setCheckState(Qt::Checked);
KUser user;
@@ -136,18 +159,9 @@
return m_script;
}
-KTextEditor::TemplateScript* SnippetRepository::registeredScript() const
-{
- return m_registeredScript;
-}
-
void SnippetRepository::setScript(const QString& script)
{
m_script = script;
- if ( m_registeredScript ) {
- SnippetStore::self()->unregisterScript(m_registeredScript);
- }
- m_registeredScript = SnippetStore::self()->registerScript(m_script);
}
void SnippetRepository::remove()
@@ -168,6 +182,7 @@
void SnippetRepository::save()
{
+ qDebug() << "*** called";
///based on the code from snippets_tng/lib/completionmodel.cpp
///@copyright 2009 Joseph Wenninger <jowenn@kde.org>
/*
@@ -207,25 +222,22 @@
continue;
}
QDomElement item = doc.createElement(QLatin1String("item"));
- addAndCreateElement(doc, item, QLatin1String("displayprefix"), snippet->prefix());
addAndCreateElement(doc, item, QLatin1String("match"), snippet->text());
- addAndCreateElement(doc, item, QLatin1String("displaypostfix"), snippet->postfix());
- addAndCreateElement(doc, item, QLatin1String("displayarguments"), snippet->arguments());
addAndCreateElement(doc, item, QLatin1String("fillin"), snippet->snippet());
root.appendChild(item);
}
//KMessageBox::information(0,doc.toString());
QFileInfo fi(m_file);
- QString outname = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
- QLatin1String("ktexteditor_snippets/data/") + fi.fileName());
- if ( m_file != outname) {
+ QDir dir = dataPath();
+ QString outname = dir.absoluteFilePath(fi.fileName());
+
+ if (m_file != outname) {
QFileInfo fiout(outname);
-// if (fiout.exists()) {
-// there could be cases that new new name clashes with a global file, but I guess it is not that often.
+ // there could be cases that new new name clashes with a global file, but I guess it is not that often.
int i = 0;
- while(QFile::exists(outname)) {
- outname = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
- QString::fromLatin1("ktexteditor_snippets/data/%1_").arg(i++) + fi.fileName());
+ while (QFile::exists(outname)) {
+ i++;
+ outname = dir.absoluteFilePath(QString::number(i) + fi.fileName());
}
KMessageBox::information(QApplication::activeWindow(),
i18n("You have edited a data file not located in your personal data directory; as such, a renamed clone of the original data file has been created within your personal data directory."));
@@ -325,12 +337,6 @@
snippet->setText(child.text());
} else if ( child.tagName() == QLatin1String("fillin") ) {
snippet->setSnippet(child.text());
- } else if ( child.tagName() == QLatin1String("displayprefix") ) {
- snippet->setPrefix(child.text());
- } else if ( child.tagName() == QLatin1String("displaypostfix") ) {
- snippet->setPostfix(child.text());
- } else if ( child.tagName() == QLatin1String("displayarguments") ) {
- snippet->setArguments(child.text());
}
}
// require at least a non-empty name and snippet
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/snippetrepository.h
^
|
@@ -27,6 +27,7 @@
#include <QObject>
#include <QStandardItem>
#include <QStringList>
+#include <QDir>
namespace KTextEditor
{
@@ -117,10 +118,7 @@
* @since KDE 4.5
*/
QString script() const;
- /**
- * The token identifying the script in this repository.
- */
- KTextEditor::TemplateScript* registeredScript() const;
+
/**
* Sets the QtScript(s) associated with this repository.
*
@@ -138,6 +136,11 @@
*/
void save();
+ /**
+ * Get directory for data storage from QStandardPaths
+ */
+ static QDir dataPath();
+
virtual QVariant data(int role = Qt::UserRole + 1) const;
virtual void setData(const QVariant& value, int role = Qt::UserRole + 1);
@@ -156,10 +159,8 @@
QStringList m_filetypes;
/// filtering namespace for code completion
QString m_namespace;
- /// QtScript with functions to be used in the snippet
+ /// QtScript with functions to be used in the snippets; common to all snippets
QString m_script;
- /// registered script
- KTextEditor::TemplateScript* m_registeredScript;
};
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/snippetstore.cpp
^
|
@@ -32,25 +32,21 @@
#include <KSharedConfig>
#include <ktexteditor/editor.h>
-#include <ktexteditor/templateinterface2.h>
Q_DECLARE_METATYPE(KSharedConfig::Ptr)
SnippetStore* SnippetStore::m_self = 0;
SnippetStore::SnippetStore(KateSnippetGlobal* plugin)
- : m_plugin(plugin), m_scriptregistrar(0)
+ : m_plugin(plugin)
{
m_self = this;
- //required for setting sessionConfig property
- qRegisterMetaType<KSharedConfig::Ptr>("KSharedConfig::Ptr");
-
- QStringList files;
const QStringList dirs =
- QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("ktexteditor_snippets/data"), QStandardPaths::LocateDirectory)
- << QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("ktexteditor_snippets/ghns"), QStandardPaths::LocateDirectory);
+ QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("ktexteditor_snippets/data"), QStandardPaths::LocateDirectory)
+ << QStandardPaths::locateAll(QStandardPaths::DataLocation, QStringLiteral("ktexteditor_snippets/ghns"), QStandardPaths::LocateDirectory);
+ QStringList files;
foreach (const QString& dir, dirs) {
const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.xml"));
foreach (const QString& file, fileNames) {
@@ -62,8 +58,6 @@
SnippetRepository* repo = new SnippetRepository(file);
appendRow(repo);
}
-
- m_scriptregistrar = qobject_cast<KTextEditor::TemplateScriptRegistrar *> (KTextEditor::Editor::instance());
}
SnippetStore::~SnippetStore()
@@ -83,7 +77,7 @@
return m_self;
}
-Qt::ItemFlags SnippetStore::flags(const QModelIndex & index) const
+Qt::ItemFlags SnippetStore::flags(const QModelIndex& index) const
{
Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
if ( !index.parent().isValid() ) {
@@ -94,10 +88,7 @@
KConfigGroup SnippetStore::getConfig()
{
- /**
- * use KTextEditor::Editor session config object
- */
- return KTextEditor::Editor::instance()->property("sessionConfig").value<KSharedConfig::Ptr>()->group("Snippets");
+ return KSharedConfig::openConfig()->group("Snippets");
}
bool SnippetStore::setData(const QModelIndex& index, const QVariant& value, int role)
@@ -138,21 +129,6 @@
}
return 0;
}
-
-void SnippetStore::unregisterScript(KTextEditor::TemplateScript* script)
-{
- if ( m_scriptregistrar ) {
- m_scriptregistrar->unregisterTemplateScript(script);
- }
-}
-
-KTextEditor::TemplateScript* SnippetStore::registerScript(const QString& script)
-{
- if ( m_scriptregistrar ) {
- return m_scriptregistrar->registerTemplateScript(this, script);
- }
- return 0;
-}
#include "snippetstore.moc"
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/snippetstore.h
^
|
@@ -62,23 +62,6 @@
* Returns the repository for the given @p file if there is any.
*/
SnippetRepository* repositoryForFile(const QString &file);
-
- /**
- * Register @p script to make it available in snippets.
- *
- * @return token identifying the script
- *
- * @since KDE 4.5
- */
- KTextEditor::TemplateScript* registerScript(const QString& script);
-
- /**
- * Unregister script identified by @p token.
- *
- * @since KDE 4.5
- */
- void unregisterScript(KTextEditor::TemplateScript* token);
-
private:
SnippetStore(KateSnippetGlobal* plugin);
@@ -86,7 +69,6 @@
static SnippetStore* m_self;
KateSnippetGlobal* m_plugin;
- KTextEditor::TemplateScriptRegistrar* m_scriptregistrar;
};
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/snippetview.cpp
^
|
@@ -29,42 +29,79 @@
#include "snippetstore.h"
#include "editrepository.h"
#include "editsnippet.h"
-#include "snippetfilterproxymodel.h"
#include <KLocalizedString>
#include <KMessageBox>
#include <QContextMenuEvent>
+#include <QSortFilterProxyModel>
+#include <QTimer>
#include <QMenu>
#include <kns3/downloaddialog.h>
#include <kns3/uploaddialog.h>
+
+class SnippetFilterModel : public QSortFilterProxyModel {
+public:
+ SnippetFilterModel(QObject* parent = 0) : QSortFilterProxyModel(parent) { };
+ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
+ auto index = sourceModel()->index(sourceRow, 0, sourceParent);
+ auto item = SnippetStore::self()->itemFromIndex(index);
+ if ( ! item ) {
+ return false;
+ }
+ auto snippet = dynamic_cast<Snippet*>(item);
+ if ( ! snippet ) {
+ return true;
+ }
+ return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
+ }
+};
+
+void SnippetView::setupActionsForWindow(QWidget* widget)
+{
+ const auto& model = SnippetStore::self();
+ for ( int i = 0; i < model->rowCount(); i++ ) {
+ auto index = model->index(i, 0, QModelIndex());
+ auto item = model->itemFromIndex(index);
+ auto repo = dynamic_cast<SnippetRepository*>(item);
+ if ( ! repo ) {
+ continue;
+ }
+ for ( int j = 0; j < model->rowCount(index); j++ ) {
+ auto item = model->itemFromIndex(model->index(j, 0, index));
+ auto snippet = dynamic_cast<Snippet*>(item);
+ qDebug() << "snippet at" << j << snippet;
+ if ( ! snippet ) {
+ continue;
+ }
+ snippet->registerActionForView(widget);
+ }
+ }
+}
+
SnippetView::SnippetView(KateSnippetGlobal* plugin, QWidget* parent)
: QWidget(parent), Ui::SnippetViewBase(), m_plugin(plugin)
{
Ui::SnippetViewBase::setupUi(this);
setWindowTitle(i18n("Snippets"));
- setWindowIcon (QIcon::fromTheme(QLatin1String("document-new")));
-
- connect(filterText, SIGNAL(clearButtonClicked()),
- this, SLOT(slotFilterChanged()));
- connect(filterText, SIGNAL(textChanged(QString)),
- this, SLOT(slotFilterChanged()));
+ setWindowIcon(QIcon::fromTheme(QLatin1String("document-new")));
snippetTree->setContextMenuPolicy( Qt::CustomContextMenu );
snippetTree->viewport()->installEventFilter( this );
connect(snippetTree, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(contextMenu(QPoint)));
- m_proxy = new SnippetFilterProxyModel(this);
-
- m_proxy->setSourceModel( SnippetStore::self() );
+ m_proxy = new SnippetFilterModel(this);
+ m_proxy->setFilterKeyColumn(0);
+ m_proxy->setSourceModel(SnippetStore::self());
- snippetTree->setModel( m_proxy );
-// snippetTree->setModel( SnippetStore::instance() );
+ connect(filterText, &KLineEdit::textChanged,
+ m_proxy, &QSortFilterProxyModel::setFilterFixedString);
+ snippetTree->setModel(m_proxy);
snippetTree->header()->hide();
m_addRepoAction = new QAction(QIcon::fromTheme(QLatin1String("folder-new")), i18n("Add Repository"), this);
@@ -103,15 +140,13 @@
connect(snippetTree->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(validateActions()));
validateActions();
-}
-SnippetView::~SnippetView()
-{
+ connect(snippetTree->model(), &QAbstractItemModel::rowsInserted,
+ this, [this]() { setupActionsForWindow(this); });
}
void SnippetView::validateActions()
{
-
QStandardItem* item = currentItem();
Snippet* selectedSnippet = dynamic_cast<Snippet*>( item );
@@ -175,12 +210,12 @@
QMenu menu(this);
menu.addSection(i18n("Repository: %1", repo->text()));
+ menu.addAction(m_addSnippetAction);
+ menu.addSeparator();
+
menu.addAction(m_editRepoAction);
menu.addAction(m_removeRepoAction);
menu.addAction(m_putNewStuffAction);
- menu.addSeparator();
-
- menu.addAction(m_addSnippetAction);
menu.exec(snippetTree->mapToGlobal(pos));
}
@@ -280,11 +315,6 @@
}
}
-void SnippetView::slotFilterChanged()
-{
- m_proxy->changeFilter( filterText->text() );
-}
-
void SnippetView::slotGHNS()
{
KNS3::DownloadDialog dialog(QLatin1String("ktexteditor_codesnippets_core.knsrc"), this);
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/snippets/snippetview.h
^
|
@@ -4,6 +4,7 @@
* Copyright (C) 2007 Robert Gruber <rgruber@users.sourceforge.net>
* Copyright (C) 2010 Milian Wolff <mail@milianw.de>
* Copyright (C) 2012 Christoph Cullmann <cullmann@kde.org>
+ * Copyright (C) 2014 Sven Brauch <svenbrauch@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -26,10 +27,14 @@
#include "ui_snippetview.h"
-class SnippetFilterProxyModel;
class QStandardItem;
class KateSnippetGlobal;
class QAction;
+class QSortFilterProxyModel;
+
+namespace KTextEditor {
+ class MainWindow;
+}
/**
* This class gets embedded into the right tool view by the KateSnippetGlobal.
@@ -42,7 +47,9 @@
public:
explicit SnippetView(KateSnippetGlobal* plugin, QWidget* parent = 0);
- virtual ~SnippetView();
+
+public:
+ void setupActionsForWindow(QWidget* widget);
private Q_SLOTS:
/**
@@ -90,11 +97,6 @@
*/
void slotSnippetToGHNS();
- /**
- * Changes the filter of the proxy.
- */
- void slotFilterChanged();
-
void contextMenu (const QPoint & pos);
/// disables or enables available actions based on the currently selected item
void validateActions();
@@ -105,7 +107,7 @@
QStandardItem* currentItem();
KateSnippetGlobal* m_plugin;
- SnippetFilterProxyModel* m_proxy;
+ QSortFilterProxyModel* m_proxy;
QAction *m_addRepoAction;
QAction *m_removeRepoAction;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/symbolviewer/CMakeLists.txt
^
|
@@ -6,8 +6,7 @@
target_link_libraries(katesymbolviewerplugin ${KDE4_KDEUI_LIBS} kateinterfaces ktexteditor )
-install(TARGETS katesymbolviewerplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katesymbolviewerplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
########### install files ###############
install( FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kate/plugins/katesymbolviewer )
-install( FILES katesymbolviewer.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/symbolviewer/katesymbolviewer.desktop
^
|
@@ -54,6 +54,7 @@
Name[tr]=Sembol Gösterici
Name[ug]=بەلگە كۆرگۈچ
Name[uk]=Переглядач символів
+Name[vi]=Trình xem biểu tượng
Name[x-test]=xxSymbol Viewerxx
Name[zh_CN]=符号查看器
Name[zh_TW]=符號檢視器
@@ -107,6 +108,7 @@
Comment[tr]=Referans sembollerini kaynaktan çıkar ve göster
Comment[ug]=ئەسلى كودتىن مۇناسىپ بەلگىسىنى ئاجرىتىپ كۆرسىتىدۇ
Comment[uk]=Добування і показ символів з джерельного коду
+Comment[vi]=Trích xuất và hiển thị biểu tượng tham chiếu từ mã nguồn
Comment[x-test]=xxExtract and show reference symbols from sourcexx
Comment[zh_CN]=从源代码中提取并显示相关的符号
Comment[zh_TW]=展開並顯示程式源碼中的參考符號
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/tabswitcher/CMakeLists.txt
^
|
@@ -0,0 +1,25 @@
+project(tabswitcherplugin)
+
+include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
+
+set(tabswitcherplugin_PART_SRCS
+ tabswitcher.cpp
+ tabswitchertreeview.cpp
+)
+
+add_library (tabswitcherplugin MODULE ${tabswitcherplugin_PART_SRCS})
+
+target_link_libraries(tabswitcherplugin
+ KF5::TextEditor
+ KF5::IconThemes
+ KF5::I18n
+ KF5::Service
+)
+
+install(TARGETS tabswitcherplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor)
+
+########### install files ###############
+
+install(FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/tabswitcher)
+
+kcoreaddons_desktop_to_json (tabswitcherplugin tabswitcherplugin.desktop)
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/tabswitcher/Messages.sh
^
|
@@ -0,0 +1,3 @@
+#! /bin/sh
+$EXTRACTRC *.rc >> rc.cpp
+$XGETTEXT *.cpp -o $podir/tabswitcherplugin.pot
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/tabswitcher/tabswitcher.cpp
^
|
@@ -0,0 +1,271 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "tabswitcher.h"
+#include "tabswitchertreeview.h"
+
+#include <KTextEditor/Application>
+#include <KTextEditor/Document>
+#include <KTextEditor/Editor>
+#include <KTextEditor/View>
+
+#include <KActionCollection>
+#include <KIconLoader>
+#include <KLocalizedString>
+#include <KPluginFactory>
+#include <KXMLGUIFactory>
+
+#include <QAction>
+#include <QMimeDatabase>
+#include <QScrollBar>
+#include <QStandardItemModel>
+
+K_PLUGIN_FACTORY_WITH_JSON(TabSwitcherPluginFactory, "tabswitcherplugin.json", registerPlugin<TabSwitcherPlugin>();)
+
+TabSwitcherPlugin::TabSwitcherPlugin(QObject *parent, const QList<QVariant> &):
+ KTextEditor::Plugin(parent)
+{
+}
+
+TabSwitcherPlugin::~TabSwitcherPlugin()
+{
+}
+
+QObject *TabSwitcherPlugin::createView(KTextEditor::MainWindow *mainWindow)
+{
+ return new TabSwitcherPluginView(this, mainWindow);
+}
+
+TabSwitcherPluginView::TabSwitcherPluginView(TabSwitcherPlugin *plugin, KTextEditor::MainWindow *mainWindow)
+ : QObject(mainWindow)
+ , m_plugin(plugin)
+ , m_mainWindow(mainWindow)
+{
+ // register this view
+ m_plugin->m_views.append(this);
+
+ m_model = new QStandardItemModel(this);
+ m_treeView = new TabSwitcherTreeView();
+ m_treeView->setModel(m_model);
+
+ KXMLGUIClient::setComponentName(QStringLiteral("tabswitcher"), i18n("Document Switcher"));
+ setXMLFile(QStringLiteral("ui.rc"));
+
+ // note: call after m_treeView is created
+ setupActions();
+
+ // fill the model
+ setupModel();
+
+ // register action in menu
+ m_mainWindow->guiFactory()->addClient(this);
+
+ // popup connections
+ connect(m_treeView, SIGNAL(pressed(QModelIndex)), SLOT(switchToClicked(QModelIndex)));
+ connect(m_treeView, SIGNAL(itemActivated(QModelIndex)), SLOT(activateView(QModelIndex)));
+
+ // track existing documents
+ connect(KTextEditor::Editor::instance()->application(), SIGNAL(documentCreated(KTextEditor::Document*)),
+ this, SLOT(registerDocument(KTextEditor::Document*)));
+ connect(KTextEditor::Editor::instance()->application(), SIGNAL(documentWillBeDeleted(KTextEditor::Document*)),
+ this, SLOT(unregisterDocument(KTextEditor::Document*)));
+
+ // track lru activation of views to raise the respective documents in the model
+ connect(m_mainWindow, SIGNAL(viewChanged(KTextEditor::View*)),
+ this, SLOT(raiseView(KTextEditor::View*)));
+}
+
+TabSwitcherPluginView::~TabSwitcherPluginView()
+{
+ // delete popup widget
+ delete m_treeView;
+
+ // unregister action in menu
+ m_mainWindow->guiFactory()->removeClient(this);
+
+ // unregister this view
+ m_plugin->m_views.removeAll(this);
+}
+
+void TabSwitcherPluginView::setupActions()
+{
+ auto aNext = actionCollection()->addAction(QStringLiteral("view_lru_document_next"));
+ aNext->setText(i18n("Last Used Views"));
+ aNext->setIcon(QIcon::fromTheme(QStringLiteral("go-next-view-page")));
+ actionCollection()->setDefaultShortcut(aNext, Qt::CTRL | Qt::Key_Tab);
+ aNext->setWhatsThis(i18n("Opens a list to walk through the list of last used views."));
+ aNext->setStatusTip(i18n("Walk through the list of last used views"));
+ connect(aNext, SIGNAL(triggered()), SLOT(walkForward()));
+
+ auto aPrev = actionCollection()->addAction(QStringLiteral("view_lru_document_prev"));
+ aPrev->setText(i18n("Last Used Views (Reverse)"));
+ aPrev->setIcon(QIcon::fromTheme(QStringLiteral("go-previous-view-page")));
+ actionCollection()->setDefaultShortcut(aPrev, Qt::CTRL | Qt::SHIFT | Qt::Key_Tab);
+ aPrev->setWhatsThis(i18n("Opens a list to walk through the list of last used views in reverse."));
+ aPrev->setStatusTip(i18n("Walk through the list of last used views"));
+ connect(aPrev, SIGNAL(triggered()), SLOT(walkBackward()));
+
+ // make sure action work when the popup has focus
+ m_treeView->addAction(aNext);
+ m_treeView->addAction(aPrev);
+}
+
+static QIcon iconForDocument(KTextEditor::Document * doc)
+{
+ const QString iconName = QMimeDatabase().mimeTypeForUrl(doc->url()).iconName();
+ return QIcon(KIconLoader::global()->loadMimeTypeIcon(iconName, KIconLoader::Small));
+}
+
+void TabSwitcherPluginView::setupModel()
+{
+ // initial fill of model
+ foreach (auto doc, KTextEditor::Editor::instance()->application()->documents()) {
+ registerDocument(doc);
+ }
+}
+
+void TabSwitcherPluginView::registerDocument(KTextEditor::Document * document)
+{
+ auto item = new QStandardItem(iconForDocument(document), document->documentName());
+ item->setData(QVariant::fromValue(document));
+ m_model->insertRow(0, item);
+
+ // track document name changes
+ connect(document, SIGNAL(documentNameChanged(KTextEditor::Document*)),
+ this, SLOT(updateDocumentName(KTextEditor::Document*)));
+}
+
+void TabSwitcherPluginView::unregisterDocument(KTextEditor::Document * document)
+{
+ const auto rowCount = m_model->rowCount();
+ for (int i = 0; i < rowCount; ++i) {
+ auto doc = m_model->item(i)->data().value<KTextEditor::Document*>();
+ if (doc == document) {
+ m_model->removeRow(i);
+
+ // disconnect documentNameChanged() signal
+ disconnect(document, 0, this, 0);
+
+ break;
+ }
+ }
+}
+
+void TabSwitcherPluginView::updateDocumentName(KTextEditor::Document * document)
+{
+ const auto rowCount = m_model->rowCount();
+ for (int i = 0; i < rowCount; ++i) {
+ auto doc = m_model->item(i)->data().value<KTextEditor::Document*>();
+ if (doc == document) {
+ m_model->item(i)->setText(document->documentName());
+ break;
+ }
+ }
+}
+
+void TabSwitcherPluginView::raiseView(KTextEditor::View * view)
+{
+ unregisterDocument(view->document());
+ registerDocument(view->document());
+}
+
+void TabSwitcherPluginView::walk(const int from, const int to)
+{
+ QModelIndex index;
+ const int step = from < to ? 1 : -1;
+ if (! m_treeView->isVisible()) {
+ updateViewGeometry();
+ index = m_model->index(from + step, 0);
+ if(! index.isValid()) {
+ index = m_model->index(0, 0);
+ }
+ m_treeView->show();
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/tabswitcher/tabswitcher.h
^
|
@@ -0,0 +1,147 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KTEXTEDITOR_TAB_SWITCHER_PLUGIN_H
+#define KTEXTEDITOR_TAB_SWITCHER_PLUGIN_H
+
+#include <KTextEditor/Plugin>
+#include <KTextEditor/MainWindow>
+
+#include <QList>
+#include <QVariant>
+
+#include <KXMLGUIClient>
+
+class TabSwitcherPluginView;
+class TabSwitcherTreeView;
+class QStandardItemModel;
+class QModelIndex;
+
+class TabSwitcherPlugin : public KTextEditor::Plugin
+{
+ Q_OBJECT
+
+ friend TabSwitcherPluginView;
+
+public:
+ /**
+ * Plugin constructor.
+ */
+ explicit TabSwitcherPlugin(QObject *parent = 0, const QList<QVariant> & = QList<QVariant>());
+
+ /**
+ * Plugin destructor.
+ */
+ virtual ~TabSwitcherPlugin();
+
+ /**
+ * Create a new tab switcher for @p mainWindow.
+ */
+ QObject *createView(KTextEditor::MainWindow *mainWindow) Q_DECL_OVERRIDE;
+
+private:
+ QList<TabSwitcherPluginView *> m_views;
+};
+
+class TabSwitcherPluginView : public QObject, public KXMLGUIClient
+{
+ Q_OBJECT
+
+public:
+ /**
+ * View constructor.
+ */
+ TabSwitcherPluginView(TabSwitcherPlugin *plugin, KTextEditor::MainWindow *mainWindow);
+
+ /**
+ * View destructor.
+ */
+ virtual ~TabSwitcherPluginView();
+
+ /**
+ * Setup the shortcut actions.
+ */
+ void setupActions();
+
+ /**
+ * Initial fill of model with documents from the application.
+ */
+ void setupModel();
+
+public Q_SLOTS:
+ /**
+ * Adds @p document to the model.
+ */
+ void registerDocument(KTextEditor::Document * document);
+
+ /**
+ * Removes @p document from the model.
+ */
+ void unregisterDocument(KTextEditor::Document * document);
+
+ /**
+ * Update the name in the model for @p document.
+ */
+ void updateDocumentName(KTextEditor::Document * document);
+
+ /**
+ * Raise @p view in a lru fasion.
+ */
+ void raiseView(KTextEditor::View * view);
+
+ /**
+ * Focus next item in the treeview.
+ */
+ void walkForward();
+
+ /**
+ * Focus previous item in the treeview.
+ */
+ void walkBackward();
+
+ /**
+ * Activate the document for @p index.
+ */
+ void switchToClicked(const QModelIndex& index);
+
+ /**
+ * Show the document for @p index.
+ */
+ void activateView(const QModelIndex& index);
+
+protected:
+ /**
+ * Move through the list.
+ */
+ void walk(const int from, const int to);
+
+ /**
+ * Make sure the popup view has a sane size.
+ */
+ void updateViewGeometry();
+
+private:
+ TabSwitcherPlugin *m_plugin;
+ KTextEditor::MainWindow *m_mainWindow;
+ QStandardItemModel * m_model;
+ TabSwitcherTreeView * m_treeView;
+};
+
+#endif // KTEXTEDITOR_TAB_SWITCHER_PLUGIN_H
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/tabswitcher/tabswitcherplugin.desktop
^
|
@@ -0,0 +1,30 @@
+[Desktop Entry]
+Type=Service
+ServiceTypes=KTextEditor/Plugin
+X-KDE-Library=tabswitcherplugin
+Name=Document switcher
+Name[ca]=Commutador de documents
+Name[cs]=Přepínač dokumentů
+Name[en_GB]=Document switcher
+Name[hu]=Dokumentumváltó
+Name[nl]=Documentwisselaar
+Name[pl]=Przełącznik dokumentów
+Name[pt]=Selector de documentos
+Name[sk]=Prepínač dokumentov
+Name[sv]=Dokumentbyte
+Name[uk]=Перемикач між документами
+Name[x-test]=xxDocument switcherxx
+Name[zh_TW]=文件切換器
+Comment=Quick document switching with ALT+Tab behavior
+Comment[ca]=Canvia ràpidament de document amb el comportament de ALT+Tab
+Comment[cs]=Rychlé přepínání dokumentů s chováním jako ALT+Tab
+Comment[en_GB]=Quick document switching with ALT+Tab behaviour
+Comment[hu]=Gyors dokumentumváltás az ALT+Tab működésével
+Comment[nl]=Snel van document wisselen met ALT+Tab
+Comment[pl]=Szybkie przełączanie dokumentów przy użyciu klawiszy Alt+Tab
+Comment[pt]=Mudança rápida de documentos com o comportamento do Alt+Tab
+Comment[sk]=Rýchle prepínanie dokumentov so správaním Alt+Tab
+Comment[sv]=Snabbt dokumentbyte med Alt+Tabulator beteende
+Comment[uk]=Поведінка швидкого перемикача між документами за Alt+Tab
+Comment[x-test]=xxQuick document switching with ALT+Tab behaviorxx
+Comment[zh_TW]=用 Alt+Tab 快速切換文件的行為
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/tabswitcher/tabswitchertreeview.cpp
^
|
@@ -0,0 +1,46 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "tabswitchertreeview.h"
+#include "tabswitcher.h"
+
+#include <QKeyEvent>
+
+TabSwitcherTreeView::TabSwitcherTreeView()
+ : QListView()
+{
+ setWindowFlags(Qt::Popup | Qt::FramelessWindowHint);
+ setSelectionBehavior(QAbstractItemView::SelectRows);
+ setSelectionMode(QAbstractItemView::SingleSelection);
+ setUniformItemSizes(true);
+ setTextElideMode(Qt::ElideMiddle);
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+}
+
+void TabSwitcherTreeView::keyReleaseEvent(QKeyEvent * event)
+{
+ if (event->key() == Qt::Key_Control) {
+ emit itemActivated(selectionModel()->currentIndex());
+ event->accept();
+ hide();
+ } else {
+ QListView::keyReleaseEvent(event);
+ }
+}
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/tabswitcher/tabswitchertreeview.h
^
|
@@ -0,0 +1,52 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KTEXTEDITOR_TABSWITCHER_TREEVIEW_H
+#define KTEXTEDITOR_TABSWITCHER_TREEVIEW_H
+
+#include <QListView>
+
+class TabSwitcherTreeView : public QListView
+{
+ Q_OBJECT
+
+public:
+ /**
+ * Default constructor.
+ */
+ TabSwitcherTreeView();
+
+Q_SIGNALS:
+ /**
+ * This signal is emitted whenever use activates an item through
+ * the list view.
+ * @note @p selectionIndex is a model index of the selectionModel()
+ * and not of the QListView's model itself.
+ */
+ void itemActivated(const QModelIndex & selectionIndex);
+
+protected:
+ /**
+ * Reimplemented for tracking the CTRL key modifier.
+ */
+ void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
+};
+
+#endif // KTEXTEDITOR_TABSWITCHER_TREEVIEW_H
|
[-]
[+]
|
Added |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/tabswitcher/ui.rc
^
|
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE kpartgui>
+<gui name="tabswitcher" library="tabswitcherplugin" version="1">
+ <MenuBar>
+ <Menu name="view">
+ <text>&View</text>
+ <Action name="view_lru_document_next" group="view_switch_tab"/>
+ </Menu>
+ </MenuBar>
+</gui>
+<!-- kate: space-indent on; indent-width 4; replace-tabs on; -->
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/textfilter/CMakeLists.txt
^
|
@@ -8,8 +8,7 @@
target_link_libraries(katetextfilterplugin ${KDE4_KDEUI_LIBS} ktexteditor kateinterfaces )
-install(TARGETS katetextfilterplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katetextfilterplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
########### install files ###############
install( FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kate/plugins/katetextfilter )
-install( FILES katetextfilter.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/textfilter/katetextfilter.desktop
^
|
@@ -55,6 +55,7 @@
Name[tr]=Metin Filtresi
Name[ug]=تېكىست سۈزگۈچ
Name[uk]=Фільтр тексту
+Name[vi]=Bộ lọc văn bản
Name[x-test]=xxText Filterxx
Name[zh_CN]=文本过滤
Name[zh_TW]=文字過濾器
@@ -110,6 +111,7 @@
Comment[tr]=Kolay metin filtreleme
Comment[ug]=ئاددىي تېكىست سۈزگۈچ
Comment[uk]=Просте фільтрування тексту
+Comment[vi]=Lọc văn bản dễ dàng
Comment[wa]=Åjhey passaedje al passete di scrijhaedjes
Comment[x-test]=xxEasy text filteringxx
Comment[zh_CN]=简单的文本过滤器
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/textfilter/plugin_katetextfilter.cpp
^
|
@@ -52,7 +52,7 @@
{
KAction* a = actionCollection()->addAction("edit_filter");
a->setText(i18n("Filter Te&xt..."));
- a->setShortcut(Qt::CTRL + Qt::Key_Backslash);
+ actionCollection()->setDefaultShortcut(a, Qt::CTRL + Qt::Key_Backslash);
connect(a, SIGNAL(triggered(bool)), plugin, SLOT(slotEditFilter()));
mainwindow->guiFactory()->addClient(this);
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/xmlcheck/CMakeLists.txt
^
|
@@ -1,14 +1,17 @@
########### next target ###############
+add_definitions(-DTRANSLATION_DOMAIN=\"katexmlcheck\")
+
set(katexmlcheckplugin_PART_SRCS plugin_katexmlcheck.cpp )
+
+
kde4_add_plugin(katexmlcheckplugin ${katexmlcheckplugin_PART_SRCS})
target_link_libraries(katexmlcheckplugin ${KDE4_KDEUI_LIBS} ktexteditor kateinterfaces )
-install(TARGETS katexmlcheckplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katexmlcheckplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
########### install files ###############
install( FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/kate/plugins/katexmlcheck )
-install( FILES katexmlcheck.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/xmlcheck/katexmlcheck.desktop
^
|
@@ -55,6 +55,7 @@
Name[tr]=XML Doğrulama
Name[ug]=XML دەلىللەش
Name[uk]=Перевірка XML
+Name[vi]=Xác nhận XML
Name[wa]=Validåcion XML
Name[x-test]=xxXML Validationxx
Name[zh_CN]=XML 校验
@@ -110,6 +111,7 @@
Comment[tr]=XML dosyalarını xmllint kullanarak doğrular
Comment[ug]=xmllint پروگرامما ئىشلىتىپ XML ھۆججەت دەلىللەيدۇ
Comment[uk]=Перевіряє файли XML за допомогою xmllint
+Comment[vi]=Xác nhận các tập tin XML sử dụng xmllint
Comment[x-test]=xxValidates XML files using xmllintxx
Comment[zh_CN]=使用 xmllint 程序校验 XML 文件
Comment[zh_TW]=用 xmllint 來確認 XML 檔
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/xmltools/CMakeLists.txt
^
|
@@ -22,7 +22,7 @@
)
########### install files ###############
-install(TARGETS katexmltoolsplugin DESTINATION ${PLUGIN_INSTALL_DIR} )
+install(TARGETS katexmltoolsplugin DESTINATION ${PLUGIN_INSTALL_DIR}/ktexteditor )
install( FILES ui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/katexmltools )
install( FILES html4-loose.dtd.xml html4-strict.dtd.xml kde-docbook.dtd.xml simplify_dtd.xsl
@@ -30,5 +30,4 @@
testcases.xml language.dtd.xml kpartgui.dtd.xml kcfg.dtd.xml
DESTINATION ${DATA_INSTALL_DIR}/katexmltools )
-kservice_desktop_to_json (katexmltoolsplugin katexmltools.desktop)
-install( FILES katexmltools.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
+kcoreaddons_desktop_to_json (katexmltoolsplugin katexmltools.desktop)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/xmltools/katexmltools.desktop
^
|
@@ -54,6 +54,7 @@
Name[tr]=XML Tamamlama
Name[ug]=XML تاماملاش
Name[uk]=Завершення XML
+Name[vi]=Tự động hoàn tất XML
Name[wa]=Completaedje XML
Name[x-test]=xxXML Completionxx
Name[zh_CN]=XML 补全
@@ -109,6 +110,7 @@
Comment[tr]=XML ögelerini, özelliklerini, özellik değerlerini ve DTD tarafından izin verilen varlıkları listeler
Comment[ug]=DTD ئېنىقلىمىسىغا ئاساسەن يول قويىدىغان XML ئېلېمېنتى، خاسلىقى، خاسلىق قىممىتى ۋە گەۋدىسىنىڭ تىزىمىنى كۆرسىتىدۇ
Comment[uk]=Список елементів XML, атрибути, значення атрибутів і об’єктів дозволених DTD
+Comment[vi]=Liệt kê phần tử XML, thuộc tính, giá trị thuộc tính và các hạng mục cho phép bởi DTD
Comment[x-test]=xxLists XML elements, attributes, attribute values and entities allowed by DTDxx
Comment[zh_CN]=根据 DTD 定义列出允许的 XML 元素、属性、属性值及实体
Comment[zh_TW]=列出通過 DTD 的 XML 元素、屬性、屬性值與實體
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/addons/xmltools/plugin_katexmltools.cpp
^
|
@@ -125,14 +125,14 @@
setXMLFile(QLatin1String("ui.rc"));
QAction *actionInsert = new QAction(i18n("&Insert Element..."), this);
- actionInsert->setShortcut(Qt::CTRL + Qt::Key_Return);
connect(actionInsert, SIGNAL(triggered()), &m_model, SLOT(slotInsertElement()));
actionCollection()->addAction("xml_tool_insert_element", actionInsert);
+ actionCollection()->setDefaultShortcut(actionInsert, Qt::CTRL + Qt::Key_Return);
QAction *actionClose = new QAction(i18n("&Close Element"), this);
- actionClose->setShortcut(Qt::CTRL + Qt::Key_Less);
connect(actionClose, SIGNAL(triggered()), &m_model, SLOT(slotCloseElement()));
actionCollection()->addAction("xml_tool_close_element", actionClose);
+ actionCollection()->setDefaultShortcut(actionClose, Qt::CTRL + Qt::Key_Less);
QAction *actionAssignDTD = new QAction(i18n("Assign Meta &DTD..."), this);
connect(actionAssignDTD, SIGNAL(triggered()), &m_model, SLOT(getDTD()));
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/doc/katepart/vi.docbook
^
|
@@ -38,11 +38,11 @@
<userinput>Y</userinput> are different commands. To enter the
<userinput>y</userinput> (yank) command, make sure <keysym>Caps Lock</keysym> is
disabled and press <keycap>Y</keycap>. To enter the <userinput>Y</userinput>
-(yank to end of line) command,
+(yank to end of line) command,
<keycombo action="simul">&Shift;<keycap>Y</keycap></keycombo>.</para>
<para>This does not apply to commands that use the &Ctrl; key, which may be
-entered regardless of <keycap>Caps Lock</keycap> mode and without pressing
+entered regardless of <keycap>Caps Lock</keycap> mode and without pressing
&Shift;. However, some commands require the use of a &Ctrl;-key combination
followed by another key which is case sensitive. For instance, to input
<quote><keycombo action="simul">&Ctrl;<keycap>W</keycap></keycombo>,
@@ -185,12 +185,27 @@
<row><entry><para><userinput>i</userinput></para></entry>
<entry><para>Enter Insert Mode; insert before cursor</para></entry>
</row>
+<row><entry><para><keycap>Insert</keycap></para></entry>
+<entry><para>Enter Insert Mode; insert before cursor</para></entry>
+</row>
+<row><entry><para><userinput>I</userinput></para></entry>
+<entry><para>Enter Insert Mode; insert before first non-blank char on line</para></entry>
+</row>
+<row><entry><para><userinput>gi</userinput></para></entry>
+<entry><para>Enter Insert Mode; insert before place, where leaving the last insert mode</para></entry>
+</row>
<row><entry><para><userinput>v</userinput></para></entry>
<entry><para>Enter Visual Mode; select characters</para></entry>
</row>
<row><entry><para><userinput>V</userinput></para></entry>
<entry><para>Enter Visual Mode; select lines</para></entry>
</row>
+<row><entry><para><keycombo action="simul">&Ctrl;<keycap>v</keycap></keycombo></para></entry>
+<entry><para>Enter Visual Mode; select blocks</para></entry>
+</row>
+<row><entry><para><userinput>gb</userinput></para></entry>
+<entry><para>Enter Visual Mode; reselect the last selection</para></entry>
+</row>
<row><entry><para><userinput>o</userinput></para></entry>
<entry><para>Open a new line below current line</para></entry>
</row>
@@ -227,19 +242,22 @@
<row><entry><para><userinput>x</userinput></para></entry>
<entry><para>Delete character to right of cursor</para></entry>
</row>
+<row><entry><para><keycap>Delete</keycap></para></entry>
+<entry><para>Delete character to right of cursor</para></entry>
+</row>
<row><entry><para><userinput>X</userinput></para></entry>
<entry><para>Delete character to left of cursor</para></entry>
</row>
<row><entry><para><userinput>gu</userinput></para></entry>
<entry><para>Follow with a motion to make lowercase</para></entry>
</row>
-<row><entry><para><userinput>g</userinput></para></entry>
+<row><entry><para><userinput>guu</userinput></para></entry>
<entry><para>Make the current line lowercase</para></entry>
</row>
<row><entry><para><userinput>gU</userinput></para></entry>
<entry><para>Follow with a motion to make uppercase</para></entry>
</row>
-<row><entry><para><userinput>g</userinput></para></entry>
+<row><entry><para><userinput>gUU</userinput></para></entry>
<entry><para>Make the current line uppercase</para></entry>
</row>
<row><entry><para><userinput>y</userinput></para></entry>
@@ -257,9 +275,18 @@
<row><entry><para><userinput>P</userinput></para></entry>
<entry><para>Paste before cursor</para></entry>
</row>
+<row><entry><para><userinput>]p</userinput></para></entry>
+<entry><para>Paste after cursor indented</para></entry>
+</row>
+<row><entry><para><userinput>[p</userinput></para></entry>
+<entry><para>Paste before cursor indented</para></entry>
+</row>
<row><entry><para><userinput>r</userinput></para></entry>
<entry><para>Follow with a character to replace the character after the cursor</para></entry>
</row>
+<row><entry><para><userinput>R</userinput></para></entry>
+<entry><para>Enter Replace Mode</para></entry>
+</row>
<row><entry><para><userinput>:</userinput></para></entry>
<entry><para>Enter Command Mode</para></entry>
</row>
@@ -499,6 +526,12 @@
<entry><para>Go one line up visually (when using dynamic word wrap)</para></entry></row>
<row><entry><para><userinput>gj</userinput></para></entry>
<entry><para>Go one line down visually (when using dynamic word wrap)</para></entry></row>
+<row><entry><para><keycombo action="simul">&Ctrl;<keycap>Left</keycap></keycombo></para></entry>
+<entry><para>Move one word left</para></entry>
+</row>
+<row><entry><para><keycombo action="simul">&Ctrl;<keycap>Right</keycap></keycombo></para></entry>
+<entry><para>Move one word right</para></entry>
+</row>
</tbody>
</tgroup>
</informaltable>
@@ -604,7 +637,7 @@
<entry><para>Indent</para></entry>
</row>
<row><entry><para><keycombo action="simul">&Ctrl;<keycap>E</keycap></keycombo></para></entry>
-<entry><para>commandInsertFromBelow</para></entry>
+<entry><para>Insert from below</para></entry>
</row>
<row><entry><para><keycombo action="simul">&Ctrl;<keycap>Y</keycap></keycombo></para></entry>
<entry><para>Delete word</para></entry>
@@ -612,6 +645,15 @@
<row><entry><para><keycombo action="simul">&Ctrl;<keycap>W</keycap></keycombo></para></entry>
<entry><para>Delete word</para></entry>
</row>
+<row><entry><para><keycombo action="simul">&Ctrl;<keycap>U</keycap></keycombo></para></entry>
+<entry><para>Delete line</para></entry>
+</row>
+<row><entry><para><keycombo action="simul">&Ctrl;<keycap>J</keycap></keycombo></para></entry>
+<entry><para>New line</para></entry>
+</row>
+<row><entry><para><keycombo action="simul">&Ctrl;<keycap>H</keycap></keycombo></para></entry>
+<entry><para>Delete char backward</para></entry>
+</row>
<row><entry><para><keycombo action="simul">&Ctrl;<keycap>Home</keycap></keycombo></para></entry>
<entry><para>Move to first character in the document</para></entry>
</row>
@@ -659,17 +701,7 @@
<title>Missing Features</title>
<para>As stated earlier, the goal of &kappname;’s VI Mode is not to support 100% of
-Vim’s features. However, there are some features which are sorely missed:</para>
-<itemizedlist>
-<listitem>
-<para>Visual block mode - especially the ability to prepend/append text to the
-visual block selection.</para></listitem>
-<listitem>
-<para>Having ex commands available in other programs than the &kappname; application.</para></listitem>
-<listitem>
-<para>The search code needs improvement and the <userinput>*</userinput> and
-<userinput>#</userinput>commands should just be regular searches.</para></listitem>
-</itemizedlist>
+Vim’s features.</para>
</sect2>
</sect1>
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/data/kateui.rc
^
|
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="kate" version="76">
+<kpartgui name="kate" version="80">
<MenuBar>
<Menu name="file" noMerge="1">
<text>&File</text>
@@ -45,6 +45,9 @@
<Separator/>
<DefineGroup name="switch_document"/>
<Separator/>
+ <Action name="view_next_tab"/>
+ <Action name="view_prev_tab"/>
+ <Action name="view_lru_document_next"/>
<Action name="view_quick_open"/>
<Separator/>
<Menu name="view-split">
@@ -54,6 +57,7 @@
<Separator/>
<Action name="view_split_vert"/>
<Action name="view_split_horiz"/>
+ <Action name="view_split_toggle"/>
<Separator/>
<Action name="view_close_current_space"/>
<Action name="view_close_others"/>
@@ -108,8 +112,6 @@
<Action name="file_new" group="file_open"/>
<Action name="file_open" group="file_open"/>
<Separator/>
- <DefineGroup name="switch_document"/>
- <Separator/>
<DefineGroup name="file_operations"/>
<Separator/>
<DefineGroup name="print_merge"/>
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/data/org.kde.kate.desktop
^
|
@@ -54,6 +54,7 @@
GenericName[tr]=Gelişmiş Metin Düzenleyici
GenericName[ug]=ئالىي تېكىست تەھرىرلىگۈچ
GenericName[uk]=Потужний текстовий редактор
+GenericName[vi]=Trình biên tập văn bản nâng cao
GenericName[x-test]=xxAdvanced Text Editorxx
GenericName[zh_CN]=高级文本编辑器
GenericName[zh_TW]=進階文字編輯器
@@ -113,6 +114,7 @@
Name[tr]=Kate
Name[ug]=Kate
Name[uk]=Kate
+Name[vi]=Kate
Name[wa]=Kate
Name[x-test]=xxKatexx
Name[zh_CN]=Kate
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/icons/128-apps-kate.png
^
|
(renamed from upstream/kate/icons/hi128-app-kate.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/icons/16-apps-kate.png
^
|
(renamed from upstream/kate/icons/hi16-app-kate.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/icons/22-apps-kate.png
^
|
(renamed from upstream/kate/icons/hi22-app-kate.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/icons/32-apps-kate.png
^
|
(renamed from upstream/kate/icons/hi32-app-kate.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/icons/48-apps-kate.png
^
|
(renamed from upstream/kate/icons/hi48-app-kate.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/icons/64-apps-kate.png
^
|
(renamed from upstream/kate/icons/hi64-app-kate.png)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/icons/CMakeLists.txt
^
|
@@ -1,2 +1,12 @@
########### install files ###############
-ecm_install_icons( ${ICON_INSTALL_DIR} )
\ No newline at end of file
+ecm_install_icons(ICONS
+sc-apps-kate.svgz
+128-apps-kate.png
+16-apps-kate.png
+22-apps-kate.png
+32-apps-kate.png
+48-apps-kate.png
+64-apps-kate.png
+DESTINATION ${ICON_INSTALL_DIR}
+THEME hicolor
+)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/icons/sc-apps-kate.svgz
^
|
(renamed from upstream/kate/icons/hisc-app-kate.svgz)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/kateapp.cpp
^
|
@@ -24,7 +24,6 @@
#include "kateviewmanager.h"
#include "katesessionmanager.h"
#include "katemainwindow.h"
-#include "katedebug.h"
#include <KConfig>
#include <KSharedConfig>
@@ -97,8 +96,7 @@
bool KateApp::init()
{
-
- qCDebug(LOG_KATE) << "Setting KATE_PID: '" << QCoreApplication::applicationPid() << "'";
+ // set KATE_PID for use in child processes
qputenv("KATE_PID", QString::fromLatin1("%1").arg(QCoreApplication::applicationPid()).toLatin1().constData());
// handle restore different
@@ -108,7 +106,7 @@
// let us handle our command line args and co ;)
// we can exit here if session chooser decides
if (!startupKate()) {
- qCDebug(LOG_KATE) << "startupKate returned false";
+ // session chooser telled to exit kate
return false;
}
}
@@ -153,9 +151,8 @@
} else if (!m_args.isSet(QStringLiteral("stdin")) && (m_args.positionalArguments().count() == 0)) { // only start session if no files specified
// let the user choose session if possible
if (!sessionManager()->chooseSession()) {
- qCDebug(LOG_KATE) << "chooseSession returned false, exiting";
- // we will exit kate now, notify the rest of the world we are done
#ifdef Q_WS_X11
+ // we will exit kate now, notify the rest of the world we are done
KStartupInfo::appStarted(startupId());
#endif
return false;
@@ -248,7 +245,6 @@
activeKateMainWindow()->setAutoSaveSettings();
- qCDebug(LOG_KATE) << "KateApplication::init finished successful";
return true;
}
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/kateconfigplugindialogpage.cpp
^
|
@@ -75,15 +75,15 @@
layout->addWidget(listView);
QStringList headers;
- headers << i18n("Name") << i18n("Comment");
+ headers << i18n("Name") << i18n("Description");
listView->setHeaderLabels(headers);
listView->setWhatsThis(i18n("Here you can see all available Kate plugins. Those with a check mark are loaded, and will be loaded again the next time Kate is started."));
KatePluginList &pluginList(KateApp::self()->pluginManager()->pluginList());
for (KatePluginList::iterator it = pluginList.begin(); it != pluginList.end(); ++it) {
QTreeWidgetItem *item = new KatePluginListItem(it->load, &(*it));
- item->setText(0, it->service->name());
- item->setText(1, it->service->comment());
+ item->setText(0, it->metaData.name());
+ item->setText(1, it->metaData.description());
listView->addTopLevelItem(item);
}
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katedocmanager.cpp
^
|
@@ -31,7 +31,6 @@
#include <KCodecs>
#include <KMessageBox>
-#include <KEncodingFileDialog>
#include <KIO/DeleteJob>
#include <KIconLoader>
#include <KColorScheme>
@@ -47,6 +46,7 @@
#include <QApplication>
#include <QListView>
#include <QProgressDialog>
+#include <QFileDialog>
KateDocManager::KateDocManager(QObject *parent)
: QObject(parent)
@@ -88,8 +88,6 @@
KTextEditor::Document *KateDocManager::createDoc(const KateDocumentInfo &docInfo)
{
- qCDebug(LOG_KATE) << "createDoc" << endl;
-
KTextEditor::Document *doc = KTextEditor::Editor::instance()->createDocument(this);
// turn of the editorpart's own modification dialog, we have our own one, too!
@@ -172,7 +170,9 @@
if (!doc) {
doc = createDoc(docInfo);
- doc->setEncoding(encoding);
+ if (!encoding.isEmpty()) {
+ doc->setEncoding(encoding);
+ }
if (!u.isEmpty()) {
if (!loadMetaInfos(doc, u)) {
@@ -236,8 +236,6 @@
}
}
- qCDebug(LOG_KATE) << "deleting document with name:" << doc->documentName();
-
KateApp::self()->emitDocumentClosed(QString::number((qptrdiff)doc));
// document will be deleted, soon
@@ -342,14 +340,9 @@
}
if (msgres == KMessageBox::Yes) {
- KEncodingFileDialog::Result r = KEncodingFileDialog::getSaveUrlAndEncoding(doc->encoding(), QUrl(), QString(), w, i18n("Save As"));
-
- doc->setEncoding(r.encoding);
-
- if (!r.URLs.isEmpty()) {
- QUrl tmp = r.URLs.first();
-
- if (!doc->saveAs(tmp)) {
+ const QUrl url = QFileDialog::getSaveFileUrl(w, i18n("Save As"));
+ if (!url.isEmpty()) {
+ if (!doc->saveAs(url)) {
return false;
}
} else {
@@ -545,8 +538,6 @@
m_metaInfos->sync();
}
-// TODO: KDE 5: KateDocument computes the md5 digest when loading a file, and
-// when saving a file. Maybe add "QString KTextEditor::Document::md5sum()" const?
bool KateDocManager::computeUrlMD5(const QUrl &url, QByteArray &result)
{
QFile f(url.toLocalFile());
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katemainwindow.cpp
^
|
@@ -78,11 +78,8 @@
#include <QFontDatabase>
#include <ktexteditor/sessionconfiginterface.h>
-
-#include <assert.h>
//END
-uint KateMainWindow::uniqueID = 1;
KateMwModOnHdDialog *KateMainWindow::s_modOnHdDialog = 0;
KateContainerStackedLayout::KateContainerStackedLayout(QWidget *parent)
@@ -107,56 +104,21 @@
KateMainWindow::KateMainWindow(KConfig *sconfig, const QString &sgroup)
: KateMDI::MainWindow(0)
+ , m_modignore(false)
, m_wrapper(new KTextEditor::MainWindow(this))
{
/**
* we don't want any flicker here
*/
KateUpdateDisabler disableUpdates (this);
-
- setObjectName(QString::fromLatin1("__KateMainWindow#%1").arg(uniqueID));
- // first the very important id
- myID = uniqueID;
- uniqueID++;
-
- m_modignore = false;
-
- int scnum = QApplication::desktop()->screenNumber(parentWidget());
- QRect desk = QApplication::desktop()->screenGeometry(scnum);
-
- QSize size;
-
- // try to load size
- if (sconfig) {
- KConfigGroup cg(sconfig, sgroup);
- size.setWidth(cg.readEntry(QString::fromLatin1("Width %1").arg(desk.width()), 0));
- size.setHeight(cg.readEntry(QString::fromLatin1("Height %1").arg(desk.height()), 0));
- }
-
- // if thats fails, try to reuse size
- if (size.isEmpty()) {
- // first try to reuse size known from current or last created main window ;=)
- if (KateApp::self()->mainWindowsCount() > 0) {
- KateMainWindow *win = KateApp::self()->activeKateMainWindow();
- if (!win) {
- win = KateApp::self()->mainWindow(KateApp::self()->mainWindowsCount() - 1);
- }
-
- size = win->size();
- } else { // now fallback to hard defaults ;)
- // first try global app config
- KConfigGroup cg(KSharedConfig::openConfig(), "MainWindow");
- size.setWidth(cg.readEntry(QString::fromLatin1("Width %1").arg(desk.width()), 0));
- size.setHeight(cg.readEntry(QString::fromLatin1("Height %1").arg(desk.height()), 0));
-
- if (size.isEmpty()) {
- size = QSize(qMin(700, desk.width()), qMin(480, desk.height()));
- }
- }
-
- resize(size);
- }
+ /**
+ * get and set config revision
+ */
+ static const int currentConfigRevision = 10;
+ const int readConfigRevision = KConfigGroup(KSharedConfig::openConfig(), "General").readEntry("Config Revision", 0);
+ KConfigGroup(KSharedConfig::openConfig(), "General").writeEntry("Config Revision", currentConfigRevision);
+ const bool firstStart = readConfigRevision < currentConfigRevision;
// start session restore if needed
startRestore(sconfig, sgroup);
@@ -208,6 +170,10 @@
// prior to this there was (possibly) no view, therefore not context menu.
// Hence, we have to take care of the menu bar here
toggleShowMenuBar(false);
+
+ // on first start: deactivate toolbar
+ if (firstStart)
+ toolBar(QLatin1String("mainToolBar"))->hide();
}
KateMainWindow::~KateMainWindow()
@@ -234,6 +200,14 @@
m_wrapper = 0;
}
+QSize KateMainWindow::sizeHint() const
+{
+ /**
+ * have some useful size hint, else we have mini windows per default
+ */
+ return (QSize(640, 480).expandedTo(minimumSizeHint()));
+}
+
void KateMainWindow::setupImportantActions()
{
m_paShowStatusBar = KStandardAction::showStatusbar(this, SLOT(toggleShowStatusBar()), actionCollection());
@@ -250,14 +224,21 @@
connect(m_paShowPath, SIGNAL(toggled(bool)), this, SLOT(updateCaption()));
m_paShowPath->setWhatsThis(i18n("Show the complete document path in the window caption"));
+ QAction * a = actionCollection()->addAction(KStandardAction::Back, QStringLiteral("view_prev_tab"));
+ a->setText(i18n("&Previous Tab"));
+ a->setWhatsThis(i18n("Focus the previous tab."));
+ connect(a, SIGNAL(triggered()), this, SLOT(slotFocusPrevTab()));
+
+ a = actionCollection()->addAction(KStandardAction::Forward, QStringLiteral("view_next_tab"));
+ a->setText(i18n("&Next Tab"));
+ a->setWhatsThis(i18n("Focus the next tab."));
+ connect(a, SIGNAL(triggered()), this, SLOT(slotFocusNextTab()));
+
// the quick open action is used by the KateViewSpace "quick open button"
- QAction * a = actionCollection()->addAction(QStringLiteral("view_quick_open"));
+ a = actionCollection()->addAction(QStringLiteral("view_quick_open"));
a->setIcon(QIcon::fromTheme(QStringLiteral("quickopen")));
a->setText(i18n("&Quick Open"));
- QList<QKeySequence> scuts;
- scuts << QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_O)
- << QKeySequence(Qt::CTRL + Qt::Key_Tab);
- a->setShortcuts(scuts);
+ actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_O));
connect(a, SIGNAL(triggered()), this, SLOT(slotQuickOpen()));
a->setWhatsThis(i18n("Open a form to quick open documents."));
}
@@ -304,7 +285,7 @@
a = actionCollection()->addAction(QStringLiteral("file_save_all"));
a->setIcon(QIcon::fromTheme(QStringLiteral("document-save-all")));
a->setText(i18n("Save A&ll"));
- a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
+ actionCollection()->setDefaultShortcut(a, QKeySequence(Qt::CTRL + Qt::Key_L));
connect(a, SIGNAL(triggered()), KateApp::self()->documentManager(), SLOT(saveAll()));
a->setWhatsThis(i18n("Save all open, modified documents to disk."));
@@ -1087,6 +1068,20 @@
return m_pluginViews.contains(plugin) ? m_pluginViews.value(plugin) : 0;
}
+void KateMainWindow::slotFocusPrevTab()
+{
+ if (m_viewManager->activeViewSpace()) {
+ m_viewManager->activeViewSpace()->focusPrevTab();
+ }
+}
+
+void KateMainWindow::slotFocusNextTab()
+{
+ if (m_viewManager->activeViewSpace()) {
+ m_viewManager->activeViewSpace()->focusNextTab();
+ }
+}
+
void KateMainWindow::slotQuickOpen()
{
/**
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katemainwindow.h
^
|
@@ -103,10 +103,6 @@
* anders: I add this for use from the file selector. */
QUrl activeDocumentUrl();
- uint mainWindowNumber() const {
- return myID;
- }
-
/**
* Prompts the user for what to do with files that are modified on disk if any.
* This is optionally run when the window receives focus, and when the last
@@ -166,10 +162,19 @@
void slotFileQuit();
void queueModifiedOnDisc(KTextEditor::Document *doc);
+ void slotFocusPrevTab();
+ void slotFocusNextTab();
+
/**
* Show quick open
*/
void slotQuickOpen();
+
+ /**
+ * Overwrite size hint for better default window sizes
+ * @return size hint
+ */
+ QSize sizeHint() const;
/**
* slots used for actions in the menus/toolbars
@@ -475,9 +480,6 @@
void slotDocumentCloseOther(KTextEditor::Document *document);
void slotDocumentCloseSelected(const QList<KTextEditor::Document *> &);
private:
- static uint uniqueID;
- uint myID;
-
/**
* Notify about file modifications from other processes?
*/
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katemdi.cpp
^
|
@@ -114,7 +114,7 @@
actionCollection()->addAction(QStringLiteral("kate_mdi_toolview_menu"), m_toolMenu);
m_showSidebarsAction = new KToggleAction(i18n("Show Side&bars"), this);
actionCollection()->addAction(QStringLiteral("kate_mdi_sidebar_visibility"), m_showSidebarsAction);
- m_showSidebarsAction->setShortcut(Qt::CTRL | Qt::ALT | Qt::SHIFT | Qt::Key_F);
+ actionCollection()->setDefaultShortcut(m_showSidebarsAction, Qt::CTRL | Qt::ALT | Qt::SHIFT | Qt::Key_F);
m_showSidebarsAction->setChecked(m_mw->sidebarsVisible());
connect(m_showSidebarsAction, SIGNAL(toggled(bool)),
@@ -157,7 +157,7 @@
}
KToggleAction *a = new ToggleToolViewAction(i18n("Show %1", tv->text), tv, this);
- a->setShortcuts(shortcuts);
+ actionCollection()->setDefaultShortcuts(a, shortcuts);
actionCollection()->addAction(aname, a);
m_toolViewActions.append(a);
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katepluginmanager.cpp
^
|
@@ -24,19 +24,21 @@
#include "kateapp.h"
#include "katemainwindow.h"
+#include "katedebug.h"
#include <KConfig>
-
-#include <KServiceTypeTrader>
#include <KConfigGroup>
-#include "katedebug.h"
+#include <KPluginFactory>
+#include <KPluginLoader>
+
#include <QFile>
+#include <QFileInfo>
#include <ktexteditor/sessionconfiginterface.h>
QString KatePluginInfo::saveName() const
{
- return service->library();
+ return QFileInfo(metaData.fileName()).baseName();
}
KatePluginManager::KatePluginManager(QObject *parent) : QObject(parent)
@@ -52,13 +54,27 @@
void KatePluginManager::setupPluginList()
{
- KService::List traderList = KServiceTypeTrader::self()->query(QStringLiteral("KTextEditor/Plugin"));
+ /**
+ * get all KTextEditor/Plugins
+ */
+ const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("ktexteditor"), [](const KPluginMetaData & md) {
+ return md.serviceTypes().contains(QStringLiteral("KTextEditor/Plugin"));
+ });
+ /**
+ * move them to our internal data structure
+ * activate some plugins per default
+ */
+ QSet<QString> defaultPlugins;
+ defaultPlugins.insert (QLatin1String("katefiletreeplugin"));
+ defaultPlugins.insert (QLatin1String("tabswitcherplugin"));
+ defaultPlugins.insert (QLatin1String("kateprojectplugin"));
+ defaultPlugins.insert (QLatin1String("katesearchplugin"));
m_pluginList.clear ();
- foreach(const KService::Ptr & ptr, traderList) {
+ Q_FOREACH(const KPluginMetaData &metaData, plugins) {
KatePluginInfo info;
- info.service = ptr;
- info.defaultLoad = info.service->property(QStringLiteral("X-KTextEditor-Load-Default")).toStringList().contains(QStringLiteral("kate"));
+ info.metaData = metaData;
+ info.defaultLoad = defaultPlugins.contains(info.saveName());
info.load = false;
info.plugin = nullptr;
m_pluginList.push_back(info);
@@ -69,7 +85,7 @@
*/
m_name2Plugin.clear();
for (int i = 0; i < m_pluginList.size(); ++i) {
- m_name2Plugin[m_pluginList[i].service->library()] = &(m_pluginList[i]);
+ m_name2Plugin[m_pluginList[i].saveName()] = &(m_pluginList[i]);
}
}
@@ -86,7 +102,7 @@
// disable all plugin if no config, beside the ones marked as default load
for (int i = 0; i < m_pluginList.size(); ++i) {
- m_pluginList[i].load = cg.readEntry(m_pluginList[i].service->library(), m_pluginList[i].defaultLoad);
+ m_pluginList[i].load = cg.readEntry(m_pluginList[i].saveName(), m_pluginList[i].defaultLoad);
}
}
@@ -153,10 +169,16 @@
void KatePluginManager::loadPlugin(KatePluginInfo *item)
{
- const QString pluginName = item->service->library();
- item->load = (item->plugin = item->service->createInstance<KTextEditor::Plugin>(this, QVariantList() << pluginName));
+ /**
+ * try to load the plugin
+ */
+ item->load = (item->plugin = KPluginLoader(item->metaData.fileName()).factory()->create<KTextEditor::Plugin>(this, QVariantList() << item->saveName()));
+
+ /**
+ * tell the world about the success
+ */
if (item->plugin) {
- emit KateApp::self()->wrapper()->pluginCreated(pluginName, item->plugin);
+ emit KateApp::self()->wrapper()->pluginCreated(item->saveName(), item->plugin);
}
}
@@ -167,7 +189,7 @@
KTextEditor::Plugin *plugin = item->plugin;
item->plugin = 0L;
item->load = false;
- emit KateApp::self()->wrapper()->pluginDeleted(item->service->library(), plugin);
+ emit KateApp::self()->wrapper()->pluginDeleted(item->saveName(), plugin);
}
void KatePluginManager::enablePluginGUI(KatePluginInfo *item, KateMainWindow *win, KConfigBase *config)
@@ -196,7 +218,7 @@
}
if (createdView) {
- emit win->wrapper()->pluginViewCreated(item->service->library(), createdView);
+ emit win->wrapper()->pluginViewCreated(item->saveName(), createdView);
}
}
@@ -229,7 +251,7 @@
QObject *deletedView = win->pluginViews().value(item->plugin);
delete deletedView;
win->pluginViews().remove(item->plugin);
- emit win->wrapper()->pluginViewDeleted(item->service->library(), deletedView);
+ emit win->wrapper()->pluginViewDeleted(item->saveName(), deletedView);
}
void KatePluginManager::disablePluginGUI(KatePluginInfo *item)
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katepluginmanager.h
^
|
@@ -24,11 +24,12 @@
#include <KTextEditor/Plugin>
-#include <KService>
+#include <KPluginMetaData>
#include <KConfigBase>
#include <QObject>
-#include <QLinkedList>
+#include <QList>
+#include <QMap>
class KConfig;
class KateMainWindow;
@@ -38,7 +39,7 @@
public:
bool load;
bool defaultLoad;
- KService::Ptr service;
+ KPluginMetaData metaData;
KTextEditor::Plugin *plugin;
QString saveName() const;
};
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katesavemodifieddialog.cpp
^
|
@@ -24,13 +24,13 @@
#include <KStandardGuiItem>
#include <KIconLoader>
#include <KMessageBox>
-#include <KEncodingFileDialog>
#include <KLocalizedString>
#include <QLabel>
#include <QPushButton>
#include <QTreeWidget>
#include <QVBoxLayout>
+#include <QFileDialog>
class AbstractKateSaveModifiedDialogCheckListItem: public QTreeWidgetItem
{
@@ -80,15 +80,11 @@
{}
virtual bool synchronousSave(QWidget *dialogParent) {
if (m_document->url().isEmpty()) {
- KEncodingFileDialog::Result r = KEncodingFileDialog::getSaveUrlAndEncoding(
- m_document->encoding(), QUrl(), QString(), dialogParent, i18n("Save As (%1)", m_document->documentName()));
-
- if (!r.URLs.isEmpty()) {
- QUrl tmp = r.URLs.first();
-
+ const QUrl url = QFileDialog::getSaveFileUrl(dialogParent, i18n("Save As (%1)", m_document->documentName()));
+ if (!url.isEmpty()) {
// check for overwriting a file
- if (tmp.isLocalFile()) {
- QFileInfo info(tmp.path());
+ if (url.isLocalFile()) {
+ QFileInfo info(url.path());
if (info.exists()) {
if (KMessageBox::Cancel == KMessageBox::warningContinueCancel(dialogParent,
i18n("A file named \"%1\" already exists. "
@@ -101,9 +97,7 @@
}
}
- m_document->setEncoding(r.encoding);
-
- if (!m_document->saveAs(tmp)) {
+ if (!m_document->saveAs(url)) {
setState(SaveFailedState);
setText(1, m_document->url().toString());
return false;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katetabbar.cpp
^
|
@@ -21,17 +21,12 @@
#include "katetabbar.h"
#include "katetabbutton.h"
-#include <kconfig.h>
-#include <kconfiggroup.h>
-#include <kiconloader.h>
-#include <kstringhandler.h>
-#include <KLocalizedString>
-
-#include <QToolButton>
-#include <QDebug>
-
#include "math.h"
+#include <QPainter>
+#include <QResizeEvent>
+#include <QStyleOptionTab>
+
/**
* Creates a new tab bar with the given \a parent.
*/
@@ -47,7 +42,7 @@
m_nextID = 0;
- m_activeButton = 0L;
+ m_activeButton = Q_NULLPTR;
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
}
@@ -72,32 +67,6 @@
return m_isActiveViewSpace;
}
-void KateTabBar::load(KConfigBase *config, const QString &group)
-{
- KConfigGroup cg(config, group);
-
- // highlighted entries
- QStringList documents = cg.readEntry("highlighted documents", QStringList());
- QStringList colors = cg.readEntry("highlighted colors", QStringList());
-
- // restore highlight map
- m_highlightedTabs.clear();
- for (int i = 0; i < documents.size() && i < colors.size(); ++i) {
- m_highlightedTabs[documents[i]] = colors[i];
- }
-
- setHighlightMarks(highlightMarks());
-}
-
-void KateTabBar::save(KConfigBase *config, const QString &group) const
-{
- KConfigGroup cg(config, group);
-
- // highlighted entries
- cg.writeEntry("highlighted documents", m_highlightedTabs.keys());
- cg.writeEntry("highlighted colors", m_highlightedTabs.values());
-}
-
int KateTabBar::addTab(const QString &text)
{
return insertTab(m_tabButtons.size(), text);
@@ -113,16 +82,11 @@
}
KateTabButton *tabButton = new KateTabButton(text, this);
- if (m_highlightedTabs.contains(text)) {
- tabButton->setHighlightColor(QColor(m_highlightedTabs[text]));
- }
m_tabButtons.insert(position, tabButton);
m_idToTab[m_nextID] = tabButton;
connect(tabButton, SIGNAL(activated(KateTabButton*)),
this, SLOT(tabButtonActivated(KateTabButton*)));
- connect(tabButton, SIGNAL(highlightChanged(KateTabButton*)),
- this, SLOT(tabButtonHighlightChanged(KateTabButton*)));
connect(tabButton, SIGNAL(closeRequest(KateTabButton*)),
this, SLOT(tabButtonCloseRequest(KateTabButton*)));
@@ -156,6 +120,46 @@
m_activeButton->setChecked(true);
}
+int KateTabBar::prevTab() const
+{
+ const int curId = currentTab();
+
+ if (curId >= 0) {
+ KateTabButton *tabButton = m_idToTab[curId];
+ const int index = m_tabButtons.indexOf(tabButton);
+ Q_ASSERT(index >= 0);
+
+ if (index > 0) {
+ return m_idToTab.key(m_tabButtons[index - 1], -1);
+ } else if (count() > 1) {
+ // cycle through tabbar
+ return m_idToTab.key(m_tabButtons.last(), -1);
+ }
+ }
+
+ return -1;
+}
+
+int KateTabBar::nextTab() const
+{
+ const int curId = currentTab();
+
+ if (curId >= 0) {
+ KateTabButton *tabButton = m_idToTab[curId];
+ const int index = m_tabButtons.indexOf(tabButton);
+ Q_ASSERT(index >= 0);
+
+ if (index < m_tabButtons.size() - 1) {
+ return m_idToTab.key(m_tabButtons[index + 1], -1);
+ } else if (count() > 1) {
+ // cycle through tabbar
+ return m_idToTab.key(m_tabButtons.first(), -1);
+ }
+ }
+
+ return -1;
+}
+
int KateTabBar::removeTab(int id)
{
Q_ASSERT(m_idToTab.contains(id));
@@ -163,7 +167,7 @@
KateTabButton *tabButton = m_idToTab[id];
if (tabButton == m_activeButton) {
- m_activeButton = 0L;
+ m_activeButton = Q_NULLPTR;
}
const int position = m_tabButtons.indexOf(tabButton);
@@ -189,18 +193,6 @@
void KateTabBar::setTabText(int id, const QString &text)
{
Q_ASSERT(m_idToTab.contains(id));
-
- // change highlight key, if entry exists
- if (m_highlightedTabs.contains(m_idToTab[id]->text())) {
- QString value = m_highlightedTabs[m_idToTab[id]->text()];
- m_highlightedTabs.remove(m_idToTab[id]->text());
- m_highlightedTabs[text] = value;
-
- // do not emit highlightMarksChanged(), because every tabbar gets this
- // change (usually)
- // emit highlightMarksChanged( this );
- }
-
m_idToTab[id]->setText(text);
}
@@ -239,40 +231,6 @@
return m_tabButtons.count();
}
-void KateTabBar::removeHighlightMarks()
-{
- KateTabButton *tabButton;
- foreach(tabButton, m_tabButtons) {
- if (tabButton->highlightColor().isValid()) {
- tabButton->setHighlightColor(QColor());
- }
- }
-
- m_highlightedTabs.clear();
- emit highlightMarksChanged(this);
-}
-
-void KateTabBar::setHighlightMarks(const QMap<QString, QString> &marks)
-{
- m_highlightedTabs = marks;
-
- KateTabButton *tabButton;
- foreach(tabButton, m_tabButtons) {
- if (marks.contains(tabButton->text())) {
- if (tabButton->highlightColor().name() != marks[tabButton->text()]) {
- tabButton->setHighlightColor(QColor(marks[tabButton->text()]));
- }
- } else if (tabButton->highlightColor().isValid()) {
- tabButton->setHighlightColor(QColor());
- }
- }
-}
-
-QMap<QString, QString> KateTabBar::highlightMarks() const
-{
- return m_highlightedTabs;
-}
-
void KateTabBar::tabButtonActivated(KateTabButton *tabButton)
{
if (tabButton == m_activeButton) {
@@ -295,18 +253,6 @@
emit currentChanged(id);
}
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katetabbar.h
^
|
@@ -26,8 +26,8 @@
#include <QList>
#include <QMap>
#include <QIcon>
-#include <QResizeEvent>
+class QResizeEvent;
class KateTabButton;
class KConfigBase;
@@ -48,29 +48,6 @@
virtual ~KateTabBar();
/**
- * Loads the settings from \a config from section \a group.
- * Remembered properties are:
- * - minimum and maximum tab width
- * - fixed tab height
- * - button colors
- * - much more!
- * .
- * The original group is saved and restored at the end of this function.
- *
- * \note Call @p load() immediately after you created the tabbar, otherwise
- * some properties might not be restored correctly (like highlighted
- * buttons).
- */
- void load(KConfigBase *config, const QString &group);
-
- /**
- * Saves the settings to \a config into section \a group.
- * The original group is saved and restored at the end of this function.
- * See @p load() for more information.
- */
- void save(KConfigBase *config, const QString &group) const;
-
- /**
* Adds a new tab with \a text. Returns the new tab's id.
*/
int addTab(const QString &text);
@@ -92,6 +69,18 @@
*/
int currentTab() const;
+ /**
+ * Get the ID of the tab that is located left of the current tab.
+ * The return value is -1, if there is no previous tab.
+ */
+ int prevTab() const;
+
+ /**
+ * Get the ID of the tab that is located right of the current tab.
+ * The return value is -1, if there is no next tab.
+ */
+ int nextTab() const;
+
public Q_SLOTS:
/**
* Activate the tab with \p id. No signal is emitted.
@@ -142,9 +131,6 @@
*/
int count() const;
- void setHighlightMarks(const QMap<QString, QString> &marks);
- QMap<QString, QString> highlightMarks() const;
-
/**
* Return the maximum amount of tabs that fit into the tab bar given
* the minimumTabWidth().
@@ -154,9 +140,6 @@
void setActiveViewSpace(bool active);
bool isActiveViewSpace() const;
-public Q_SLOTS:
- void removeHighlightMarks();
-
Q_SIGNALS:
/**
* This signal is emitted whenever the current activated tab changes.
@@ -169,21 +152,13 @@
void closeTabRequested(int id);
/**
- * This signal is emitted whenever all tabs except tab @p id
- * should be closed.
+ * This signal is emitted whenever the context menu is requested for
+ * button @p id at position @p globalPos.
+ * @param id the button, or -1 if the context menu was requested on
+ * at a place where no tab exists
+ * @param globalPos the position of the context menu in global coordinates
*/
- void closeOtherTabsRequested(int id);
-
- /**
- * This signal is emitted whenever all tabs should be closed.
- */
- void closeAllTabsRequested();
-
- /**
- * This signal is emitted whenever a highlight mark changes.
- * Usually this is used to synchronice several tabbars.
- */
- void highlightMarksChanged(KateTabBar *tabbar);
+ void contextMenuRequest(int id, const QPoint & globalPos);
/**
* This signal is emitted whenever the tab bar's width allows to
@@ -219,12 +194,6 @@
void tabButtonActivated(KateTabButton *tabButton);
/**
- * The \e tabButton's highlight color changed, so update the list of documents
- * and colors.
- */
- void tabButtonHighlightChanged(KateTabButton *tabButton);
-
- /**
* If the user wants to close a tab with the context menu, it sends a close
* request.
*/
@@ -249,6 +218,12 @@
/** trigger repaint on hover leave event */
void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
+ /** Paint tab separators */
+ void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+
+ /** Request context menu */
+ void contextMenuEvent(QContextMenuEvent *ev);
+
protected:
/**
* Set tab geometry. The tabs are animated only if @p animate is @e true.
@@ -275,9 +250,6 @@
KateTabButton *m_activeButton;
int m_nextID;
-
- // map of highlighted tabs and colors
- QMap< QString, QString > m_highlightedTabs;
};
#endif // KATE_TAB_BAR_H
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katetabbutton.cpp
^
|
@@ -20,19 +20,18 @@
#include "katetabbutton.h"
-#include <klocalizedstring.h>
+#include <KLocalizedString>
#include <QApplication>
-#include <QColorDialog>
-#include <QContextMenuEvent>
#include <QFontDatabase>
-#include <QIcon>
-#include <QMenu>
+#include <QHBoxLayout>
+#include <QMoveEvent>
#include <QPainter>
#include <QPropertyAnimation>
#include <QStyle>
#include <QStyleOption>
-#include <QHBoxLayout>
+
+#include <math.h>
TabCloseButton::TabCloseButton(QWidget * parent)
: QAbstractButton(parent)
@@ -91,15 +90,10 @@
}
-QColor KateTabButton::s_predefinedColors[] = { Qt::red, Qt::yellow, Qt::green, Qt::cyan, Qt::blue, Qt::magenta };
-const int KateTabButton::s_colorCount = 6;
-int KateTabButton::s_currentColor = 0;
-
KateTabButton::KateTabButton(const QString &text, QWidget *parent)
: QAbstractButton(parent)
, m_geometryAnimation(0)
{
- setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
setCheckable(true);
setFocusPolicy(Qt::NoFocus);
@@ -110,7 +104,7 @@
m_closeButton = new TabCloseButton(this);
QHBoxLayout * hbox = new QHBoxLayout(this);
hbox->setSpacing(0);
- hbox->setContentsMargins(0, 0, margin, 0);
+ hbox->setContentsMargins(margin, 0, margin, 0);
hbox->addStretch();
hbox->addWidget(m_closeButton);
setLayout(hbox);
@@ -139,31 +133,26 @@
barColor = QColor(g, g, g);
}
+ // compute sane margins
+ const int margin = style()->pixelMetric(QStyle::PM_ButtonMargin, 0, this);
+ const int barMargin = margin / 2;
+ const int barHeight = ceil(height() / 10.0);
+
QPainter p(this);
- // paint background rect
- if (isChecked() || underMouse()) {
- QStyleOptionViewItemV4 option;
- option.initFrom(this);
- barColor.setAlpha(50);
- option.backgroundBrush = barColor;
- option.state = QStyle::State_Enabled | QStyle::State_MouseOver;
- option.viewItemPosition = QStyleOptionViewItemV4::OnlyOne;
- style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, &p, this);
+ // paint bar if inactive but hovered
+ if (!isChecked() && underMouse()) {
+ barColor.setAlpha(80);
+ p.fillRect(QRect(barMargin, height() - barHeight, width() - 2 * barMargin, barHeight), barColor);
}
// paint bar
if (isChecked()) {
barColor.setAlpha(255);
- p.fillRect(QRect(0, height() - 3, width(), 10), barColor);
- } else if (m_highlightColor.isValid()) {
- p.setOpacity(0.3);
- p.fillRect(QRect(0, height() - 3, width(), 10), m_highlightColor);
- p.setOpacity(1.0);
+ p.fillRect(QRect(barMargin, height() - barHeight, width() - 2 * barMargin, barHeight), barColor);
}
// icon, if applicable
- const int margin = style()->pixelMetric(QStyle::PM_ButtonMargin, 0, this);
int leftMargin = margin;
if (! icon().isNull()) {
const int y = (height() - 16) / 2;
@@ -184,83 +173,10 @@
style()->drawItemText(&p, textRect, Qt::AlignHCenter | Qt::AlignVCenter, pal, true, elidedText);
}
-void KateTabButton::contextMenuEvent(QContextMenuEvent *ev)
-{
- QPixmap colorIcon(22, 22);
- QMenu menu(/*text(),*/ this);
- QMenu *colorMenu = menu.addMenu(i18n("&Highlight Tab"));
- QAction *aNone = colorMenu->addAction(i18n("&None"));
- colorMenu->addSeparator();
- colorIcon.fill(Qt::red);
- QAction *aRed = colorMenu->addAction(colorIcon, i18n("&Red"));
- colorIcon.fill(Qt::yellow);
- QAction *aYellow = colorMenu->addAction(colorIcon, i18n("&Yellow"));
- colorIcon.fill(Qt::green);
- QAction *aGreen = colorMenu->addAction(colorIcon, i18n("&Green"));
- colorIcon.fill(Qt::cyan);
- QAction *aCyan = colorMenu->addAction(colorIcon, i18n("&Cyan"));
- colorIcon.fill(Qt::blue);
- QAction *aBlue = colorMenu->addAction(colorIcon, i18n("&Blue"));
- colorIcon.fill(Qt::magenta);
- QAction *aMagenta = colorMenu->addAction(colorIcon, i18n("&Magenta"));
- colorMenu->addSeparator();
- QAction *aCustomColor = colorMenu->addAction(
- QIcon::fromTheme(QStringLiteral("colors")), i18n("C&ustom Color..."));
- menu.addSeparator();
-
- QAction *aCloseTab = menu.addAction(i18n("&Close Document"));
-
- QAction *choice = menu.exec(ev->globalPos());
-
- // process the result
- if (choice == aNone) {
- if (m_highlightColor.isValid()) {
- setHighlightColor(QColor());
- emit highlightChanged(this);
- }
- } else if (choice == aRed) {
- setHighlightColor(Qt::red);
- emit highlightChanged(this);
- } else if (choice == aYellow) {
- setHighlightColor(Qt::yellow);
- emit highlightChanged(this);
- } else if (choice == aGreen) {
- setHighlightColor(Qt::green);
- emit highlightChanged(this);
- } else if (choice == aCyan) {
- setHighlightColor(Qt::cyan);
- emit highlightChanged(this);
- } else if (choice == aBlue) {
- setHighlightColor(Qt::blue);
- emit highlightChanged(this);
- } else if (choice == aMagenta) {
- setHighlightColor(Qt::magenta);
- emit highlightChanged(this);
- } else if (choice == aCustomColor) {
- QColor newColor = QColorDialog::getColor(m_highlightColor, this);
- if (newColor.isValid()) {
- setHighlightColor(newColor);
- emit highlightChanged(this);
- }
- } else if (choice == aCloseTab) {
- emit closeRequest(this);
- }
-}
-
void KateTabButton::mousePressEvent(QMouseEvent *ev)
{
ev->accept();
- if (ev->button() == Qt::MidButton) {
- if (ev->modifiers() & Qt::ControlModifier) {
- // clear tab highlight
- setHighlightColor(QColor());
- } else {
- setHighlightColor(s_predefinedColors[s_currentColor]);
- if (++s_currentColor >= s_colorCount) {
- s_currentColor = 0;
- }
- }
- } else if (ev->button() == Qt::LeftButton) {
+ if (ev->button() == Qt::LeftButton) {
if (! isChecked()) {
// make sure we stay checked
setChecked(true);
@@ -290,20 +206,19 @@
QAbstractButton::leaveEvent(event);
}
-void KateTabButton::setHighlightColor(const QColor &color)
+void KateTabButton::moveEvent(QMoveEvent *event)
{
- if (color.isValid()) {
- m_highlightColor = color;
- update();
- } else if (m_highlightColor.isValid()) {
- m_highlightColor = QColor();
- update();
+ // tell the tabbar to redraw its separators. Since the separators overlap
+ // the tab buttons geometry, we need to adjust the width by the separator's
+ // width to avoid artifacts
+ if (parentWidget()) {
+ const int w = style()->pixelMetric(QStyle::PM_ToolBarSeparatorExtent, 0, this);
+ QRect rect = geometry();
+ rect.moveLeft(event->oldPos().x());
+ rect.adjust(-w, 0, w, 0);
+ parentWidget()->update(rect);
}
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/katetabbutton.h
^
|
@@ -22,7 +22,6 @@
#define KATE_TAB_BUTTON
#include <QAbstractButton>
-#include "katetabbar.h"
class QPropertyAnimation;
@@ -65,23 +64,14 @@
virtual ~KateTabButton();
/**
- * Set the highlighted state. If @p color.isValid() is \e false the
- * button is not highlighted. This does \e not emit the signal
- * @p highlightChanged().
- * @param color the color
- */
- void setHighlightColor(const QColor &color);
-
- /**
- * Get the highlight color. If the button is not highlighted then the color
- * is invalid, i.e. \p QColor::isValid() returns \e flase.
+ * Returns @e true, if the tabbar is the currently active tab bar.
*/
- QColor highlightColor() const;
+ bool isActiveViewSpace() const;
/**
- * Returns @e true, if the tabbar is the currently active tab bar.
+ * Check whether a geometry animation is running.
*/
- bool isActiveViewSpace() const;
+ bool geometryAnimationRunning() const;
public Q_SLOTS:
/**
@@ -99,13 +89,6 @@
void activated(KateTabButton *tabbutton);
/**
- * Emitted whenever the user changes the highlighted state. This can be
- * done only via the context menu.
- * @param tabbutton the changed button (this)
- */
- void highlightChanged(KateTabButton *tabbutton);
-
- /**
* Emitted whenever the user wants to close the tab button.
* @param tabbutton the button that emitted this signal
*/
@@ -117,8 +100,6 @@
protected:
/** paint eyecandy rectangles around the button */
void paintEvent(QPaintEvent *ev) Q_DECL_OVERRIDE;
- /** support for context menu */
- void contextMenuEvent(QContextMenuEvent *ev) Q_DECL_OVERRIDE;
/** middle mouse button changes color */
void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
/** eat double click events */
@@ -127,16 +108,12 @@
void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
/** trigger repaint on hover leave event */
void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
+ /** track geometry changes to trigger proper repaint*/
+ void moveEvent(QMoveEvent *event) Q_DECL_OVERRIDE;
private:
TabCloseButton * m_closeButton;
QPropertyAnimation * m_geometryAnimation;
-
- QColor m_highlightColor;
-
- static QColor s_predefinedColors[6];
- static const int s_colorCount;
- static int s_currentColor;
};
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/kateviewmanager.cpp
^
|
@@ -23,25 +23,19 @@
#include "kateapp.h"
#include "katemainwindow.h"
-#include "katedocmanager.h"
#include "kateviewspace.h"
#include "kateupdatedisabler.h"
-#include "katedebug.h"
#include <KTextEditor/View>
#include <KTextEditor/Document>
#include <KTextEditor/Attribute>
#include <KActionCollection>
-#include <KEncodingFileDialog>
-#include <KIconLoader>
#include <KToolBar>
#include <KMessageBox>
#include <KRecentFilesAction>
#include <KConfig>
#include <KConfigGroup>
-#include <KStandardAction>
-#include <KStandardShortcut>
#include <KLocalizedString>
#include <KXMLGUIFactory>
@@ -49,6 +43,7 @@
#include <kactivities/resourceinstance.h>
#endif
+#include <QFileDialog>
#include <QStyle>
//END Includes
@@ -131,7 +126,7 @@
m_splitViewVert = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_vert"));
m_splitViewVert->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right")));
m_splitViewVert->setText(i18n("Split Ve&rtical"));
- m_splitViewVert->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_L);
+ m_mainWindow->actionCollection()->setDefaultShortcut(m_splitViewVert, Qt::CTRL + Qt::SHIFT + Qt::Key_L);
connect(m_splitViewVert, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceVert()));
m_splitViewVert->setWhatsThis(i18n("Split the currently active view vertically into two views."));
@@ -139,7 +134,7 @@
m_splitViewHoriz = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_horiz"));
m_splitViewHoriz->setIcon(QIcon::fromTheme(QStringLiteral("view-split-top-bottom")));
m_splitViewHoriz->setText(i18n("Split &Horizontal"));
- m_splitViewHoriz->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T);
+ m_mainWindow->actionCollection()->setDefaultShortcut(m_splitViewHoriz, Qt::CTRL + Qt::SHIFT + Qt::Key_T);
connect(m_splitViewHoriz, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceHoriz()));
m_splitViewHoriz->setWhatsThis(i18n("Split the currently active view horizontally into two views."));
@@ -147,7 +142,7 @@
m_closeView = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_close_current_space"));
m_closeView->setIcon(QIcon::fromTheme(QStringLiteral("view-close")));
m_closeView->setText(i18n("Cl&ose Current View"));
- m_closeView->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_R);
+ m_mainWindow->actionCollection()->setDefaultShortcut(m_closeView, Qt::CTRL + Qt::SHIFT + Qt::Key_R);
connect(m_closeView, SIGNAL(triggered()), this, SLOT(slotCloseCurrentViewSpace()), Qt::QueuedConnection);
m_closeView->setWhatsThis(i18n("Close the currently active split view"));
@@ -167,16 +162,22 @@
m_hideOtherViews->setWhatsThis(i18n("Hide every view but the active one"));
+ m_toggleSplitterOrientation = m_mainWindow->actionCollection()->addAction(QStringLiteral("view_split_toggle"));
+ m_toggleSplitterOrientation->setText(i18n("Toggle Orientation"));
+ connect(m_toggleSplitterOrientation, SIGNAL(triggered()), this, SLOT(toggleSplitterOrientation()), Qt::QueuedConnection);
+
+ m_toggleSplitterOrientation->setWhatsThis(i18n("Toggles the orientation of the current split view"));
+
goNext = m_mainWindow->actionCollection()->addAction(QStringLiteral("go_next_split_view"));
goNext->setText(i18n("Next Split View"));
- goNext->setShortcut(Qt::Key_F8);
+ m_mainWindow->actionCollection()->setDefaultShortcut(goNext, Qt::Key_F8);
connect(goNext, SIGNAL(triggered()), this, SLOT(activateNextView()));
goNext->setWhatsThis(i18n("Make the next split view the active one."));
goPrev = m_mainWindow->actionCollection()->addAction(QStringLiteral("go_prev_split_view"));
goPrev->setText(i18n("Previous Split View"));
- goPrev->setShortcut(Qt::SHIFT + Qt::Key_F8);
+ m_mainWindow->actionCollection()->setDefaultShortcut(goPrev, Qt::SHIFT + Qt::Key_F8);
connect(goPrev, SIGNAL(triggered()), this, SLOT(activatePrevView()));
goPrev->setWhatsThis(i18n("Make the previous split view the active one."));
@@ -210,6 +211,7 @@
{
m_closeView->setEnabled(m_viewSpaceList.count() > 1);
m_closeOtherViews->setEnabled(m_viewSpaceList.count() > 1);
+ m_toggleSplitterOrientation->setEnabled(m_viewSpaceList.count() > 1);
goNext->setEnabled(m_viewSpaceList.count() > 1);
goPrev->setEnabled(m_viewSpaceList.count() > 1);
}
@@ -226,17 +228,13 @@
return;
}
- KEncodingFileDialog::Result r = KEncodingFileDialog::getOpenUrlsAndEncoding(
- KTextEditor::Editor::instance()->defaultEncoding(),
- cv->document()->url(),
- QString(), m_mainWindow, i18n("Open File"));
-
KateDocumentInfo docInfo;
docInfo.openedByUser = true;
QString fileList;
- foreach(const QUrl & url, r.URLs) {
+ const QList<QUrl> urls = QFileDialog::getOpenFileUrls(m_mainWindow, i18n("Open File"), cv->document()->url());
+ Q_FOREACH(const QUrl & url, urls) {
qint64 size = QFile(url.toLocalFile()).size();
if (size > FileSizeAboveToAskUserIfProceedWithOpen) {
@@ -253,7 +251,7 @@
}
}
- KTextEditor::Document *lastID = openUrls(r.URLs, r.encoding, false, docInfo);
+ KTextEditor::Document *lastID = openUrls(urls, QString(), false, docInfo);
if (lastID) {
activateView(lastID);
@@ -811,6 +809,30 @@
removeViewSpace(space);
}
+void KateViewManager::toggleSplitterOrientation()
+{
+ KateViewSpace *vs = activeViewSpace();
+ if (!vs) {
+ return;
+ }
+
+ // get current splitter, and abort if null
+ QSplitter *currentSplitter = qobject_cast<QSplitter *>(vs->parentWidget());
+ if (!currentSplitter || (currentSplitter->count() == 1)) {
+ return;
+ }
+
+ // avoid flicker
+ KateUpdateDisabler disableUpdates (mainWindow());
+
+ // toggle orientation
+ if (currentSplitter->orientation() == Qt::Horizontal) {
+ currentSplitter->setOrientation(Qt::Vertical);
+ } else {
+ currentSplitter->setOrientation(Qt::Horizontal);
+ }
+}
+
bool KateViewManager::viewsInSameViewSpace(KTextEditor::View *view1,
KTextEditor::View *view2)
{
@@ -943,6 +965,7 @@
m_splitViewHoriz->setDisabled(hideOthers);
m_closeView->setDisabled(hideOthers);
m_closeOtherViews->setDisabled(hideOthers);
+ m_toggleSplitterOrientation->setDisabled(hideOthers);
}
/**
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/kateviewmanager.h
^
|
@@ -23,9 +23,6 @@
#include "katedocmanager.h"
-#include <ktexteditor/view.h>
-#include <ktexteditor/document.h>
-
#include <QPointer>
#include <QList>
#include <QSplitter>
@@ -35,10 +32,15 @@
#ifdef KActivities_FOUND
namespace KActivities
{
-class ResourceInstance;
+ class ResourceInstance;
}
#endif
+namespace KTextEditor {
+ class View;
+ class Document;
+}
+
class KateDocumentInfo;
class KConfigGroup;
@@ -242,6 +244,11 @@
void slotHideOtherViews(bool hideOthers);
void reactivateActiveView();
+
+ /**
+ * Toogle the orientation of current split view
+ */
+ void toggleSplitterOrientation();
/**
* central storage of all views known in the view manager
@@ -260,6 +267,7 @@
QAction *m_splitViewHoriz;
QAction *m_closeView;
QAction *m_closeOtherViews;
+ QAction *m_toggleSplitterOrientation;
QAction *m_hideOtherViews;
QAction *goNext;
QAction *goPrev;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/kateviewspace.cpp
^
|
@@ -29,14 +29,14 @@
#include "kactioncollection.h"
#include "kateupdatedisabler.h"
-#include <KLocalizedString>
-#include <KConfigGroup>
#include <KAcceleratorManager>
+#include <KConfigGroup>
+#include <KLocalizedString>
-#include <QToolButton>
-#include <QMouseEvent>
-#include <QStackedWidget>
#include <QHelpEvent>
+#include <QMenu>
+#include <QStackedWidget>
+#include <QToolButton>
#include <QToolTip>
#include <QWhatsThis>
@@ -61,7 +61,8 @@
connect(m_tabBar, &KateTabBar::currentChanged, this, &KateViewSpace::changeView);
connect(m_tabBar, &KateTabBar::moreTabsRequested, this, &KateViewSpace::addTabs);
connect(m_tabBar, &KateTabBar::lessTabsRequested, this, &KateViewSpace::removeTabs);
- connect(m_tabBar, &KateTabBar::closeTabRequested, this, &KateViewSpace::closeTabRequest);
+ connect(m_tabBar, &KateTabBar::closeTabRequested, this, &KateViewSpace::closeTabRequest, Qt::QueuedConnection);
+ connect(m_tabBar, &KateTabBar::contextMenuRequest, this, &KateViewSpace::showContextMenu, Qt::QueuedConnection);
connect(m_tabBar, &KateTabBar::newTabRequested, this, &KateViewSpace::createNewDocument);
connect(m_tabBar, SIGNAL(activateViewSpaceRequested()), this, SLOT(makeActive()));
hLayout->addWidget(m_tabBar);
@@ -278,7 +279,7 @@
// we need to subtract by 1 more, as we just added ourself to the end of the lru list!
KTextEditor::Document * docToHide = m_lruDocList[m_lruDocList.size() - m_tabBar->maxTabCount() - 1];
Q_ASSERT(m_docToTabId.contains(docToHide));
- const int insertIndex = removeTab(docToHide);
+ const int insertIndex = removeTab(docToHide, false);
// add new one at removed position
insertTab(insertIndex, document);
@@ -352,7 +353,7 @@
this, SLOT(updateDocumentState(KTextEditor::Document*)));
}
-int KateViewSpace::removeTab(KTextEditor::Document * doc)
+int KateViewSpace::removeTab(KTextEditor::Document * doc, bool documentDestroyed)
{
//
// WARNING: removeTab() is also called from documentDestroyed().
@@ -366,10 +367,12 @@
const int removeIndex = m_tabBar->removeTab(id);
m_docToTabId.remove(doc);
- disconnect(doc, SIGNAL(documentNameChanged(KTextEditor::Document*)),
+ if (!documentDestroyed) {
+ disconnect(doc, SIGNAL(documentNameChanged(KTextEditor::Document*)),
this, SLOT(updateDocumentName(KTextEditor::Document*)));
- disconnect(doc, SIGNAL(modifiedChanged(KTextEditor::Document*)),
+ disconnect(doc, SIGNAL(modifiedChanged(KTextEditor::Document*)),
this, SLOT(updateDocumentState(KTextEditor::Document*)));
+ }
return removeIndex;
}
@@ -382,7 +385,7 @@
while (count > 0) {
const int tabCount = m_tabBar->count();
KTextEditor::Document * removeDoc = m_lruDocList[m_lruDocList.size() - tabCount];
- removeTab(removeDoc);
+ removeTab(removeDoc, false);
Q_ASSERT(! m_docToTabId.contains(removeDoc));
--count;
}
@@ -438,7 +441,7 @@
KTextEditor::Document * docToHide = m_lruDocList[m_lruDocList.size() - m_tabBar->maxTabCount() - 1];
Q_ASSERT(m_docToTabId.contains(docToHide));
- const int insertIndex = removeTab(docToHide);
+ const int insertIndex = removeTab(docToHide, false);
// add new one at removed position
insertTab(insertIndex, doc);
@@ -458,7 +461,7 @@
// case: there was no view created yet, but still a button was added
if (m_docToTabId.contains(invalidDoc)) {
- const int insertIndex = removeTab(invalidDoc);
+ const int insertIndex = removeTab(invalidDoc, true);
// maybe show another tab button in its stead
if (m_lruDocList.size() >= m_tabBar->maxTabCount()
&& m_tabBar->count() < m_tabBar->maxTabCount()
@@ -531,6 +534,22 @@
}
}
+void KateViewSpace::focusPrevTab()
+{
+ const int id = m_tabBar->prevTab();
+ if (id >= 0) {
+ changeView(id);
+ }
+}
+
+void KateViewSpace::focusNextTab()
+{
+ const int id = m_tabBar->nextTab();
+ if (id >= 0) {
+ changeView(id);
+ }
+}
+
int KateViewSpace::hiddenDocuments() const
{
const int hiddenDocs = KateApp::self()->documents().count() - m_tabBar->count();
@@ -538,6 +557,31 @@
return hiddenDocs;
}
+void KateViewSpace::showContextMenu(int id, const QPoint & globalPos)
+{
+ // right now, show no context menu on empty tab bar space
+ if (id < 0) {
+ return;
+ }
+
+ QMenu menu(this);
+ QAction *aCloseTab = menu.addAction(i18n("&Close Document"));
+ QAction *aCloseOthers = menu.addAction(i18n("&Close Other Documents"));
+ if (KateApp::self()->documentManager()->documentList().count() < 2) {
+ aCloseOthers->setEnabled(false);
+ }
+
+ QAction *choice = menu.exec(globalPos);
+
+ if (choice == aCloseTab) {
+ closeTabRequest(id);
+ } else if (choice == aCloseOthers) {
+ KTextEditor::Document *doc = m_docToTabId.key(id);
+ Q_ASSERT(doc);
+ KateApp::self()->documentManager()->closeOtherDocuments(doc);
+ }
+}
+
void KateViewSpace::saveConfig(KConfigBase *config, int myIndex , const QString &viewConfGrp)
{
// qCDebug(LOG_KATE)<<"KateViewSpace::saveConfig("<<myIndex<<", "<<viewConfGrp<<") - currentView: "<<currentView()<<")";
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/kateviewspace.h
^
|
@@ -26,14 +26,11 @@
#include <ktexteditor/modificationinterface.h>
#include <QHash>
-#include <QList>
#include <QWidget>
class KConfigBase;
class KateViewManager;
-class KateViewSpace;
class QStackedWidget;
-class QLabel;
class QToolButton;
class KateTabBar;
@@ -96,6 +93,16 @@
*/
bool eventFilter(QObject *obj, QEvent *event);
+ /**
+ * Focus the previous tab in the tabbar.
+ */
+ void focusPrevTab();
+
+ /**
+ * Focus the next tab in the tabbar.
+ */
+ void focusNextTab();
+
public Q_SLOTS:
void documentDestroyed(QObject *doc);
void updateDocumentName(KTextEditor::Document *doc);
@@ -122,7 +129,7 @@
* Remove tab for @p doc, and return the index (position)
* of the removed tab.
*/
- int removeTab(KTextEditor::Document * doc);
+ int removeTab(KTextEditor::Document * doc, bool documentDestroyed);
/**
* Remove @p count tabs, since the tab bar shrinked.
@@ -141,6 +148,15 @@
void closeTabRequest(int id);
/**
+ * This slot is called when the context menu is requested for button
+ * @p id at position @p globalPos.
+ * @param id the button, or -1 if the context menu was requested on
+ * at a place where no tab exists
+ * @param globalPos the position of the context menu in global coordinates
+ */
+ void showContextMenu(int id, const QPoint & globalPos);
+
+ /**
* Called to create a new empty document.
*/
void createNewDocument();
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/main.cpp
^
|
@@ -107,6 +107,11 @@
app.setQuitOnLastWindowClosed(false);
/**
+ * set the program icon
+ */
+ QApplication::setWindowIcon(QIcon::fromTheme(QLatin1String("kate")));
+
+ /**
* Create command line parser and feed it with known options
*/
QCommandLineParser parser;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/session/katesessionmanager.cpp
^
|
@@ -29,7 +29,6 @@
#include "kateapp.h"
#include "katepluginmanager.h"
#include "katerunninginstanceinfo.h"
-#include "katedebug.h"
#include <KConfigGroup>
#include <KSharedConfig>
@@ -58,8 +57,8 @@
m_sessionsDir = sessionsDir;
}
- QDir().mkpath(m_sessionsDir); // create dir if needed
- qCDebug(LOG_KATE) << "LOCAL SESSION DIR: " << m_sessionsDir;
+ // create dir if needed
+ QDir().mkpath(m_sessionsDir);
m_dirWatch = new KDirWatch(this);
m_dirWatch->addDir(m_sessionsDir);
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kate/src/ui/sessionconfigwidget.ui
^
|
@@ -11,6 +11,18 @@
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
<item>
<widget class="QGroupBox" name="gbElements">
<property name="title">
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kwrite/kwrite.cpp
^
|
@@ -29,7 +29,6 @@
#include <KActionCollection>
#include <KToggleAction>
#include <KEditToolBar>
-#include <KEncodingFileDialog>
#include <KLocalizedString>
#include <KMessageBox>
#include <KRecentFilesAction>
@@ -54,6 +53,8 @@
#include <QLabel>
#include <QDragEnterEvent>
#include <QMenuBar>
+#include <QDir>
+#include <QFileDialog>
QList<KTextEditor::Document *> KWrite::docList;
QList<KWrite *> KWrite::winList;
@@ -231,9 +232,8 @@
void KWrite::slotOpen()
{
- const KEncodingFileDialog::Result r = KEncodingFileDialog::getOpenUrlsAndEncoding(KTextEditor::Editor::instance()->defaultEncoding(), m_view->document()->url(), QString(), this, i18n("Open File"));
- Q_FOREACH(QUrl url, r.URLs) {
- encoding = r.encoding;
+ const QList<QUrl> urls = QFileDialog::getOpenFileUrls(this, i18n("Open File"), m_view->document()->url());
+ Q_FOREACH(QUrl url, urls) {
slotOpen(url);
}
}
@@ -253,10 +253,8 @@
if (m_view->document()->isModified() || !m_view->document()->url().isEmpty()) {
KWrite *t = new KWrite();
- t->m_view->document()->setEncoding(encoding);
t->loadURL(url);
} else {
- m_view->document()->setEncoding(encoding);
loadURL(url);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kwrite/kwrite.h
^
|
@@ -133,8 +133,6 @@
KActivities::ResourceInstance *m_activityResource;
#endif
- QString encoding;
-
static QList<KTextEditor::Document *> docList;
static QList<KWrite *> winList;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kwrite/main.cpp
^
|
@@ -89,7 +89,9 @@
aboutData.addCredit(i18n("Carsten Pfeiffer"), i18nc("Credit text for someone that helped a lot", "Very nice help"));
aboutData.addCredit(i18n("All people who have contributed and I have forgotten to mention"));
- aboutData.setProgramIconName(QStringLiteral("accessories-text-editor"));
+ /**
+ * bugzilla
+ */
aboutData.setProductName(QByteArray("kate/kwrite"));
/**
@@ -106,6 +108,11 @@
app.setApplicationVersion(aboutData.version());
/**
+ * set the program icon
+ */
+ QApplication::setWindowIcon(QIcon::fromTheme(QLatin1String("accessories-text-editor")));
+
+ /**
* Create command line parser and feed it with known options
*/
QCommandLineParser parser;
|
[-]
[+]
|
Changed |
_service:tar_git:kate-5.0.0+master.5.9486d43.tar.xz/upstream/kwrite/org.kde.kwrite.desktop
^
|
@@ -51,6 +51,7 @@
GenericName[tr]=Metin Düzenleyici
GenericName[ug]=تېكىست تەھرىرلىگۈچ
GenericName[uk]=Текстовий редактор
+GenericName[vi]=Trình biên tập văn bản
GenericName[x-test]=xxText Editorxx
GenericName[zh_CN]=文本编辑器
GenericName[zh_TW]=文字編輯器
@@ -105,6 +106,7 @@
Name[tr]=KWrite
Name[ug]=KWrite
Name[uk]=KWrite
+Name[vi]=KWrite
Name[x-test]=xxKWritexx
Name[zh_CN]=KWrite
Name[zh_TW]=KWrite
|