mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kate: drop hellowword, openheader and tabbarextension plugins
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f9dd7a42e8
commit
a48ec8ca13
38 changed files with 0 additions and 5423 deletions
|
@ -10,18 +10,12 @@ add_subdirectory(konsole)
|
|||
add_subdirectory(filebrowser)
|
||||
add_subdirectory(mailfiles)
|
||||
|
||||
add_subdirectory(tabbarextension)
|
||||
|
||||
add_subdirectory(filetemplates)
|
||||
|
||||
add_subdirectory(kate-ctags)
|
||||
add_subdirectory(katebuild-plugin)
|
||||
add_subdirectory(search)
|
||||
|
||||
add_subdirectory(openheader)
|
||||
|
||||
add_subdirectory(tabify)
|
||||
|
||||
add_subdirectory(close-except-like)
|
||||
|
||||
add_subdirectory(project)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; hl C++/Qt4;
|
|
@ -1,33 +0,0 @@
|
|||
set(VERSION_MAJOR 0)
|
||||
set(VERSION_MINOR 3)
|
||||
set(VERSION_PATCH 5)
|
||||
set(VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
|
||||
|
||||
set(KATE_CLOSE_EXCEPT_PLUGIN_SOURCES
|
||||
close_confirm_dialog.cpp
|
||||
close_except_plugin.cpp
|
||||
)
|
||||
|
||||
kde4_add_plugin(katecloseexceptplugin ${KATE_CLOSE_EXCEPT_PLUGIN_SOURCES})
|
||||
|
||||
target_link_libraries(katecloseexceptplugin
|
||||
KDE4::kdeui
|
||||
KDE4::kfile
|
||||
KDE4::ktexteditor
|
||||
kateinterfaces
|
||||
)
|
||||
|
||||
configure_file(config.h.in config.h)
|
||||
|
||||
install(
|
||||
TARGETS katecloseexceptplugin
|
||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
||||
)
|
||||
install(
|
||||
FILES ui.rc
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kate/plugins/katecloseexceptplugin
|
||||
)
|
||||
install(
|
||||
FILES katecloseexceptplugin.desktop
|
||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
||||
)
|
|
@ -1,2 +0,0 @@
|
|||
#! /bin/sh
|
||||
$XGETTEXT *.cpp -o $podir/katecloseexceptplugin.pot
|
|
@ -1,138 +0,0 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Class \c kate::CloseConfirmDialog (implementation)
|
||||
*
|
||||
* Copyright (C) 2012 Alex Turbov <i.zaufi@gmail.com>
|
||||
*
|
||||
* \date Sun Jun 24 16:29:13 MSK 2012 -- Initial design
|
||||
*/
|
||||
/*
|
||||
* KateCloseExceptPlugin 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* KateCloseExceptPlugin 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/>.
|
||||
*/
|
||||
|
||||
// Project specific includes
|
||||
#include "close_confirm_dialog.h"
|
||||
|
||||
// Standard includes
|
||||
#include <KConfig>
|
||||
#include <KLocalizedString> /// \todo Where is \c i18n() defiend?
|
||||
#include <KVBox>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <cassert>
|
||||
|
||||
namespace kate { namespace {
|
||||
|
||||
class KateDocItem : public QTreeWidgetItem
|
||||
{
|
||||
public:
|
||||
KateDocItem(KTextEditor::Document* doc, QTreeWidget* tw)
|
||||
: QTreeWidgetItem(tw)
|
||||
, document(doc)
|
||||
{
|
||||
setText(0, doc->documentName());
|
||||
setText(1, doc->url().prettyUrl());
|
||||
setCheckState(0, Qt::Checked);
|
||||
}
|
||||
KTextEditor::Document* document;
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
CloseConfirmDialog::CloseConfirmDialog(
|
||||
QList<KTextEditor::Document*>& docs
|
||||
, KToggleAction* show_confirmation_action
|
||||
, QWidget* const parent
|
||||
)
|
||||
: KDialog(parent)
|
||||
, m_docs(docs)
|
||||
{
|
||||
assert("Documents container expected to be non empty" && !docs.isEmpty());
|
||||
|
||||
setCaption(i18nc("@title:window", "Close files confirmation"));
|
||||
setButtons(Ok | Cancel);
|
||||
setModal(true);
|
||||
setDefaultButton(KDialog::Ok);
|
||||
|
||||
KVBox* w = new KVBox(this);
|
||||
setMainWidget(w);
|
||||
w->setSpacing(KDialog::spacingHint());
|
||||
|
||||
KHBox* lo1 = new KHBox(w);
|
||||
|
||||
// dialog text
|
||||
QLabel* icon = new QLabel(lo1);
|
||||
icon->setPixmap(DesktopIcon("dialog-warning"));
|
||||
|
||||
QLabel* t = new QLabel(
|
||||
i18nc("@label:listbox", "You are about to close the following documents:")
|
||||
, lo1
|
||||
);
|
||||
lo1->setStretchFactor(t, 1000);
|
||||
|
||||
// document list
|
||||
m_docs_tree = new QTreeWidget(w);
|
||||
QStringList headers;
|
||||
headers << i18nc("@title:column", "Document") << i18nc("@title:column", "Location");
|
||||
m_docs_tree->setHeaderLabels(headers);
|
||||
m_docs_tree->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_docs_tree->setRootIsDecorated(false);
|
||||
|
||||
for (int i = 0; i < m_docs.size(); i++)
|
||||
{
|
||||
new KateDocItem(m_docs[i], m_docs_tree);
|
||||
}
|
||||
m_docs_tree->header()->setStretchLastSection(false);
|
||||
m_docs_tree->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||
m_docs_tree->header()->setResizeMode(1, QHeaderView::ResizeToContents);
|
||||
|
||||
m_dont_ask_again = new QCheckBox(i18nc("option:check", "Do not ask again"), w);
|
||||
// NOTE If we are here, it means that 'Show Confirmation' action is enabled,
|
||||
// so not needed to read config...
|
||||
assert("Sanity check" && show_confirmation_action->isChecked());
|
||||
m_dont_ask_again->setCheckState(Qt::Unchecked);
|
||||
connect(m_dont_ask_again, SIGNAL(toggled(bool)), show_confirmation_action, SLOT(toggle()));
|
||||
|
||||
// Update documents list according checkboxes
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(updateDocsList()));
|
||||
|
||||
KConfigGroup gcg(KGlobal::config(), "CloseConfirmationDialog");
|
||||
restoreDialogSize(gcg); // restore dialog geometry from config
|
||||
}
|
||||
|
||||
CloseConfirmDialog::~CloseConfirmDialog()
|
||||
{
|
||||
KConfigGroup gcg(KGlobal::config(), "CloseConfirmationDialog");
|
||||
saveDialogSize(gcg); // write dialog geometry to config
|
||||
gcg.sync();
|
||||
}
|
||||
|
||||
/**
|
||||
* Going to remove unchecked files from the given documents list
|
||||
*/
|
||||
void CloseConfirmDialog::updateDocsList()
|
||||
{
|
||||
for (
|
||||
QTreeWidgetItemIterator it(m_docs_tree, QTreeWidgetItemIterator::NotChecked)
|
||||
; *it
|
||||
; ++it
|
||||
)
|
||||
{
|
||||
KateDocItem* item = static_cast<KateDocItem*>(*it);
|
||||
m_docs.removeAll(item->document);
|
||||
kDebug() << "do not close the file " << item->document->url().prettyUrl();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace kate
|
|
@ -1,64 +0,0 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Class \c kate::CloseConfirmDialog (interface)
|
||||
*
|
||||
* Copyright (C) 2012 Alex Turbov <i.zaufi@gmail.com>
|
||||
*
|
||||
* \date Sun Jun 24 16:29:13 MSK 2012 -- Initial design
|
||||
*/
|
||||
/*
|
||||
* KateCloseExceptPlugin 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* KateCloseExceptPlugin 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 __SRC__CLOSE_CONFIRM_DIALOG_H__
|
||||
# define __SRC__CLOSE_CONFIRM_DIALOG_H__
|
||||
|
||||
// Project specific includes
|
||||
|
||||
// Standard includes
|
||||
# include <KDialog>
|
||||
# include <KTextEditor/Document>
|
||||
# include <KToggleAction>
|
||||
# include <QtCore/QList>
|
||||
# include <QtGui/QTreeWidget>
|
||||
# include <QtGui/QCheckBox>
|
||||
|
||||
namespace kate {
|
||||
|
||||
/**
|
||||
* \brief [Type brief class description here]
|
||||
*
|
||||
* [More detailed description here]
|
||||
*
|
||||
*/
|
||||
class CloseConfirmDialog : public KDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/// Default constructor
|
||||
explicit CloseConfirmDialog(QList<KTextEditor::Document*>&, KToggleAction*, QWidget* const = 0);
|
||||
~CloseConfirmDialog();
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateDocsList();
|
||||
|
||||
private:
|
||||
QList<KTextEditor::Document*>& m_docs;
|
||||
QTreeWidget* m_docs_tree;
|
||||
QCheckBox* m_dont_ask_again;
|
||||
};
|
||||
|
||||
} // namespace kate
|
||||
#endif // __SRC__CLOSE_CONFIRM_DIALOG_H__
|
|
@ -1,350 +0,0 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Kate Close Except/Like plugin implementation
|
||||
*
|
||||
* Copyright (C) 2012 Alex Turbov <i.zaufi@gmail.com>
|
||||
*
|
||||
* \date Thu Mar 8 08:13:43 MSK 2012 -- Initial design
|
||||
*/
|
||||
/*
|
||||
* KateCloseExceptPlugin 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* KateCloseExceptPlugin 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/>.
|
||||
*/
|
||||
|
||||
// Project specific includes
|
||||
#include "config.h"
|
||||
#include "close_except_plugin.h"
|
||||
#include "close_confirm_dialog.h"
|
||||
|
||||
// Standard includes
|
||||
#include <kate/application.h>
|
||||
#include <kate/documentmanager.h>
|
||||
#include <kate/mainwindow.h>
|
||||
#include <KAboutData>
|
||||
#include <KActionCollection>
|
||||
#include <KDebug>
|
||||
#include <KPassivePopup>
|
||||
#include <KPluginFactory>
|
||||
#include <KPluginLoader>
|
||||
#include <KTextEditor/Editor>
|
||||
#include <QtCore/QFileInfo>
|
||||
|
||||
K_PLUGIN_FACTORY(CloseExceptPluginFactory, registerPlugin<kate::CloseExceptPlugin>();)
|
||||
K_EXPORT_PLUGIN(
|
||||
CloseExceptPluginFactory(
|
||||
KAboutData(
|
||||
"katecloseexceptplugin"
|
||||
, "katecloseexceptplugin"
|
||||
, ki18n("Close Except/Like Plugin")
|
||||
, PLUGIN_VERSION
|
||||
, ki18n("Close all documents started from specified path")
|
||||
, KAboutData::License_LGPL_V3
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
namespace kate {
|
||||
//BEGIN CloseExceptPlugin
|
||||
CloseExceptPlugin::CloseExceptPlugin(
|
||||
QObject* application
|
||||
, const QList<QVariant>&
|
||||
)
|
||||
: Kate::Plugin(static_cast<Kate::Application*>(application), "katecloseexceptplugin")
|
||||
{
|
||||
}
|
||||
|
||||
Kate::PluginView* CloseExceptPlugin::createView(Kate::MainWindow* parent)
|
||||
{
|
||||
return new CloseExceptPluginView(parent, CloseExceptPluginFactory::componentData(), this);
|
||||
}
|
||||
|
||||
void CloseExceptPlugin::readSessionConfig(KConfigBase* config, const QString& groupPrefix)
|
||||
{
|
||||
KConfigGroup scg(config, groupPrefix + "menu");
|
||||
m_show_confirmation_needed = scg.readEntry("ShowConfirmation", true);
|
||||
}
|
||||
|
||||
void CloseExceptPlugin::writeSessionConfig(KConfigBase* config, const QString& groupPrefix)
|
||||
{
|
||||
KConfigGroup scg(config, groupPrefix + "menu");
|
||||
scg.writeEntry("ShowConfirmation", m_show_confirmation_needed);
|
||||
scg.sync();
|
||||
}
|
||||
//END CloseExceptPlugin
|
||||
|
||||
//BEGIN CloseExceptPluginView
|
||||
CloseExceptPluginView::CloseExceptPluginView(
|
||||
Kate::MainWindow* mw
|
||||
, const KComponentData& data
|
||||
, CloseExceptPlugin* plugin
|
||||
)
|
||||
: Kate::PluginView(mw)
|
||||
, Kate::XMLGUIClient(data)
|
||||
, m_plugin(plugin)
|
||||
, m_show_confirmation_action(new KToggleAction(i18nc("@action:inmenu", "Show Confirmation"), this))
|
||||
, m_except_menu(new KActionMenu(
|
||||
i18nc("@action:inmenu close docs except the following...", "Close Except")
|
||||
, this
|
||||
))
|
||||
, m_like_menu(new KActionMenu(
|
||||
i18nc("@action:inmenu close docs like the following...", "Close Like")
|
||||
, this
|
||||
))
|
||||
{
|
||||
actionCollection()->addAction("file_close_except", m_except_menu);
|
||||
actionCollection()->addAction("file_close_like", m_like_menu);
|
||||
|
||||
// Subscribe self to document creation
|
||||
connect(
|
||||
m_plugin->application()->editor()
|
||||
, SIGNAL(documentCreated(KTextEditor::Editor*, KTextEditor::Document*))
|
||||
, this
|
||||
, SLOT(documentCreated(KTextEditor::Editor*, KTextEditor::Document*))
|
||||
);
|
||||
// Configure toggle action and connect it to update state
|
||||
m_show_confirmation_action->setChecked(m_plugin->showConfirmationNeeded());
|
||||
connect(
|
||||
m_show_confirmation_action
|
||||
, SIGNAL(toggled(bool))
|
||||
, m_plugin
|
||||
, SLOT(toggleShowConfirmation(bool))
|
||||
);
|
||||
//
|
||||
connect(
|
||||
mainWindow()
|
||||
, SIGNAL(viewCreated(KTextEditor::View*))
|
||||
, this
|
||||
, SLOT(viewCreated(KTextEditor::View*))
|
||||
);
|
||||
// Fill menu w/ currently opened document masks/groups
|
||||
updateMenu();
|
||||
|
||||
mainWindow()->guiFactory()->addClient(this);
|
||||
}
|
||||
|
||||
CloseExceptPluginView::~CloseExceptPluginView()
|
||||
{
|
||||
mainWindow()->guiFactory()->removeClient(this);
|
||||
}
|
||||
|
||||
void CloseExceptPluginView::viewCreated(KTextEditor::View* view)
|
||||
{
|
||||
connectToDocument(view->document());
|
||||
updateMenu();
|
||||
}
|
||||
|
||||
void CloseExceptPluginView::documentCreated(KTextEditor::Editor*, KTextEditor::Document* document)
|
||||
{
|
||||
connectToDocument(document);
|
||||
updateMenu();
|
||||
}
|
||||
|
||||
void CloseExceptPluginView::connectToDocument(KTextEditor::Document* document)
|
||||
{
|
||||
// Subscribe self to document close and name changes
|
||||
connect(
|
||||
document
|
||||
, SIGNAL(aboutToClose(KTextEditor::Document*))
|
||||
, this
|
||||
, SLOT(updateMenuSlotStub(KTextEditor::Document*))
|
||||
);
|
||||
connect(
|
||||
document
|
||||
, SIGNAL(documentNameChanged(KTextEditor::Document*))
|
||||
, this
|
||||
, SLOT(updateMenuSlotStub(KTextEditor::Document*))
|
||||
);
|
||||
connect(
|
||||
document
|
||||
, SIGNAL(documentUrlChanged(KTextEditor::Document*))
|
||||
, this
|
||||
, SLOT(updateMenuSlotStub(KTextEditor::Document*))
|
||||
);
|
||||
}
|
||||
|
||||
void CloseExceptPluginView::updateMenuSlotStub(KTextEditor::Document*)
|
||||
{
|
||||
updateMenu();
|
||||
}
|
||||
|
||||
void CloseExceptPluginView::appendActionsFrom(
|
||||
const QSet<QString>& paths
|
||||
, actions_map_type& actions
|
||||
, KActionMenu* menu
|
||||
, QSignalMapper* mapper
|
||||
)
|
||||
{
|
||||
Q_FOREACH(const QString& path, paths)
|
||||
{
|
||||
QString action = path.startsWith('*') ? path : path + '*';
|
||||
QPointer<KAction> kaction(new KAction(action, menu));
|
||||
actions[action] = kaction;
|
||||
menu->addAction(kaction);
|
||||
connect(kaction, SIGNAL(triggered()), mapper, SLOT(map()));
|
||||
mapper->setMapping(kaction, action);
|
||||
}
|
||||
}
|
||||
|
||||
QPointer<QSignalMapper> CloseExceptPluginView::updateMenu(
|
||||
const QSet<QString>& paths
|
||||
, const QSet<QString>& masks
|
||||
, actions_map_type& actions
|
||||
, KActionMenu* menu
|
||||
)
|
||||
{
|
||||
// turn menu ON or OFF depending on collected results
|
||||
menu->setEnabled(!paths.empty());
|
||||
|
||||
// Clear previous menus
|
||||
foreach (const QPointer<KAction> it, actions)
|
||||
{
|
||||
menu->removeAction(it);
|
||||
}
|
||||
actions.clear();
|
||||
|
||||
// Form a new one
|
||||
QPointer<QSignalMapper> mapper = QPointer<QSignalMapper>(new QSignalMapper(this));
|
||||
appendActionsFrom(paths, actions, menu, mapper);
|
||||
if (!masks.empty())
|
||||
{
|
||||
if (!paths.empty())
|
||||
menu->addSeparator(); // Add separator between paths and file's ext filters
|
||||
appendActionsFrom(masks, actions, menu, mapper);
|
||||
}
|
||||
// Append 'Show Confirmation' toggle menu item
|
||||
menu->addSeparator(); // Add separator between paths and show confirmation
|
||||
menu->addAction(m_show_confirmation_action);
|
||||
return mapper;
|
||||
}
|
||||
|
||||
void CloseExceptPluginView::updateMenu()
|
||||
{
|
||||
const QList<KTextEditor::Document*>& docs = m_plugin->application()->documentManager()->documents();
|
||||
if (docs.size() < 2)
|
||||
{
|
||||
kDebug() << "No docs r (or the only) opened right now --> disable menu";
|
||||
m_except_menu->setEnabled(false);
|
||||
m_except_menu->addSeparator();
|
||||
m_like_menu->setEnabled(false);
|
||||
m_like_menu->addSeparator();
|
||||
/// \note It seems there is always a document present... it named \em 'Untitled'
|
||||
}
|
||||
else
|
||||
{
|
||||
// Iterate over documents and form a set of candidates
|
||||
typedef QSet<QString> paths_set_type;
|
||||
paths_set_type doc_paths;
|
||||
paths_set_type masks;
|
||||
Q_FOREACH(KTextEditor::Document* document, docs)
|
||||
{
|
||||
const QString& ext = QFileInfo(document->url().path()).completeSuffix();
|
||||
if (!ext.isEmpty())
|
||||
masks.insert("*." + ext);
|
||||
doc_paths.insert(document->url().upUrl().path());
|
||||
}
|
||||
paths_set_type paths = doc_paths;
|
||||
kDebug() << "stage #1: Collected" << paths.size() << "paths and" << masks.size() << "masks";
|
||||
// Add common paths to the collection
|
||||
for (paths_set_type::iterator it = doc_paths.begin(), last = doc_paths.end(); it != last; ++it)
|
||||
{
|
||||
for (
|
||||
KUrl url = *it
|
||||
; url.hasPath() && url.path() != "/"
|
||||
; url = url.upUrl()
|
||||
)
|
||||
{
|
||||
paths_set_type::iterator not_it = it;
|
||||
for (++not_it; not_it != last; ++not_it)
|
||||
if (!not_it->startsWith(url.path()))
|
||||
break;
|
||||
if (not_it == last)
|
||||
{
|
||||
paths.insert(url.path());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
kDebug() << "stage #2: Collected" << paths.size() << "paths and" << masks.size() << "masks";
|
||||
//
|
||||
m_except_mapper = updateMenu(paths, masks, m_except_actions, m_except_menu);
|
||||
m_like_mapper = updateMenu(paths, masks, m_like_actions, m_like_menu);
|
||||
connect(m_except_mapper, SIGNAL(mapped(const QString&)), this, SLOT(closeExcept(const QString&)));
|
||||
connect(m_like_mapper, SIGNAL(mapped(const QString&)), this, SLOT(closeLike(const QString&)));
|
||||
}
|
||||
}
|
||||
|
||||
void CloseExceptPluginView::close(const QString& item, const bool close_if_match)
|
||||
{
|
||||
assert(
|
||||
"Parameter seems invalid! Is smth has changed in the code?"
|
||||
&& !item.isEmpty() && (item[0] == '*' || item[item.size() - 1] == '*')
|
||||
);
|
||||
|
||||
const bool is_path = item[0] != '*';
|
||||
const QString mask = is_path ? item.left(item.size() - 1) : item;
|
||||
kDebug() << "Going to close items [" << close_if_match << "/" << is_path << "]: " << mask;
|
||||
|
||||
QList<KTextEditor::Document*> docs2close;
|
||||
const QList<KTextEditor::Document*>& docs = m_plugin->application()->documentManager()->documents();
|
||||
Q_FOREACH(KTextEditor::Document* document, docs)
|
||||
{
|
||||
const QString& path = document->url().upUrl().path();
|
||||
/// \note Take a dot in account, so \c *.c would not match for \c blah.kcfgc
|
||||
const QString& ext = '.' + QFileInfo(document->url().fileName()).completeSuffix();
|
||||
const bool match = (!is_path && mask.endsWith(ext))
|
||||
|| (is_path && path.startsWith(mask))
|
||||
;
|
||||
if (match == close_if_match)
|
||||
{
|
||||
kDebug() << "*** Will close: " << document->url();
|
||||
docs2close.push_back(document);
|
||||
}
|
||||
}
|
||||
if (docs2close.isEmpty())
|
||||
{
|
||||
KPassivePopup::message(
|
||||
i18nc("@title:window", "Error")
|
||||
, i18nc("@info:tooltip", "No files to close ...")
|
||||
, qobject_cast<QWidget*>(this)
|
||||
);
|
||||
return;
|
||||
}
|
||||
// Show confirmation dialog if needed
|
||||
const bool removeNeeded = !m_plugin->showConfirmationNeeded()
|
||||
|| CloseConfirmDialog(docs2close, m_show_confirmation_action, qobject_cast<QWidget*>(this)).exec();
|
||||
if (removeNeeded)
|
||||
{
|
||||
if (docs2close.isEmpty())
|
||||
{
|
||||
KPassivePopup::message(
|
||||
i18nc("@title:window", "Error")
|
||||
, i18nc("@info:tooltip", "No files to close ...")
|
||||
, qobject_cast<QWidget*>(this)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Close 'em all!
|
||||
m_plugin->application()->documentManager()->closeDocumentList(docs2close);
|
||||
updateMenu();
|
||||
KPassivePopup::message(
|
||||
i18nc("@title:window", "Done")
|
||||
, i18np("%1 file closed", "%1 files closed", docs2close.size())
|
||||
, qobject_cast<QWidget*>(this)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
//END CloseExceptPluginView
|
||||
} // namespace kate
|
|
@ -1,135 +0,0 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Declate Kate's Close Except/Like plugin classes
|
||||
*
|
||||
* Copyright (C) 2012 Alex Turbov <i.zaufi@gmail.com>
|
||||
*
|
||||
* \date Thu Mar 8 08:13:43 MSK 2012 -- Initial design
|
||||
*/
|
||||
/*
|
||||
* KateCloseExceptPlugin 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* KateCloseExceptPlugin 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 __SRC__CLOSE_EXCEPT_PLUGIN_H__
|
||||
# define __SRC__CLOSE_EXCEPT_PLUGIN_H__
|
||||
|
||||
// Project specific includes
|
||||
|
||||
// Standard includes
|
||||
# include <kate/plugin.h>
|
||||
# include <kate/pluginconfigpageinterface.h>
|
||||
# include <KActionMenu>
|
||||
# include <KTextEditor/Document>
|
||||
# include <KTextEditor/View>
|
||||
# include <KToggleAction>
|
||||
# include <QtCore/QSignalMapper>
|
||||
# include <cassert>
|
||||
# include <set>
|
||||
|
||||
namespace kate {
|
||||
class CloseExceptPlugin; // forward declaration
|
||||
|
||||
/**
|
||||
* \brief Plugin to close docs grouped by extension or location
|
||||
*/
|
||||
class CloseExceptPluginView
|
||||
: public Kate::PluginView
|
||||
, public Kate::XMLGUIClient
|
||||
{
|
||||
Q_OBJECT
|
||||
typedef QMap<QString, QPointer<KAction> > actions_map_type;
|
||||
|
||||
public:
|
||||
/// Default constructor
|
||||
CloseExceptPluginView(Kate::MainWindow*, const KComponentData&, CloseExceptPlugin*);
|
||||
/// Destructor
|
||||
~CloseExceptPluginView();
|
||||
|
||||
private Q_SLOTS:
|
||||
void viewCreated(KTextEditor::View*);
|
||||
void documentCreated(KTextEditor::Editor*, KTextEditor::Document*);
|
||||
void updateMenuSlotStub(KTextEditor::Document*);
|
||||
void close(const QString&, const bool);
|
||||
void closeExcept(const QString& item)
|
||||
{
|
||||
close(item, false);
|
||||
}
|
||||
void closeLike(const QString& item)
|
||||
{
|
||||
close(item, true);
|
||||
}
|
||||
|
||||
private:
|
||||
void connectToDocument(KTextEditor::Document*);
|
||||
void updateMenu();
|
||||
QPointer<QSignalMapper> updateMenu(
|
||||
const QSet<QString>&
|
||||
, const QSet<QString>&
|
||||
, actions_map_type&
|
||||
, KActionMenu*
|
||||
);
|
||||
void appendActionsFrom(
|
||||
const QSet<QString>&
|
||||
, actions_map_type&
|
||||
, KActionMenu*
|
||||
, QSignalMapper*
|
||||
);
|
||||
|
||||
CloseExceptPlugin* m_plugin;
|
||||
QPointer<KToggleAction> m_show_confirmation_action;
|
||||
QPointer<KActionMenu> m_except_menu;
|
||||
QPointer<KActionMenu> m_like_menu;
|
||||
QPointer<QSignalMapper> m_except_mapper;
|
||||
QPointer<QSignalMapper> m_like_mapper;
|
||||
actions_map_type m_except_actions;
|
||||
actions_map_type m_like_actions;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Plugin view class
|
||||
*/
|
||||
class CloseExceptPlugin : public Kate::Plugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/// Default constructor
|
||||
CloseExceptPlugin(QObject* = 0, const QList<QVariant>& = QList<QVariant>());
|
||||
/// Destructor
|
||||
virtual ~CloseExceptPlugin() {}
|
||||
/// Create a new view of this plugin for the given main window
|
||||
Kate::PluginView* createView(Kate::MainWindow*);
|
||||
/// \name Plugin interface implementation
|
||||
//@{
|
||||
void readSessionConfig(KConfigBase*, const QString&);
|
||||
void writeSessionConfig(KConfigBase*, const QString&);
|
||||
//@}
|
||||
bool showConfirmationNeeded() const
|
||||
{
|
||||
return m_show_confirmation_needed;
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void toggleShowConfirmation(bool flag)
|
||||
{
|
||||
m_show_confirmation_needed = flag;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_show_confirmation_needed;
|
||||
};
|
||||
|
||||
} // namespace kate
|
||||
#endif // __SRC__CLOSE_EXCEPT_PLUGIN_H__
|
|
@ -1,31 +0,0 @@
|
|||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief Class \c kate::config (interface)
|
||||
*
|
||||
* Copyright (C) 2012 Alex Turbov <i.zaufi@gmail.com>
|
||||
*
|
||||
* \date Thu Mar 8 08:19:57 MSK 2012 -- Initial design
|
||||
*
|
||||
* \attention DO NOT EDIT THIS FILE! IT WAS GENERATED BY CMAKE.
|
||||
*/
|
||||
/*
|
||||
* KateCloseExceptPlugin 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* KateCloseExceptPlugin 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 __SRC__CONFIG_H__
|
||||
# define __SRC__CONFIG_H__
|
||||
# define PLUGIN_VERSION "@VERSION_STRING@"
|
||||
#endif // __SRC__CONFIG_H__
|
||||
// kate: hl c++;
|
|
@ -1,92 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Type=Service
|
||||
ServiceTypes=Kate/Plugin
|
||||
X-KDE-Library=katecloseexceptplugin
|
||||
X-KDE-Version=4.0
|
||||
X-Kate-Version=2.9
|
||||
X-Kate-Load=True
|
||||
Name=Close Except/Like
|
||||
Name[ar]=أغلق ما عدى/المشابه لِـ
|
||||
Name[bs]=Zatvori Osim/Kao
|
||||
Name[ca]=Tancament excepte/com
|
||||
Name[ca@valencia]=Tancament excepte/com
|
||||
Name[cs]=Zavřít kromě/jako
|
||||
Name[da]=Luk undtagen/lignende
|
||||
Name[de]=Bedingtes Schließen
|
||||
Name[el]=Κλείσιμο Except/Like
|
||||
Name[en_GB]=Close Except/Like
|
||||
Name[es]=Cerrar excepto/como
|
||||
Name[et]=Selliste/teistsuguste sulgemine
|
||||
Name[fi]=Sulje samanlaiset kuin / muut kuin
|
||||
Name[fr]=Fermer les exclusions / inclusions
|
||||
Name[gl]=Pechar agás/como
|
||||
Name[he]=סגור דומה/למעט
|
||||
Name[hu]=Kivétel/Like bezárása
|
||||
Name[ia]=Claude Excepte/Simile
|
||||
Name[it]=Chiudi escludendo/includendo
|
||||
Name[kk]=Шарт бойынша жабу
|
||||
Name[ko]=다음을 제외한/다음과 같은 것 닫기
|
||||
Name[lt]=Uždaryti Išskyrus/Kaip
|
||||
Name[nb]=Lukk unntatt/lik
|
||||
Name[nds]=Liek/Anner Dateien tomaken
|
||||
Name[nl]=Behalve/Like sluiten
|
||||
Name[pl]=Zamknij oprócz/podobne
|
||||
Name[pt]=Fechar Excluindo/Incluindo
|
||||
Name[pt_BR]=Fechamento com exclusão/inclusão
|
||||
Name[ro]=Închide excepția/precum
|
||||
Name[ru]=Закрыть кроме/только...
|
||||
Name[sk]=Zatvoriť okrem/ako
|
||||
Name[sl]=Zapri razen/kot
|
||||
Name[sr]=Затварање осим/према
|
||||
Name[sr@ijekavian]=Затварање осим/према
|
||||
Name[sr@ijekavianlatin]=Zatvaranje osim/prema
|
||||
Name[sr@latin]=Zatvaranje osim/prema
|
||||
Name[sv]=Stäng förutom/som
|
||||
Name[tr]=Hariç/Benzerlerini Kapat
|
||||
Name[uk]=Додаток закриття за критерієм
|
||||
Name[x-test]=xxClose Except/Likexx
|
||||
Name[zh_CN]=关闭除/类似
|
||||
Name[zh_TW]=關閉「例外/喜歡」
|
||||
Comment=Close group of documents based on a common path or file extension
|
||||
Comment[ar]=أغلق مجموعة من المستندات بناءً على مسار شائع أو امتداد الملف
|
||||
Comment[bs]=Zatvori grupu dokumenara na bazi zajedniočke staye ili ekstenzije datoteke
|
||||
Comment[ca]=Tanca un grup de documents basats en un camí comú o en l'extensió del fitxer
|
||||
Comment[ca@valencia]=Tanca un grup de documents basats en un camí comú o en l'extensió del fitxer
|
||||
Comment[cs]=Zavřít skupinu dokumentů podle společné cesty nebo přípony
|
||||
Comment[da]=Luk gruppe af dokumenter baseret på en fælles sti eller filendelse
|
||||
Comment[de]=Eine Gruppe von Dokumenten auf der Basis eines gemeinsamen Pfades oder einer Dateierweiterung schließen
|
||||
Comment[el]=Κλείσιμο ομάδας εγγράφων με βάση κοινή διαδρομή ή κατάληξη ονόματος αρχείου
|
||||
Comment[en_GB]=Close group of documents based on a common path or file extension
|
||||
Comment[es]=Cerrar un grupo de documentos según una ruta común o una extensión de archivo
|
||||
Comment[et]=Rühma ühise asukoha või faililaiendiga dokumentide sulgemine
|
||||
Comment[fi]=Sulje joukko tiedostoja niille yhteisen polun tai tiedostopäätteen perusteella
|
||||
Comment[fr]=Fermer un groupe de documents reposant sur un emplacement ou une extension de fichier communs
|
||||
Comment[gl]=Pecha un grupo de documentos baseado nunha ruta ou extensión de ficheiro común
|
||||
Comment[he]=סגור קבוצה של מסמכים בהתאם לנתיב משותף או סיומת
|
||||
Comment[hu]=Közös útvonalon vagy fájlkiterjesztésen alapuló dokumentumok csoportjának bezárása
|
||||
Comment[ia]=Claude gruppo de documentos basate su un commun percurso o extension de file
|
||||
Comment[it]=Chiudi gruppo di documenti con percorso o estensione comune
|
||||
Comment[kk]=Ортақ жолы не жұрнағы негізінде құжаттар тобын жабу
|
||||
Comment[ko]=공통 경로나 확장자를 기준으로 문서 그룹 닫기
|
||||
Comment[lt]=Uždaryti dokumentų grupę remianti bendruoju keliu ar failo plėtiniu
|
||||
Comment[nb]=Lukk en gruppe dokumenter basert på en felles sti eller etternavn
|
||||
Comment[nds]=Mehr Dateien op eenmaal tomaken, wenn se en gemeen Padd oder de sülve Ennen hebbt
|
||||
Comment[nl]=Groep documenten sluiten gebaseerd op een gemeenschappelijk pad of bestandsextensie
|
||||
Comment[pl]=Zamknij grupę dokumentów w oparciu o wspólną ścieżkę lub rozszerzenie pliku
|
||||
Comment[pt]=Fecha um grupo de documentos com base numa localização ou extensão de ficheiros comum
|
||||
Comment[pt_BR]=Fecha um grupo de documentos com base em localização comum ou extensão do arquivo
|
||||
Comment[ro]=Închide grupul de documente avînd la bază o cale sau extensie de fișier comune
|
||||
Comment[ru]=Закрывает группу документов, в зависимости от пути или расширения
|
||||
Comment[sk]=Zatvoriť skupinu dokumentov založenú na spoločnej ceste alebo koncovke súboru
|
||||
Comment[sl]=Zapre skupino dokumentov, ki temeljijo na skupni poti ali priponi datoteke
|
||||
Comment[sr]=Затворите групу докумената на основу заједничке путање или проширења фајла
|
||||
Comment[sr@ijekavian]=Затворите групу докумената на основу заједничке путање или проширења фајла
|
||||
Comment[sr@ijekavianlatin]=Zatvorite grupu dokumenata na osnovu zajedničke putanje ili proširenja fajla
|
||||
Comment[sr@latin]=Zatvorite grupu dokumenata na osnovu zajedničke putanje ili proširenja fajla
|
||||
Comment[sv]=Stäng grupp av dokument baserat på en gemensam sökväg eller filändelse
|
||||
Comment[tr]=Ortak yol veya dosya uzantısına bağlı belge gruplarını kapat
|
||||
Comment[uk]=Закриває групу документів, які зберігаються у одному каталозі або мають однаковий суфікс назви.
|
||||
Comment[x-test]=xxClose group of documents based on a common path or file extensionxx
|
||||
Comment[zh_CN]=根据路径或文件扩展名关闭一组文档
|
||||
Comment[zh_TW]=關閉相同路徑或相同副檔名的文件
|
|
@ -1,9 +0,0 @@
|
|||
<!DOCTYPE kpartgui>
|
||||
<gui name="katecloseexcept" library="katecloseexceptplugin" version="3">
|
||||
<MenuBar>
|
||||
<Menu name="file"><text>&File</text>
|
||||
<Action name="file_close_except" group="close_merge"/>
|
||||
<Action name="file_close_like" group="close_merge"/>
|
||||
</Menu>
|
||||
</MenuBar>
|
||||
</gui>
|
|
@ -1,20 +0,0 @@
|
|||
kde4_add_plugin(katehelloworldplugin plugin_katehelloworld.cpp)
|
||||
|
||||
target_link_libraries(katehelloworldplugin
|
||||
KDE4::kdeui
|
||||
kateinterfaces
|
||||
)
|
||||
|
||||
########### install files ###############
|
||||
install(
|
||||
TARGETS katehelloworldplugin
|
||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
||||
)
|
||||
install(
|
||||
FILES ui.rc
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kate/plugins/katehelloworld
|
||||
)
|
||||
install(
|
||||
FILES katehelloworld.desktop
|
||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
||||
)
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
$EXTRACTRC *.rc >> rc.cpp
|
||||
$XGETTEXT *.cpp -o $podir/katehelloworld.pot
|
|
@ -1,116 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Service
|
||||
ServiceTypes=Kate/Plugin
|
||||
X-KDE-Library=katehelloworldplugin
|
||||
X-Kate-Version=2.9
|
||||
Name=Hello World Plugin
|
||||
Name[ar]=ملحقة أهلًا يا عالم
|
||||
Name[ast]=Complementu Hola mundu
|
||||
Name[bg]=Приставка "Здравей свят!"
|
||||
Name[bs]=Zdravo‑svijete priključak
|
||||
Name[ca]=Connector Hola món
|
||||
Name[ca@valencia]=Connector Hola món
|
||||
Name[cs]=Modul Hello World
|
||||
Name[da]="Hello World"-plugin
|
||||
Name[de]=Hello-World-Modul
|
||||
Name[el]=Πρόσθετο Hello World
|
||||
Name[en_GB]=Hello World Plugin
|
||||
Name[es]=Complemento Hola mundo
|
||||
Name[et]='Tere, maailm' plugin
|
||||
Name[eu]=Kaixo mundua plugina
|
||||
Name[fi]=Hei maailma -liitännäinen
|
||||
Name[fr]=Module externe « Bonjour tout le monde »
|
||||
Name[ga]=Breiseán 'Dia Dhuit a Dhomhain'
|
||||
Name[gl]=Complemento de «Olá, mundo»
|
||||
Name[he]=תוסך שלום עולם
|
||||
Name[hu]=„Helló Világ” bővítmény
|
||||
Name[ia]=Plug-in de Salute Mondo
|
||||
Name[it]=Estensione Ciao Mondo
|
||||
Name[ja]=Hello World プラグイン
|
||||
Name[kk]=Сынақ плагині
|
||||
Name[km]=សួស្ដីកម្មវិធីជំនួយពាក្យ
|
||||
Name[ko]=Hello World 플러그인
|
||||
Name[lt]=Sveikas pasauli! priedas
|
||||
Name[lv]=“Sveika, pasaule!” spraudnis
|
||||
Name[mr]=हेल्लो वर्ल्ड प्लगइन
|
||||
Name[nb]=Programtillegg-eksempel
|
||||
Name[nds]="Moin-Welt"-Moduul
|
||||
Name[nl]=Plug-in voor Hello World
|
||||
Name[nn]=Eksempel-tillegg
|
||||
Name[pa]=ਹੈਲੋ ਵਰਲਡ ਪਲੱਗਇਨ
|
||||
Name[pl]=Wtyczka "Witaj świecie"
|
||||
Name[pt]='Plugin' de Olá Mundo
|
||||
Name[pt_BR]=Plugin de teste
|
||||
Name[ro]=Modul Hello World
|
||||
Name[ru]=Тестовый модуль
|
||||
Name[si]=ලෝකයට ආයුබෝවන් ප්ලගිනය
|
||||
Name[sk]=Hello World Plugin
|
||||
Name[sl]=Vstavek »Pozdravljen svet«
|
||||
Name[sr]=Здраво‑свете прикључак
|
||||
Name[sr@ijekavian]=Здраво‑свијете прикључак
|
||||
Name[sr@ijekavianlatin]=Zdravo‑svijete priključak
|
||||
Name[sr@latin]=Zdravo‑svete priključak
|
||||
Name[sv]=Hello world-insticksprogram
|
||||
Name[tg]=Плагини Салом ҷаҳон
|
||||
Name[tr]=Merhaba Dünya Eklentisi
|
||||
Name[ug]=سالام دۇنيا قىستۇرمىسى
|
||||
Name[uk]=Тестовий додаток
|
||||
Name[x-test]=xxHello World Pluginxx
|
||||
Name[zh_CN]=Hello World 插件
|
||||
Name[zh_TW]=Hello World 外掛程式
|
||||
Comment=Your short description about the plugin goes here
|
||||
Comment[ar]=الوصف القصير لهذه الملحقة يكون هنا
|
||||
Comment[ast]=Equí va una descripción curtia sobro'l so complementu
|
||||
Comment[bg]=Кратко описание на приставката
|
||||
Comment[bs]=Ovdje ide kratak opis priključka
|
||||
Comment[ca]=Aquí va una breu descripció sobre el connector
|
||||
Comment[ca@valencia]=Ací va una breu descripció sobre el connector
|
||||
Comment[cs]=Sem patří krátký popis vašeho modulu
|
||||
Comment[da]=Din korte beskrivelse af pluginet skal være her
|
||||
Comment[de]=Ihre Kurzbeschreibung des Moduls gehört hier hinein
|
||||
Comment[el]=Η σύντομη περιγραφή σας σχετικά με το πρόσθετο
|
||||
Comment[en_GB]=Your short description about the plugin goes here
|
||||
Comment[es]=Aquí va una breve descripción sobre su complemento
|
||||
Comment[et]=Siia võib kirjutada oma plugina kirjelduse
|
||||
Comment[eu]=Pluginari buruzko zure deskribapena hemen doa
|
||||
Comment[fi]=Lyhyt kuvaus liitännäisestäsi tähän
|
||||
Comment[fr]=Une courte description de votre module externe s'insère ici
|
||||
Comment[ga]=Cuir do chur síos gearr ar an mbreiseán anseo
|
||||
Comment[gl]=A descrición curta acerca do complemento vai aquí
|
||||
Comment[he]=כאן אתה צריך להוסיף את התיאור של התוסף
|
||||
Comment[hu]=A bővítőmodul rövid leírása
|
||||
Comment[ia]=Tu breve description re le plug-in va hic
|
||||
Comment[it]=La tua breve descrizione dell'estensione va qui
|
||||
Comment[ja]=プラグインの簡単な説明をここに書きます
|
||||
Comment[kk]=Мұнда плагинінің қысқа сипаттамасы болады
|
||||
Comment[km]=ការពិពណ៌នាសង្ខេបរបស់អ្នកអំពីកម្មវិធីជំនួយនៅទីនេះ
|
||||
Comment[ko]=플러그인에 대한 짧은 설명을 입력하십시오
|
||||
Comment[lt]=Čia turėtų būti trumpas priedo aprašymas
|
||||
Comment[lv]=Šeit jābūt nelielam spraudņa aprakstam
|
||||
Comment[mr]=प्लगइन करिता थोडक्यात वर्णन
|
||||
Comment[nb]=Din kortbeskrivelse av programtillegget skal legges inn her
|
||||
Comment[nds]=Hier kummt Dien korte Beschrieven vun't Moduul hen
|
||||
Comment[ne]=यहाँ प्लगइन जाने बारे तपाईँको छोटो वर्णन
|
||||
Comment[nl]=Voer hier een korte beschrijving van uw plug-in in.
|
||||
Comment[nn]=Skriv inn ei kort skildring av tillegget her
|
||||
Comment[pa]=ਪਲੱਗਇਨ ਬਾਰੇ ਤੁਹਾਡੀ ਸੰਖੇਪ ਜਾਣਕਾਰੀ ਇੱਥੇ
|
||||
Comment[pl]=Tutaj powinien znaleźć się krótki opis wtyczki
|
||||
Comment[pt]=Aqui aparece a sua descrição breve sobre o 'plugin'
|
||||
Comment[pt_BR]=Sua descrição resumida sobre o plugin aparece aqui
|
||||
Comment[ro]=Aici merge o scurtă descriere a modulului
|
||||
Comment[ru]=А здесь должно быть описание модуля
|
||||
Comment[si]=ප්ලගිනය පිලිබඳ ඔබේ කෙටි විස්තරය මෙහි දැක්වේ
|
||||
Comment[sk]=Sem ide krátky popis vášho pluginu
|
||||
Comment[sl]=Sem spada kratek opis vašega vstavka
|
||||
Comment[sr]=Овде иде кратак опис прикључка
|
||||
Comment[sr@ijekavian]=Овдје иде кратак опис прикључка
|
||||
Comment[sr@ijekavianlatin]=Ovdje ide kratak opis priključka
|
||||
Comment[sr@latin]=Ovde ide kratak opis priključka
|
||||
Comment[sv]=Kort beskrivning av vad insticksprogrammet gör
|
||||
Comment[tg]=Шарҳи кӯтоҳи шумо дар бораи ин плагин дар ин ҷо сар мешавад
|
||||
Comment[tr]=Eklenti hakkındaki kısa yorumunuzu buraya ekleyin
|
||||
Comment[ug]=بۇ قىستۇرمىنىڭ قىسقىچە چۈشەندۈرۈشى
|
||||
Comment[uk]=Тут слід вказати ваш короткий опис додатка
|
||||
Comment[x-test]=xxYour short description about the plugin goes herexx
|
||||
Comment[zh_CN]=关于此插件的简短描述
|
||||
Comment[zh_TW]=在這裡描述您的外掛程式
|
|
@ -1,100 +0,0 @@
|
|||
/* This file is part of the Kate project.
|
||||
*
|
||||
* Copyright (C) 2010 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 "plugin_katehelloworld.h"
|
||||
#include "moc_plugin_katehelloworld.cpp"
|
||||
|
||||
#include <kate/application.h>
|
||||
#include <ktexteditor/view.h>
|
||||
|
||||
#include <kaction.h>
|
||||
#include <kactioncollection.h>
|
||||
#include <klocale.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
#include <kaboutdata.h>
|
||||
|
||||
K_PLUGIN_FACTORY(KatePluginHelloWorldFactory, registerPlugin<KatePluginHelloWorld>();)
|
||||
K_EXPORT_PLUGIN(KatePluginHelloWorldFactory(KAboutData("katehelloworld","katehelloworld",ki18n("Hello World"), "0.1", ki18n("Example kate plugin"))) )
|
||||
|
||||
KatePluginHelloWorld::KatePluginHelloWorld( QObject* parent, const QList<QVariant>& )
|
||||
: Kate::Plugin( (Kate::Application*)parent, "kate-hello-world-plugin" )
|
||||
{
|
||||
}
|
||||
|
||||
KatePluginHelloWorld::~KatePluginHelloWorld()
|
||||
{
|
||||
}
|
||||
|
||||
Kate::PluginView *KatePluginHelloWorld::createView( Kate::MainWindow *mainWindow )
|
||||
{
|
||||
return new KatePluginHelloWorldView( mainWindow );
|
||||
}
|
||||
|
||||
|
||||
KatePluginHelloWorldView::KatePluginHelloWorldView( Kate::MainWindow *mainWin )
|
||||
: Kate::PluginView( mainWin ),
|
||||
Kate::XMLGUIClient(KatePluginHelloWorldFactory::componentData())
|
||||
{
|
||||
KAction *a = actionCollection()->addAction( "edit_insert_helloworld" );
|
||||
a->setText( i18n("Insert Hello World") );
|
||||
connect( a, SIGNAL(triggered(bool)), this, SLOT(slotInsertHello()) );
|
||||
|
||||
mainWindow()->guiFactory()->addClient( this );
|
||||
}
|
||||
|
||||
KatePluginHelloWorldView::~KatePluginHelloWorldView()
|
||||
{
|
||||
mainWindow()->guiFactory()->removeClient( this );
|
||||
}
|
||||
|
||||
void KatePluginHelloWorldView::slotInsertHello()
|
||||
{
|
||||
if (!mainWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
KTextEditor::View *kv = mainWindow()->activeView();
|
||||
|
||||
if (kv) {
|
||||
kv->insertText( "Hello World" );
|
||||
}
|
||||
}
|
||||
|
||||
void KatePluginHelloWorldView::readSessionConfig( KConfigBase* config, const QString& groupPrefix )
|
||||
{
|
||||
// If you have session-dependant settings, load them here.
|
||||
// If you have application wide settings, you have to read your own KConfig,
|
||||
// see the Kate::Plugin docs for more information.
|
||||
Q_UNUSED( config );
|
||||
Q_UNUSED( groupPrefix );
|
||||
}
|
||||
|
||||
void KatePluginHelloWorldView::writeSessionConfig( KConfigBase* config, const QString& groupPrefix )
|
||||
{
|
||||
// If you have session-dependant settings, save them here.
|
||||
// If you have application wide settings, you have to create your own KConfig,
|
||||
// see the Kate::Plugin docs for more information.
|
||||
Q_UNUSED( config );
|
||||
Q_UNUSED( groupPrefix );
|
||||
}
|
||||
|
||||
// kate: space-indent on; indent-width 2; replace-tabs on;
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
/* This file is part of the Kate project.
|
||||
*
|
||||
* Copyright (C) 2010 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 _PLUGIN_KATE_HELLOWORLD_H_
|
||||
#define _PLUGIN_KATE_HELLOWORLD_H_
|
||||
|
||||
#include <kate/mainwindow.h>
|
||||
#include <kate/plugin.h>
|
||||
#include <kxmlguiclient.h>
|
||||
|
||||
class KatePluginHelloWorld : public Kate::Plugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KatePluginHelloWorld( QObject* parent = 0, const QList<QVariant>& = QList<QVariant>() );
|
||||
virtual ~KatePluginHelloWorld();
|
||||
|
||||
Kate::PluginView *createView( Kate::MainWindow *mainWindow );
|
||||
};
|
||||
|
||||
class KatePluginHelloWorldView : public Kate::PluginView, public Kate::XMLGUIClient
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
KatePluginHelloWorldView( Kate::MainWindow *mainWindow );
|
||||
~KatePluginHelloWorldView();
|
||||
|
||||
virtual void readSessionConfig( KConfigBase* config, const QString& groupPrefix );
|
||||
virtual void writeSessionConfig( KConfigBase* config, const QString& groupPrefix );
|
||||
|
||||
public slots:
|
||||
void slotInsertHello();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// kate: space-indent on; indent-width 2; replace-tabs on;
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<!DOCTYPE kpartgui>
|
||||
<gui name="katehelloworld" library="libkatehelloworldplugin" version="2">
|
||||
<MenuBar>
|
||||
<Menu name="tools"><text>&Tools</text>
|
||||
<Action name="edit_insert_helloworld" />
|
||||
</Menu>
|
||||
</MenuBar>
|
||||
</gui>
|
|
@ -1,26 +0,0 @@
|
|||
########### next target ###############
|
||||
|
||||
kde4_add_plugin(kateopenheaderplugin plugin_kateopenheader.cpp)
|
||||
|
||||
target_link_libraries(kateopenheaderplugin
|
||||
kateinterfaces
|
||||
KDE4::kio
|
||||
KDE4::kparts
|
||||
KDE4::ktexteditor
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS kateopenheaderplugin
|
||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
||||
)
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install(
|
||||
FILES ui.rc
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kate/plugins/kateopenheader
|
||||
)
|
||||
install(
|
||||
FILES kateopenheader.desktop
|
||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
||||
)
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
$EXTRACTRC *.rc >> rc.cpp
|
||||
$XGETTEXT *.cpp -o $podir/kateopenheader.pot
|
|
@ -1,116 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Service
|
||||
ServiceTypes=Kate/Plugin
|
||||
X-KDE-Library=kateopenheaderplugin
|
||||
X-Kate-Version=2.8
|
||||
Name=Open Header
|
||||
Name[ar]=افتح الترويسة
|
||||
Name[ast]=Abrir cabecera
|
||||
Name[bg]=Отваряне на header
|
||||
Name[bs]=Otvaranje zaglavlja
|
||||
Name[ca]=Obre capçaleres
|
||||
Name[ca@valencia]=Obri capçaleres
|
||||
Name[cs]=Otevřít hlavičku
|
||||
Name[da]=Åbn headerfil
|
||||
Name[de]=Header öffnen
|
||||
Name[el]=Άνοιγμα κεφαλίδας
|
||||
Name[en_GB]=Open Header
|
||||
Name[es]=Abrir cabecera
|
||||
Name[et]=Päiseavaja
|
||||
Name[eu]=Ireki goiburua
|
||||
Name[fi]=Avaa otsake
|
||||
Name[fr]=Ouvrir un fichier d'en-tête
|
||||
Name[ga]=Oscail Comhad Ceanntáisc
|
||||
Name[gl]=Abrir a cabeceira
|
||||
Name[he]=פתח קובץ כותרת
|
||||
Name[hu]=Fejlécböngésző
|
||||
Name[ia]=Aperi capite (header)
|
||||
Name[it]=Apri intestazioni
|
||||
Name[ja]=オープンヘッダ
|
||||
Name[kk]=Айдарын ашу
|
||||
Name[km]=បើកបឋមកថា
|
||||
Name[ko]=헤더 열기
|
||||
Name[lt]=Atverti antraštę
|
||||
Name[lv]=Atvērt galveni
|
||||
Name[mr]=हेडर उघडा
|
||||
Name[nb]=Åpne deklarasjonsfil
|
||||
Name[nds]=Koppdatei opmaken
|
||||
Name[nl]=OpenHeader
|
||||
Name[nn]=Opna deklarasjonsfil
|
||||
Name[pa]=ਹੈੱਡਰ ਖੋਲ੍ਹੋ
|
||||
Name[pl]=Otwórz plik nagłówkowy
|
||||
Name[pt]=Abrir um Ficheiro de Inclusão
|
||||
Name[pt_BR]=Abrir arquivo de inclusão
|
||||
Name[ro]=Deschide antet
|
||||
Name[ru]=Открытие заголовочного файла
|
||||
Name[si]=ශීර්ෂය විවෘතකරන්න
|
||||
Name[sk]=Otvoriť hlavičku
|
||||
Name[sl]=Odpiranje glav
|
||||
Name[sr]=Отварање заглавља
|
||||
Name[sr@ijekavian]=Отварање заглавља
|
||||
Name[sr@ijekavianlatin]=Otvaranje zaglavlja
|
||||
Name[sr@latin]=Otvaranje zaglavlja
|
||||
Name[sv]=Öppna deklarationsfil
|
||||
Name[tg]=Кушодани сарлавҳа
|
||||
Name[tr]=Başlığı Aç
|
||||
Name[ug]=باشنى ئاچ
|
||||
Name[uk]=Відкрити заголовок
|
||||
Name[x-test]=xxOpen Headerxx
|
||||
Name[zh_CN]=打开头文件
|
||||
Name[zh_TW]=開啟標頭
|
||||
Comment=Opens the corresponding .h/[.cpp|.c] file
|
||||
Comment[ar]=يفتح ملف .h/[.cpp|.c] المناسب
|
||||
Comment[ast]=Abre'l correspondiente ficheru .h/[.cpp|.c]
|
||||
Comment[bg]=Отваряне на съответните файлове .h/[.cpp|.c]
|
||||
Comment[bs]=Otvara pridruženu .h/[.cpp|.c] datoteku
|
||||
Comment[ca]=Obre el fitxer .h/[.cpp|.c] corresponent
|
||||
Comment[ca@valencia]=Obri el fitxer .h/[.cpp|.c] corresponent
|
||||
Comment[cs]=Otevře odpovídající soubor .h/[.cpp|.c]
|
||||
Comment[da]=Åbner den tilhørende .h/[.cpp|.c]-fil
|
||||
Comment[de]=Öffnet die zusammengehörigen .h/[.cpp|.c]-Dateien
|
||||
Comment[el]=Άνοιγμα του αντίστοιχου αρχείου .h/[.cpp|.c]
|
||||
Comment[en_GB]=Opens the corresponding .h/[.cpp|.c] file
|
||||
Comment[es]=Abre el correspondiente archivo .h/[.cpp|.c]
|
||||
Comment[et]=Vastava .h/[.cpp|.c] faili avamine
|
||||
Comment[eu]=Dagokion .h/[.cpp|.c] fitxategia irekitzen du
|
||||
Comment[fi]=Avaa vastaavan .h/[.cpp|.c]-tiedoston
|
||||
Comment[fr]=Ouvre le fichier .h / [.cpp |.c] correspondant
|
||||
Comment[ga]=Oscail an comhad .h/[.cpp|.c] a fhreagraíonn leis an gceann seo
|
||||
Comment[gl]=Abre o ficheiro .h/[.cpp|.c] correspondente
|
||||
Comment[he]=פותח את הקובץ המתאים (file.h, file.cpp)
|
||||
Comment[hu]=Megnyitja a megfelelő .h/[.cpp|.c] fájlt
|
||||
Comment[ia]=Aperi le correspondente file .h/[.cpp].c]
|
||||
Comment[it]=Apre il file .h/[.cpp|.c] corrispondente
|
||||
Comment[ja]=対応する .h/[.cpp|.c] ファイルを開きます
|
||||
Comment[kk]=Сәйкесті .h/[.cpp|.c] файлын ашу
|
||||
Comment[km]=បើកឯកសារដែលត្រូវនឹង .h/[.cpp|.c]
|
||||
Comment[ko]=해당하는 .h/[.cpp|.c] 파일 열기
|
||||
Comment[lt]=Atveria atitinkamą .h/[.cpp|.c] failą
|
||||
Comment[lv]=Atver atbilstošo .h/[.cpp|.c] datni
|
||||
Comment[mr]=संबंधित .h/[.cpp|.c] फाईल उघडतो
|
||||
Comment[nb]=Åpner tilhørende .h/[.cpp|.c] fil
|
||||
Comment[nds]=Maakt de tohören .h/.cpp/.c-Datei op
|
||||
Comment[ne]=संगत .h/[.cpp|.c] फाइल खोल्दछ
|
||||
Comment[nl]=Open het bijhorende .h/[.cpp|.c]-bestand
|
||||
Comment[nn]=Opna tilhøyrande .h/[.cpp|.c]-fil
|
||||
Comment[pa]=ਸਬੰਧਿਤ .h/[.cpp|.c] ਫਾਇਲ ਖੋਲ੍ਹੋ
|
||||
Comment[pl]=Otwiera odpowiedni plik .h/[.cpp|.c]
|
||||
Comment[pt]=Abre o ficheiro .h/[.cpp|.c] correspondente
|
||||
Comment[pt_BR]=Abre o arquivo .h/[.cpp|.c] correspondente
|
||||
Comment[ro]=Deschide fișierul .h/[.cpp|.c] corespunzător
|
||||
Comment[ru]=Открывает соответствующий файл .h/[.cpp|.c]
|
||||
Comment[si]=අදාල .h/[.cpp|.c] ගොනුව විවෘත කරයි
|
||||
Comment[sk]=Otvorí korešpondujúci .h/[.cpp|.c] súbor
|
||||
Comment[sl]=Odpre ustrezno datoteko .h/[.cpp|.c]
|
||||
Comment[sr]=Отвара придружени .h/[.cpp|.c] фајл
|
||||
Comment[sr@ijekavian]=Отвара придружени .h/[.cpp|.c] фајл
|
||||
Comment[sr@ijekavianlatin]=Otvara pridruženi .h/[.cpp|.c] fajl
|
||||
Comment[sr@latin]=Otvara pridruženi .h/[.cpp|.c] fajl
|
||||
Comment[sv]=Öppnar den motsvarande .h/[.cpp|.c]-filen
|
||||
Comment[tg]=Кушодани фаилҳои мувофиқи .h/[.cpp|.c]
|
||||
Comment[tr]=Uyumlu .h/[.cpp|.c] dosyalarını açar
|
||||
Comment[ug]=نۆۋەتتىكى ھۆججەت .h/[.cpp.c] غا ماس كەلگەن ھۆججەتنى ئاچىدۇ
|
||||
Comment[uk]=Відкриває відповідний файл .h/[.cpp|.c]
|
||||
Comment[x-test]=xxOpens the corresponding .h/[.cpp|.c] filexx
|
||||
Comment[zh_CN]=打开对应于当前文件的 .h/[.cpp|.c] 文件
|
||||
Comment[zh_TW]=開啟相關的 .h/.cpp/.c 檔
|
|
@ -1,170 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2001 Joseph Wenninger
|
||||
Copyright (C) 2009 Erlend Hamberg <ehamberg@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
|
||||
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 "plugin_kateopenheader.h"
|
||||
#include "moc_plugin_kateopenheader.cpp"
|
||||
|
||||
#include <kate/application.h>
|
||||
#include <ktexteditor/view.h>
|
||||
#include <ktexteditor/document.h>
|
||||
#include <ktexteditor/editor.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kaction.h>
|
||||
#include <klocale.h>
|
||||
#include <kdebug.h>
|
||||
#include <kurl.h>
|
||||
#include <kio/netaccess.h>
|
||||
#include <kactioncollection.h>
|
||||
|
||||
|
||||
K_PLUGIN_FACTORY(KateOpenHeaderFactory, registerPlugin<PluginKateOpenHeader>();)
|
||||
K_EXPORT_PLUGIN(KateOpenHeaderFactory(KAboutData("kateopenheader","kateopenheader",ki18n("Open Header"), "0.1", ki18n("Open header for a source file"), KAboutData::License_LGPL_V2)) )
|
||||
|
||||
|
||||
PluginViewKateOpenHeader::PluginViewKateOpenHeader(PluginKateOpenHeader *plugin, Kate::MainWindow *mainwindow)
|
||||
: Kate::PluginView(mainwindow)
|
||||
, Kate::XMLGUIClient(KateOpenHeaderFactory::componentData())
|
||||
, KTextEditor::Command()
|
||||
, m_plugin(plugin)
|
||||
{
|
||||
KAction *a = actionCollection()->addAction("file_openheader");
|
||||
a->setText(i18n("Open .h/.cpp/.c"));
|
||||
a->setShortcut( Qt::Key_F12 );
|
||||
connect( a, SIGNAL(triggered(bool)), plugin, SLOT(slotOpenHeader()) );
|
||||
|
||||
mainwindow->guiFactory()->addClient (this);
|
||||
|
||||
KTextEditor::CommandInterface* cmdIface =
|
||||
qobject_cast<KTextEditor::CommandInterface*>( Kate::application()->editor() );
|
||||
|
||||
if( cmdIface ) {
|
||||
cmdIface->registerCommand( this );
|
||||
}
|
||||
}
|
||||
|
||||
PluginViewKateOpenHeader::~PluginViewKateOpenHeader()
|
||||
{
|
||||
mainWindow()->guiFactory()->removeClient (this);
|
||||
|
||||
KTextEditor::CommandInterface* cmdIface =
|
||||
qobject_cast<KTextEditor::CommandInterface*>( Kate::application()->editor() );
|
||||
|
||||
if( cmdIface ) {
|
||||
cmdIface->unregisterCommand( this );
|
||||
}
|
||||
}
|
||||
|
||||
PluginKateOpenHeader::PluginKateOpenHeader( QObject* parent, const QList<QVariant>& )
|
||||
: Kate::Plugin ( (Kate::Application *)parent, "open-header-plugin" )
|
||||
{
|
||||
}
|
||||
|
||||
PluginKateOpenHeader::~PluginKateOpenHeader()
|
||||
{
|
||||
}
|
||||
|
||||
Kate::PluginView *PluginKateOpenHeader::createView (Kate::MainWindow *mainWindow)
|
||||
{
|
||||
return new PluginViewKateOpenHeader(this,mainWindow);
|
||||
}
|
||||
|
||||
void PluginKateOpenHeader::slotOpenHeader ()
|
||||
{
|
||||
if (!application()->activeMainWindow())
|
||||
return;
|
||||
|
||||
KTextEditor::View * kv (application()->activeMainWindow()->activeView());
|
||||
if (!kv) return;
|
||||
|
||||
KUrl url=kv->document()->url();
|
||||
if ((!url.isValid()) || (url.isEmpty())) return;
|
||||
|
||||
QFileInfo info( url.toLocalFile() );
|
||||
QString extension = info.suffix().toLower();
|
||||
|
||||
QStringList headers( QStringList() << "h" << "H" << "hh" << "hpp" );
|
||||
QStringList sources( QStringList() << "c" << "cpp" << "cc" << "cp" << "cxx" );
|
||||
|
||||
if( sources.contains( extension ) ) {
|
||||
tryOpen( url, headers );
|
||||
} else if ( headers.contains( extension ) ) {
|
||||
tryOpen( url, sources );
|
||||
}
|
||||
}
|
||||
|
||||
void PluginKateOpenHeader::tryOpen( const KUrl& url, const QStringList& extensions )
|
||||
{
|
||||
if (!application()->activeMainWindow())
|
||||
return;
|
||||
|
||||
kDebug() << "Trying to open " << url.pathOrUrl() << " with extensions " << extensions.join(" ");
|
||||
QString basename = QFileInfo( url.path() ).baseName();
|
||||
KUrl newURL( url );
|
||||
for( QStringList::ConstIterator it = extensions.begin(); it != extensions.end(); ++it ) {
|
||||
newURL.setFileName( basename + '.' + *it );
|
||||
if( KIO::NetAccess::exists( newURL , KIO::NetAccess::SourceSide, application()->activeMainWindow()->window()) )
|
||||
application()->activeMainWindow()->openUrl( newURL );
|
||||
newURL.setFileName( basename + '.' + (*it).toUpper() );
|
||||
if( KIO::NetAccess::exists( newURL , KIO::NetAccess::SourceSide, application()->activeMainWindow()->window()) )
|
||||
application()->activeMainWindow()->openUrl( newURL );
|
||||
}
|
||||
}
|
||||
|
||||
const QStringList& PluginViewKateOpenHeader::cmds()
|
||||
{
|
||||
static QStringList l;
|
||||
|
||||
if (l.empty()) {
|
||||
l << "toggle-header";
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
bool PluginViewKateOpenHeader::exec(KTextEditor::View *view, const QString &cmd, QString &msg)
|
||||
{
|
||||
Q_UNUSED(view)
|
||||
Q_UNUSED(cmd)
|
||||
Q_UNUSED(msg)
|
||||
|
||||
m_plugin->slotOpenHeader();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PluginViewKateOpenHeader::help(KTextEditor::View *view, const QString &cmd, QString &msg)
|
||||
{
|
||||
Q_UNUSED(view)
|
||||
Q_UNUSED(cmd)
|
||||
|
||||
msg = "<p><b>toggle-header — switch between header and corresponding c/cpp file</b></p>"
|
||||
"<p>usage: <tt><b>toggle-header</b></tt></p>"
|
||||
"<p>When editing C or C++ code, this command will switch between a header file and "
|
||||
"its corresponding C/C++ file or vice verca.</p>"
|
||||
"<p>For example, if you are editing myclass.cpp, <tt>toggle-header</tt> will change "
|
||||
"to myclass.h if this file is available.</p>"
|
||||
"<p>Pairs of the following filename suffixes will work:<br />"
|
||||
" Header files: h, H, hh, hpp<br />"
|
||||
" Source files: c, cpp, cc, cp, cxx</p>";
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2001 Joseph Wenninger
|
||||
Copyright (C) 2009 Erlend Hamberg <ehamberg@gmail.com>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License version 2 as published by the Free Software Foundation.
|
||||
|
||||
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 PLUGIN_KATEOPENHEADER_H
|
||||
#define PLUGIN_KATEOPENHEADER_H
|
||||
|
||||
#include <kate/plugin.h>
|
||||
#include <kate/mainwindow.h>
|
||||
#include <ktexteditor/commandinterface.h>
|
||||
|
||||
class PluginKateOpenHeader : public Kate::Plugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PluginKateOpenHeader( QObject* parent = 0, const QList<QVariant>& = QList<QVariant>() );
|
||||
virtual ~PluginKateOpenHeader();
|
||||
|
||||
Kate::PluginView *createView (Kate::MainWindow *mainWindow);
|
||||
|
||||
public slots:
|
||||
void slotOpenHeader ();
|
||||
void tryOpen( const KUrl& url, const QStringList& extensions );
|
||||
};
|
||||
|
||||
class PluginViewKateOpenHeader
|
||||
: public Kate::PluginView
|
||||
, public Kate::XMLGUIClient
|
||||
, public KTextEditor::Command
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PluginViewKateOpenHeader(PluginKateOpenHeader* plugin, Kate::MainWindow *mainwindow);
|
||||
virtual ~PluginViewKateOpenHeader();
|
||||
|
||||
virtual const QStringList &cmds ();
|
||||
virtual bool exec (KTextEditor::View *view, const QString &cmd, QString &msg);
|
||||
virtual bool help (KTextEditor::View *view, const QString &cmd, QString &msg);
|
||||
|
||||
private:
|
||||
PluginKateOpenHeader* m_plugin;
|
||||
};
|
||||
|
||||
#endif // PLUGIN_KATEOPENHEADER_H
|
|
@ -1,8 +0,0 @@
|
|||
<!DOCTYPE kpartgui>
|
||||
<gui name="kateopenheader" library="libkateopenheaderplugin" version="3">
|
||||
<MenuBar>
|
||||
<Menu name="file"><text>&File</text>
|
||||
<Action name="file_openheader" group="open_merge"/>
|
||||
</Menu>
|
||||
</MenuBar>
|
||||
</gui>
|
|
@ -1,33 +0,0 @@
|
|||
########### next target ###############
|
||||
|
||||
set(katetabbarextensionplugin_PART_SRCS
|
||||
plugin_katetabbarextension.cpp
|
||||
ktinytabbutton.cpp
|
||||
ktinytabbar.cpp
|
||||
ktinytabbarconfigdialog.cpp
|
||||
ktinytabbarconfigpage.cpp
|
||||
)
|
||||
|
||||
kde4_add_plugin(katetabbarextensionplugin ${katetabbarextensionplugin_PART_SRCS})
|
||||
|
||||
target_link_libraries(katetabbarextensionplugin
|
||||
KDE4::kdeui
|
||||
KDE4::kparts
|
||||
kateinterfaces
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS katetabbarextensionplugin
|
||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
||||
)
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install(
|
||||
FILES ui.rc
|
||||
DESTINATION ${KDE4_DATA_INSTALL_DIR}/kate/plugins/katetabbarextension
|
||||
)
|
||||
install(
|
||||
FILES katetabbarextension.desktop
|
||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
||||
)
|
|
@ -1,3 +0,0 @@
|
|||
#! /bin/sh
|
||||
$EXTRACTRC *.rc *.ui >> rc.cpp
|
||||
$XGETTEXT *.cpp *.h -o $podir/katetabbarextension.pot
|
|
@ -1,111 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Service
|
||||
ServiceTypes=Kate/Plugin
|
||||
X-KDE-Library=katetabbarextensionplugin
|
||||
X-Kate-Version=2.8
|
||||
Name=Multiline Tab Bar
|
||||
Name[ar]=شريط ألسنة متعدّد الأسطر
|
||||
Name[bg]=Лента с подпрозорци на няколко реда
|
||||
Name[bs]=Višelinijska traka kartica
|
||||
Name[ca]=Barra de pestanyes multilínia
|
||||
Name[ca@valencia]=Barra de pestanyes multilínia
|
||||
Name[cs]=Víceřádkový pruh s kartami
|
||||
Name[da]=Fanebladslinje med flere linjer
|
||||
Name[de]=Mehrzeilige Unterfensterleiste
|
||||
Name[el]=Καρτέλες πολλαπλών γραμμών
|
||||
Name[en_GB]=Multiline Tab Bar
|
||||
Name[es]=Barra de pestañas multilínea
|
||||
Name[et]=Mitmerealine kaardiriba
|
||||
Name[eu]=Lerro anitzeko fitxa-barra
|
||||
Name[fi]=Monirivinen välilehtipalkki
|
||||
Name[fr]=Barre d'onglets multi-ligne
|
||||
Name[ga]=Barra Cluaisíní Il-Líne
|
||||
Name[gl]=Barra de lapelas multiliña
|
||||
Name[he]=כרטיסיות בעלות כמה שורות
|
||||
Name[hu]=Többsoros lapozósáv
|
||||
Name[ia]=Barra de scheda multi-rango
|
||||
Name[it]=Barra di schede multilinea
|
||||
Name[kk]=Көпжолды қойынды
|
||||
Name[km]=របារផ្ទាំងពហុបន្ទាត់
|
||||
Name[ko]=여러 줄 탭 표시줄
|
||||
Name[lt]=Kelių eilučių kortelių juosta
|
||||
Name[lv]=Vairāku rindu ciļņu josla
|
||||
Name[mr]=बहुलरेषा टॅब पट्टी
|
||||
Name[nb]=Fanelinje med flere rader
|
||||
Name[nds]=Mehrregen-Paneelbalken
|
||||
Name[nl]=Meerregelige tabbladbalk
|
||||
Name[pa]=ਬਹੁ-ਲਾਈਨ ਟੈਬ ਪੱਟੀ
|
||||
Name[pl]=Wieloliniowy pasek kart
|
||||
Name[pt]=Barra de Páginas Multi-Linha
|
||||
Name[pt_BR]=Barra de abas multilinha
|
||||
Name[ro]=Bară de file multilinie
|
||||
Name[ru]=Многострочная панель вкладок
|
||||
Name[si]=බහුපේලි තීරුව
|
||||
Name[sk]=Viacriadkový panel kariet
|
||||
Name[sl]=Vrstica z zavihki v več vrsticah
|
||||
Name[sr]=Вишередна трака језичака
|
||||
Name[sr@ijekavian]=Вишередна трака језичака
|
||||
Name[sr@ijekavianlatin]=Višeredna traka jezičaka
|
||||
Name[sr@latin]=Višeredna traka jezičaka
|
||||
Name[sv]=Flerraders flikrad
|
||||
Name[tg]=Панели бисёрсатра
|
||||
Name[tr]=Çok Satırlı Sekme Çubuğu
|
||||
Name[ug]=كۆپ قۇرلۇق بەتكۈچ بالداق
|
||||
Name[uk]=Багаторядкова панель вкладок
|
||||
Name[x-test]=xxMultiline Tab Barxx
|
||||
Name[zh_CN]=多行标签栏
|
||||
Name[zh_TW]=多行分頁列
|
||||
Comment=Adds a tab bar with multiple rows to Kate's main window
|
||||
Comment[ar]=يضيف شريط ألسنة بصفوف متعدّدة إلى نافذة كيت الرئيسية
|
||||
Comment[bg]=Добавяне на лента с подпрозорци на няколко реда към основния прозорец на Kate
|
||||
Comment[bs]=Dodaje traku sa karticama u glavni prozor Kate
|
||||
Comment[ca]=Afegeix una barra de pestanyes amb diverses files a la finestra principal del Kate
|
||||
Comment[ca@valencia]=Afig una barra de pestanyes amb diverses files a la finestra principal del Kate
|
||||
Comment[cs]=Přidá do hlavního okna Kate pruh karet s více řádky
|
||||
Comment[da]=Føjer en fanebladslinje med flere rækker til Kates hovedvindue
|
||||
Comment[de]=Fügt dem Hauptfenster von Kate eine mehrzeilige Unterfensterleiste hinzu
|
||||
Comment[el]=Προσθέτει καρτέλες πολλαπλών γραμμών στο κύριο παράθυρο του Kate
|
||||
Comment[en_GB]=Adds a tab bar with multiple rows to Kate's main window
|
||||
Comment[es]=Añade una barra de pestañas con varias filas a la ventana principal de Kate
|
||||
Comment[et]=Lisab Kate peaaknasse mitmerealise kaardiriba
|
||||
Comment[eu]=Hainbat errenkada dituen fitxa-barra gehitzen dio Kate-ren leiho nagusiari
|
||||
Comment[fi]=Lisää monirivisen välilehtipalkin Katen pääikkunaan
|
||||
Comment[fr]=Ajoute une barre d'onglets comportant plusieurs lignes à la fenêtre principale de Kate
|
||||
Comment[ga]=Cuir barra cluaisíní ina bhfuil níos mó ná ró amháin le príomhfhuinneog Kate
|
||||
Comment[gl]=Engade unha barra de lapelas en varias liñas á xanela principal de Kate
|
||||
Comment[he]=מוסיף שורת לשוניות עם כמה שורות של לשוניות אל החלון הראשי של Kate
|
||||
Comment[hu]=Többsoros lapozósáv hozzáadása a Kate főablakához
|
||||
Comment[ia]=Adde un barra con multiple rangos a fenestra principal de Kate
|
||||
Comment[it]=Aggiunge una barra di schede su più righe alla finestra principale di Kate
|
||||
Comment[kk]=Kate-тің негізгі терезесіне көп бағанды қойындысын қосу
|
||||
Comment[km]=បន្ថែមរបារផ្ទាំងដែលមានពហុបន្ទាត់ទៅបង្អួចមេរបស់ Kate
|
||||
Comment[ko]=Kate의 주 창에 여러 줄로 된 탭 표시줄 추가
|
||||
Comment[lt]=Įdeda kelių juostų kortelių juostą į Kate langą
|
||||
Comment[lv]=Pievieno ciļņu joslu ar vairākām rindām Kate galvenajam logam
|
||||
Comment[mr]=केटच्या मुख्य चौकटीत बहुलरेषेची टॅब पट्टी जोडतो
|
||||
Comment[nb]=Legger til en fanelinje med flere rader i Kates hovedvindu
|
||||
Comment[nds]=Föögt Kate sien Hööftfinster en Paneelbalken mit mehr Regen to
|
||||
Comment[nl]=Voegt een tabbladbalk met meerder regels toe aan Kate's hoofdvenster
|
||||
Comment[nn]=Legg ei fanelinje med fleire rader til hovudvindauget i Kate
|
||||
Comment[pa]=ਕੇਟ ਦੀ ਮੇਨ ਵਿੰਡੋ ਵਿੱਚ ਕਈ ਕਤਾਰਾਂ ਵਾਲੀ ਇੱਕ ਟੈਬ ਬਾਰ ਸ਼ਾਮਲ ਕਰੋ
|
||||
Comment[pl]=Dodaje pasek kart o wielu wierszach do głównego okna Kate
|
||||
Comment[pt]=Adiciona uma barra de páginas com várias linhas à janela principal do Kate
|
||||
Comment[pt_BR]=Adiciona uma barra de abas com várias linhas à janela principal do Kate
|
||||
Comment[ro]=Adaugă o bară de file cu mai multe rînduri la fereastra principală Kate
|
||||
Comment[ru]=Добавляет панель вкладок с несколькими строками в окно Kate
|
||||
Comment[si]=Kate හි ප්රධාන කවුළුවට පේළි කිහිපයක් සහිත ටැබ් තීරුවක් එක් කරයි
|
||||
Comment[sk]=Pridá panel kariet s viacerými riadkami na hlavné okno Kate
|
||||
Comment[sl]=Doda vrstico z zavihki v več vrsticah v glavno okno urejevalnika Kate
|
||||
Comment[sr]=Додаје траку језичака са више редова у главни прозор Кејт
|
||||
Comment[sr@ijekavian]=Додаје траку језичака са више редова у главни прозор Кејт
|
||||
Comment[sr@ijekavianlatin]=Dodaje traku jezičaka sa više redova u glavni prozor Kate
|
||||
Comment[sr@latin]=Dodaje traku jezičaka sa više redova u glavni prozor Kate
|
||||
Comment[sv]=Lägger till en flikrad med flera rader i Kates huvudfönster
|
||||
Comment[tg]=Панели бисёрқаторро ба тирезаи асосии барномаи Kate илова мекунад
|
||||
Comment[tr]=Kate uygulamasının ana penceresine çok satırlı bir sekme çubuğu ekler
|
||||
Comment[ug]=كۆپ قۇرلۇق بەتكۈچ بالداقتىن بىرنى Kate نىڭ ئاساسىي كۆزنىكىگە قوشىدۇ
|
||||
Comment[uk]=Додає панель вкладок з декількома рядками до головного вікна Kate
|
||||
Comment[x-test]=xxAdds a tab bar with multiple rows to Kate's main windowxx
|
||||
Comment[zh_CN]=在 Kate 主窗口上添加一个多行标签栏
|
||||
Comment[zh_TW]=在 Kate 主視窗中加入多行分頁列
|
||||
author=Dominik Haumann, dhdev@gmx.de
|
File diff suppressed because it is too large
Load diff
|
@ -1,250 +0,0 @@
|
|||
/***************************************************************************
|
||||
ktinytabbar.h
|
||||
-------------------
|
||||
begin : 2005-06-15
|
||||
copyright : (C) 2005 by Dominik Haumann
|
||||
email : dhdev@gmx.de
|
||||
|
||||
Copyright (C) 2007 Flavio Castelli <flavio.castelli@gmail.com>
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
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 KTINYTABBAR_H
|
||||
#define KTINYTABBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QIcon>
|
||||
#include <QtGui/qevent.h>
|
||||
|
||||
class KTinyTabButton;
|
||||
class KConfigBase;
|
||||
|
||||
/**
|
||||
* The \p KTinyTabBar class provides a tab bar, e.g. for tabbed documents and
|
||||
* supports multiple rows. The tab bar hides itself if there are no tabs.
|
||||
*
|
||||
* It implements the API from TrollTech's \p QTabBar with some minor changes
|
||||
* and additions.
|
||||
*
|
||||
* @author Dominik Haumann
|
||||
*/
|
||||
class KTinyTabBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* Defines the tab button's style.
|
||||
*/
|
||||
enum ButtonStyle
|
||||
{
|
||||
Push=0, ///< default push button
|
||||
Flat ///< flat push button
|
||||
};
|
||||
|
||||
/**
|
||||
* Sort types.
|
||||
*/
|
||||
enum SortType
|
||||
{
|
||||
OpeningOrder=0, ///< opening order
|
||||
Name, ///< alphabetically
|
||||
URL, ///< alphabetically URL based
|
||||
Extension ///< by file extension (suffix)
|
||||
};
|
||||
Q_DECLARE_FLAGS( SortTypes, SortType )
|
||||
|
||||
public:
|
||||
// NOTE: as the API here is very self-explaining the docs are in the cpp
|
||||
// file, more clean imho.
|
||||
|
||||
KTinyTabBar( QWidget *parent = 0 );
|
||||
virtual ~KTinyTabBar();
|
||||
|
||||
void load( KConfigBase* config, const QString& group );
|
||||
void save( KConfigBase* config, const QString& group ) const;
|
||||
|
||||
void setLocationTop( bool top );
|
||||
bool locationTop() const;
|
||||
|
||||
void setNumRows( int rows );
|
||||
int numRows() const;
|
||||
|
||||
void setMinimumTabWidth( int min_pixel );
|
||||
void setMaximumTabWidth( int max_pixel );
|
||||
|
||||
int minimumTabWidth() const;
|
||||
int maximumTabWidth() const;
|
||||
|
||||
void setTabHeight( int height_pixel );
|
||||
int tabHeight() const;
|
||||
|
||||
int addTab( const QString& docurl, const QString& text );
|
||||
int addTab( const QString& docurl, const QIcon& pixmap, const QString& text );
|
||||
void removeTab( int button_id );
|
||||
|
||||
int currentTab() const;
|
||||
// corresponding SLOT: void setCurrentTab( int button_id );
|
||||
|
||||
bool containsTab( int button_id ) const;
|
||||
|
||||
void setTabURL( int button_id, const QString& docurl );
|
||||
QString tabURL( int button_id ) const;
|
||||
|
||||
void setTabText( int button_id, const QString& text );
|
||||
QString tabText( int button_id ) const;
|
||||
|
||||
void setTabIcon( int button_id, const QIcon& pixmap );
|
||||
QIcon tabIcon( int button_id ) const;
|
||||
|
||||
void setTabModified( int button_id, bool modified );
|
||||
bool isTabModified( int button_id ) const;
|
||||
|
||||
void setHighlightModifiedTabs( bool modified );
|
||||
bool highlightModifiedTabs() const;
|
||||
|
||||
void setModifiedTabsColor( const QColor& color );
|
||||
QColor modifiedTabsColor() const;
|
||||
|
||||
int count() const;
|
||||
|
||||
void setTabButtonStyle( ButtonStyle tabStyle );
|
||||
ButtonStyle tabButtonStyle() const;
|
||||
|
||||
void setTabSortType( SortType sort );
|
||||
SortType tabSortType() const;
|
||||
|
||||
void setFollowCurrentTab( bool follow );
|
||||
bool followCurrentTab() const;
|
||||
|
||||
void setHighlightPreviousTab( bool highlight );
|
||||
bool highlightPreviousTab() const;
|
||||
|
||||
void setHighlightActiveTab( bool highlight );
|
||||
bool highlightActiveTab() const;
|
||||
|
||||
void setHighlightOpacity( int value );
|
||||
int highlightOpacity() const;
|
||||
|
||||
void setPreviousTabColor( const QColor& color );
|
||||
QColor previousTabColor() const;
|
||||
|
||||
void setActiveTabColor( const QColor& color );
|
||||
QColor activeTabColor() const;
|
||||
|
||||
void setHighlightMarks( const QMap<QString, QString>& marks );
|
||||
QMap<QString, QString> highlightMarks() const;
|
||||
|
||||
public slots:
|
||||
void setCurrentTab( int button_id ); // does not emit signal
|
||||
void removeHighlightMarks();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* This signal is emitted whenever the current activated tab changes.
|
||||
*/
|
||||
void currentChanged( int button_id );
|
||||
/**
|
||||
* This signal is emitted whenever a tab should be closed.
|
||||
*/
|
||||
void closeRequest( int button_id );
|
||||
/**
|
||||
* This signal is emitted whenever a setting entry changes.
|
||||
* A special property is the location. As the tabbar is embedded it cannot
|
||||
* change its location itself. So if you find a changed location, then go
|
||||
* and change it yourself!
|
||||
*/
|
||||
void settingsChanged( KTinyTabBar* tabbar );
|
||||
|
||||
/**
|
||||
* This signal is emitted whenever a highlight mark changes.
|
||||
* Usually this is used to synchronice several tabbars.
|
||||
*/
|
||||
void highlightMarksChanged( KTinyTabBar* tabbar );
|
||||
|
||||
protected slots:
|
||||
void tabButtonActivated( KTinyTabButton* tabButton );
|
||||
void tabButtonHighlightChanged( KTinyTabButton* tabButton );
|
||||
void tabButtonCloseAllRequest();
|
||||
void tabButtonCloseRequest( KTinyTabButton* tabButton );
|
||||
void tabButtonCloseOtherRequest( KTinyTabButton* tabButton );
|
||||
void upClicked();
|
||||
void downClicked();
|
||||
void configureClicked();
|
||||
void makeCurrentTabVisible();
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent( QResizeEvent* event );
|
||||
virtual void wheelEvent( QWheelEvent* event );
|
||||
|
||||
|
||||
protected:
|
||||
void updateFixedHeight();
|
||||
void triggerResizeEvent();
|
||||
void updateSort();
|
||||
int currentRow() const;
|
||||
void setCurrentRow( int row );
|
||||
void updateHelperButtons( QSize new_size, int needed_rows );
|
||||
void scrollDown();
|
||||
void scrollUp();
|
||||
|
||||
private:
|
||||
bool m_locationTop;
|
||||
int m_numRows;
|
||||
int m_currentRow;
|
||||
int m_minimumTabWidth;
|
||||
int m_maximumTabWidth;
|
||||
int m_tabHeight;
|
||||
|
||||
QList< KTinyTabButton* > m_tabButtons;
|
||||
QMap< int, KTinyTabButton* > m_IDToTabButton;
|
||||
|
||||
KTinyTabButton* m_activeButton;
|
||||
KTinyTabButton* m_previousButton;
|
||||
|
||||
// buttons on the right to navigate and configure
|
||||
KTinyTabButton* m_upButton;
|
||||
KTinyTabButton* m_downButton;
|
||||
KTinyTabButton* m_configureButton;
|
||||
int m_navigateSize;
|
||||
|
||||
int m_nextID;
|
||||
|
||||
// map of highlighted tabs and colors
|
||||
QMap< QString, QString > m_highlightedTabs;
|
||||
// tab button style
|
||||
ButtonStyle m_tabButtonStyle;
|
||||
SortType m_sortType;
|
||||
bool m_highlightModifiedTabs;
|
||||
bool m_followCurrentTab;
|
||||
bool m_highlightPreviousTab;
|
||||
bool m_highlightActiveTab;
|
||||
int m_highlightOpacity;
|
||||
|
||||
// configurable and saved by KTinyTabBar
|
||||
QColor m_colorModifiedTab;
|
||||
QColor m_colorActiveTab;
|
||||
QColor m_colorPreviousTab;
|
||||
};
|
||||
|
||||
#endif // KTINYTABBAR_H
|
||||
|
||||
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on; eol unix;
|
|
@ -1,84 +0,0 @@
|
|||
/***************************************************************************
|
||||
ktinytabbarconfigdialog.cpp
|
||||
-------------------
|
||||
begin : 2005-06-19
|
||||
copyright : (C) 2005 by Dominik Haumann
|
||||
email : dhdev@gmx.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, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
***************************************************************************/
|
||||
|
||||
#include "ktinytabbarconfigdialog.h"
|
||||
#include "ktinytabbarconfigpage.h"
|
||||
#include "ktinytabbar.h"
|
||||
#include "ktinytabbutton.h"
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
|
||||
KTinyTabBarConfigDialog::KTinyTabBarConfigDialog( const KTinyTabBar* tabbar,
|
||||
QWidget *parent )
|
||||
: KDialog( parent )
|
||||
{
|
||||
setCaption( i18n( "Configure Tab Bar" ) );
|
||||
setButtons( KDialog::Cancel | KDialog::Ok );
|
||||
|
||||
m_configPage = new KTinyTabBarConfigPage( this );
|
||||
|
||||
m_configPage->setLocationTop( tabbar->locationTop() );
|
||||
m_configPage->setNumberOfRows( tabbar->numRows() );
|
||||
m_configPage->setMinimumTabWidth( tabbar->minimumTabWidth() );
|
||||
m_configPage->setMaximumTabWidth( tabbar->maximumTabWidth() );
|
||||
m_configPage->setFixedTabHeight( tabbar->tabHeight() );
|
||||
m_configPage->setFollowCurrentTab( tabbar->followCurrentTab() );
|
||||
m_configPage->setTabSortType( tabbar->tabSortType() );
|
||||
m_configPage->setTabButtonStyle( tabbar->tabButtonStyle() );
|
||||
m_configPage->setHighlightModifiedTabs( tabbar->highlightModifiedTabs() );
|
||||
m_configPage->setHighlightActiveTab( tabbar->highlightActiveTab() );
|
||||
m_configPage->setHighlightPreviousTab( tabbar->highlightPreviousTab() );
|
||||
m_configPage->setModifiedTabsColor( tabbar->modifiedTabsColor() );
|
||||
m_configPage->setActiveTabColor( tabbar->activeTabColor() );
|
||||
m_configPage->setPreviousTabColor( tabbar->previousTabColor() );
|
||||
m_configPage->setHighlightOpacity( tabbar->highlightOpacity() );
|
||||
|
||||
setMainWidget( m_configPage );
|
||||
resize( 400, 300 );
|
||||
|
||||
enableButton( KDialog::Ok, false );
|
||||
connect( m_configPage, SIGNAL(changed()), this, SLOT(configChanged()) );
|
||||
connect( m_configPage, SIGNAL(removeHighlightMarks()),
|
||||
tabbar, SLOT(removeHighlightMarks()) );
|
||||
}
|
||||
|
||||
KTinyTabBarConfigDialog::~KTinyTabBarConfigDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigDialog::configChanged()
|
||||
{
|
||||
enableButton( KDialog::Ok, true );
|
||||
}
|
||||
|
||||
KTinyTabBarConfigPage* KTinyTabBarConfigDialog::configPage()
|
||||
{
|
||||
return m_configPage;
|
||||
}
|
||||
|
||||
#include "moc_ktinytabbarconfigdialog.cpp"
|
||||
|
||||
// kate: space-indent on; tab-width 4; replace-tabs off; eol unix;
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/***************************************************************************
|
||||
ktinytabbarconfigdialog.h
|
||||
-------------------
|
||||
begin : 2005-06-19
|
||||
copyright : (C) 2005 by Dominik Haumann
|
||||
email : dhdev@gmx.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, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef KTINYTABBARCONFIGDIALOG_H
|
||||
#define KTINYTABBARCONFIGDIALOG_H
|
||||
|
||||
#include <kdialog.h>
|
||||
|
||||
|
||||
class KTinyTabBar;
|
||||
class KTinyTabBarConfigPage;
|
||||
|
||||
/**
|
||||
* The class @p KTinyTabBarConfigDialog provides a configuration dialog
|
||||
* for the @p KTinyTabBar widget. It is only a wrapper dialog for
|
||||
* @p KTinyTabBarConfigPage. It's mainly for private usage. If the return code
|
||||
* is @p KDialog::Accepted an option changed for sure.
|
||||
*
|
||||
* @author Dominik Haumann
|
||||
*/
|
||||
class KTinyTabBarConfigDialog
|
||||
: public KDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit KTinyTabBarConfigDialog( const KTinyTabBar* tabbar, QWidget *parent = 0 );
|
||||
~KTinyTabBarConfigDialog();
|
||||
|
||||
KTinyTabBarConfigPage* configPage();
|
||||
|
||||
protected slots:
|
||||
void configChanged();
|
||||
|
||||
private:
|
||||
KTinyTabBarConfigPage* m_configPage;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// kate: space-indent on; tab-width 4; replace-tabs off; eol unix;
|
|
@ -1,426 +0,0 @@
|
|||
/***************************************************************************
|
||||
ktinytabbarconfigpage.cpp
|
||||
-------------------
|
||||
begin : 2005-06-19
|
||||
copyright : (C) 2005 by Dominik Haumann
|
||||
email : dhdev@gmx.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, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
***************************************************************************/
|
||||
|
||||
#include "ktinytabbarconfigpage.h"
|
||||
#include "ktinytabbutton.h"
|
||||
|
||||
#include <QSpinBox>
|
||||
#include <QGroupBox>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QGridLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QRadioButton>
|
||||
#include <QSlider>
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <klocale.h>
|
||||
#include <kglobal.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kcolorbutton.h>
|
||||
#include <ktabwidget.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
KTinyTabBarConfigPage::KTinyTabBarConfigPage( QWidget *parent )
|
||||
: QWidget( parent )
|
||||
, Ui::TabBarConfigWidget()
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
// preview group box
|
||||
QHBoxLayout* hlPreview = new QHBoxLayout( gbPreview );
|
||||
m_previewMinimum = new KTinyTabButton( QString(), i18n( "minimum size" ), 0, true, gbPreview );
|
||||
m_previewMaximum = new KTinyTabButton( QString(), i18n( "maximum size" ), 1, true, gbPreview );
|
||||
hlPreview->addWidget( m_previewMinimum );
|
||||
hlPreview->addWidget( m_previewMaximum );
|
||||
|
||||
connect(btnClearCache, SIGNAL(clicked()),
|
||||
this, SIGNAL(removeHighlightMarks()));
|
||||
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setupDefaults()
|
||||
{
|
||||
// location
|
||||
cmbLocation->setCurrentIndex(0);
|
||||
|
||||
// follow current tab
|
||||
chkFollowActive->setChecked(true);
|
||||
|
||||
// sort by
|
||||
cmbSorting->setCurrentIndex(0);
|
||||
|
||||
// tab sizes group box
|
||||
sbMinWidth->setValue(150);
|
||||
sbMaxWidth->setValue(200);
|
||||
sbHeight->setValue(22);
|
||||
|
||||
// button style group
|
||||
cmbStyle->setCurrentIndex(0);
|
||||
|
||||
// tab highlighting
|
||||
chkModified->setChecked(false);
|
||||
colModified->setEnabled(false);
|
||||
colModified->setColor(Qt::red);
|
||||
chkActive->setChecked(false);
|
||||
colActive->setEnabled(false);
|
||||
colActive->setColor(Qt::blue);
|
||||
chkPrevious->setChecked(false);
|
||||
colPrevious->setEnabled(false);
|
||||
colPrevious->setColor(Qt::yellow);
|
||||
|
||||
slOpacity->setValue( 20 );
|
||||
|
||||
|
||||
// preview
|
||||
m_previewMinimum->setActivated( true );
|
||||
m_previewMinimum->setFixedSize( minimumTabWidth(), fixedTabHeight() );
|
||||
m_previewMaximum->setFixedSize( maximumTabWidth(), fixedTabHeight() );
|
||||
m_previewMinimum->setHighlightOpacity( highlightOpacity() );
|
||||
m_previewMaximum->setHighlightOpacity( highlightOpacity() );
|
||||
m_previewMinimum->setTabButtonStyle( tabButtonStyle() );
|
||||
m_previewMaximum->setTabButtonStyle( tabButtonStyle() );
|
||||
m_previewMinimum->setHighlightActiveTab( highlightActiveTab() );
|
||||
m_previewMinimum->setHighlightPreviousTab( highlightPreviousTab() );
|
||||
m_previewMaximum->setHighlightActiveTab( highlightActiveTab() );
|
||||
m_previewMaximum->setHighlightPreviousTab( highlightPreviousTab() );
|
||||
|
||||
m_previewMinimum->setHighlightModifiedTabs( false );
|
||||
m_previewMaximum->setHighlightModifiedTabs( true );
|
||||
m_previewMaximum->setModifiedTabsColor( modifiedTabsColor() );
|
||||
m_previewMaximum->setModified( true );
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setupConnections()
|
||||
{
|
||||
// location: nothing
|
||||
connect(cmbLocation, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
|
||||
|
||||
// rows group box
|
||||
connect(sbRows, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
|
||||
connect(chkFollowActive, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||
|
||||
// sort by group box
|
||||
connect(cmbSorting, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
|
||||
|
||||
// tab sizes group box
|
||||
connect(sbMinWidth, SIGNAL(valueChanged(int)), this, SLOT(minimumTabWidthChanged(int)));
|
||||
connect(sbMaxWidth, SIGNAL(valueChanged(int)), this, SLOT(maximumTabWidthChanged(int)));
|
||||
connect(sbHeight, SIGNAL(valueChanged(int)), this, SLOT(fixedTabHeightChanged(int)));
|
||||
|
||||
// button style group
|
||||
connect(cmbStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(buttonStyleChanged(int)));
|
||||
|
||||
// tab highlighting
|
||||
connect(chkModified, SIGNAL(toggled(bool)), this, SLOT(highlightModifiedTabsChanged(bool)));
|
||||
connect(colModified, SIGNAL(changed(QColor)), this, SLOT(modifiedTabsColorChanged(QColor)));
|
||||
connect(chkActive, SIGNAL(toggled(bool)), this, SLOT(highlightActiveTabChanged(bool)));
|
||||
connect(chkPrevious, SIGNAL(toggled(bool)), this, SLOT(highlightPreviousTabChanged(bool)));
|
||||
connect(colActive, SIGNAL(changed(QColor)), this, SLOT(activeTabColorChanged(QColor)));
|
||||
connect(colPrevious, SIGNAL(changed(QColor)), this, SLOT(previousTabColorChanged(QColor)));
|
||||
connect(slOpacity, SIGNAL(valueChanged(int)), this, SLOT(highlightOpacityChanged(int)));
|
||||
|
||||
// preview
|
||||
connect(m_previewMinimum, SIGNAL(activated(KTinyTabButton*)), this, SLOT(buttonActivated(KTinyTabButton*)));
|
||||
connect(m_previewMaximum, SIGNAL(activated(KTinyTabButton*)), this, SLOT(buttonActivated(KTinyTabButton*)));
|
||||
}
|
||||
|
||||
KTinyTabBarConfigPage::~KTinyTabBarConfigPage()
|
||||
{
|
||||
}
|
||||
|
||||
//BEGIN protected slots
|
||||
|
||||
void KTinyTabBarConfigPage::minimumTabWidthChanged( int value )
|
||||
{
|
||||
m_previewMinimum->setFixedWidth( value );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::maximumTabWidthChanged( int value )
|
||||
{
|
||||
m_previewMaximum->setFixedWidth( value );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::fixedTabHeightChanged( int value )
|
||||
{
|
||||
m_previewMinimum->setFixedHeight( value );
|
||||
m_previewMaximum->setFixedHeight( value );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::buttonStyleChanged(int index)
|
||||
{
|
||||
KTinyTabBar::ButtonStyle style = static_cast<KTinyTabBar::ButtonStyle>(index);
|
||||
m_previewMinimum->setTabButtonStyle(style);
|
||||
m_previewMaximum->setTabButtonStyle(style);
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::highlightActiveTabChanged( bool highlight )
|
||||
{
|
||||
m_previewMinimum->setHighlightActiveTab( highlight );
|
||||
m_previewMaximum->setHighlightActiveTab( highlight );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::highlightPreviousTabChanged( bool highlight )
|
||||
{
|
||||
m_previewMinimum->setHighlightPreviousTab( highlight );
|
||||
m_previewMaximum->setHighlightPreviousTab( highlight );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::activeTabColorChanged( const QColor& newColor )
|
||||
{
|
||||
m_previewMinimum->setActiveTabColor( newColor );
|
||||
m_previewMaximum->setActiveTabColor( newColor );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::previousTabColorChanged( const QColor& newColor )
|
||||
{
|
||||
m_previewMinimum->setPreviousTabColor( newColor );
|
||||
m_previewMaximum->setPreviousTabColor( newColor );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::highlightOpacityChanged( int value )
|
||||
{
|
||||
m_previewMinimum->setHighlightOpacity( value );
|
||||
m_previewMaximum->setHighlightOpacity( value );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::highlightModifiedTabsChanged( bool highlight )
|
||||
{
|
||||
m_previewMinimum->setHighlightModifiedTabs( highlight );
|
||||
m_previewMaximum->setHighlightModifiedTabs( highlight );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::modifiedTabsColorChanged( const QColor& newColor )
|
||||
{
|
||||
m_previewMinimum->setModifiedTabsColor( newColor );
|
||||
m_previewMaximum->setModifiedTabsColor( newColor );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void KTinyTabBarConfigPage::buttonActivated( KTinyTabButton* button )
|
||||
{
|
||||
if( button == m_previewMinimum ) {
|
||||
m_previewMinimum->setPreviousTab(false);
|
||||
m_previewMaximum->setActivated(false);
|
||||
m_previewMaximum->setPreviousTab(true);
|
||||
} else {
|
||||
m_previewMaximum->setPreviousTab(false);
|
||||
m_previewMinimum->setActivated(false);
|
||||
m_previewMinimum->setPreviousTab(true);
|
||||
}
|
||||
}
|
||||
//END protected slots
|
||||
|
||||
bool KTinyTabBarConfigPage::locationTop() const
|
||||
{
|
||||
return cmbLocation->currentIndex() == 0;
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setLocationTop( bool value )
|
||||
{
|
||||
cmbLocation->setCurrentIndex( value ? 0 : 1);
|
||||
}
|
||||
|
||||
int KTinyTabBarConfigPage::minimumTabWidth() const
|
||||
{
|
||||
return sbMinWidth->value();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setMinimumTabWidth( int value )
|
||||
{
|
||||
sbMinWidth->setValue( value );
|
||||
}
|
||||
|
||||
int KTinyTabBarConfigPage::maximumTabWidth() const
|
||||
{
|
||||
return sbMaxWidth->value();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setMaximumTabWidth( int value )
|
||||
{
|
||||
sbMaxWidth->setValue( value );
|
||||
}
|
||||
|
||||
int KTinyTabBarConfigPage::fixedTabHeight() const
|
||||
{
|
||||
return sbHeight->value();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setFixedTabHeight( int value )
|
||||
{
|
||||
sbHeight->setValue( value );
|
||||
}
|
||||
|
||||
|
||||
int KTinyTabBarConfigPage::numberOfRows() const
|
||||
{
|
||||
return sbRows->value();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setNumberOfRows( int value )
|
||||
{
|
||||
sbRows->setValue( value );
|
||||
}
|
||||
|
||||
bool KTinyTabBarConfigPage::followCurrentTab() const
|
||||
{
|
||||
return chkFollowActive->isChecked();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setFollowCurrentTab( bool value )
|
||||
{
|
||||
chkFollowActive->setChecked( value );
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setTabSortType( KTinyTabBar::SortType type )
|
||||
{
|
||||
int index = static_cast<int>(type);
|
||||
cmbSorting->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
KTinyTabBar::SortType KTinyTabBarConfigPage::tabSortType() const
|
||||
{
|
||||
return static_cast<KTinyTabBar::SortType>(cmbSorting->currentIndex());
|
||||
}
|
||||
|
||||
|
||||
void KTinyTabBarConfigPage::setTabButtonStyle( KTinyTabBar::ButtonStyle style )
|
||||
{
|
||||
int index = static_cast<int>(style);
|
||||
cmbStyle->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
KTinyTabBar::ButtonStyle KTinyTabBarConfigPage::tabButtonStyle() const
|
||||
{
|
||||
return static_cast<KTinyTabBar::ButtonStyle>(cmbStyle->currentIndex());
|
||||
}
|
||||
|
||||
|
||||
void KTinyTabBarConfigPage::setHighlightActiveTab( bool value )
|
||||
{
|
||||
chkActive->setChecked( value );
|
||||
m_previewMinimum->setHighlightActiveTab( value );
|
||||
m_previewMaximum->setHighlightActiveTab( value );
|
||||
}
|
||||
|
||||
bool KTinyTabBarConfigPage::highlightActiveTab() const
|
||||
{
|
||||
return chkActive->isChecked();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setActiveTabColor( const QColor& color )
|
||||
{
|
||||
colActive->setColor( color );
|
||||
m_previewMinimum->setActiveTabColor( color );
|
||||
m_previewMaximum->setActiveTabColor( color );
|
||||
}
|
||||
|
||||
QColor KTinyTabBarConfigPage::activeTabColor() const
|
||||
{
|
||||
return colActive->color();
|
||||
}
|
||||
|
||||
|
||||
void KTinyTabBarConfigPage::setHighlightPreviousTab( bool value )
|
||||
{
|
||||
chkPrevious->setChecked( value );
|
||||
m_previewMinimum->setHighlightPreviousTab( value );
|
||||
m_previewMaximum->setHighlightPreviousTab( value );
|
||||
}
|
||||
|
||||
bool KTinyTabBarConfigPage::highlightPreviousTab() const
|
||||
{
|
||||
return chkPrevious->isChecked();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setPreviousTabColor( const QColor& color )
|
||||
{
|
||||
colPrevious->setColor( color );
|
||||
m_previewMinimum->setPreviousTabColor( color );
|
||||
m_previewMaximum->setPreviousTabColor( color );
|
||||
}
|
||||
|
||||
QColor KTinyTabBarConfigPage::previousTabColor() const
|
||||
{
|
||||
return colPrevious->color();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setHighlightOpacity( int value )
|
||||
{
|
||||
slOpacity->setValue( value );
|
||||
m_previewMinimum->setHighlightOpacity( value );
|
||||
m_previewMaximum->setHighlightOpacity( value );
|
||||
}
|
||||
|
||||
int KTinyTabBarConfigPage::highlightOpacity() const
|
||||
{
|
||||
return slOpacity->value();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setHighlightModifiedTabs( bool modified )
|
||||
{
|
||||
chkModified->setChecked( modified );
|
||||
m_previewMinimum->setHighlightModifiedTabs( modified );
|
||||
m_previewMaximum->setHighlightModifiedTabs( modified );
|
||||
}
|
||||
|
||||
bool KTinyTabBarConfigPage::highlightModifiedTabs() const
|
||||
{
|
||||
return chkModified->isChecked();
|
||||
}
|
||||
|
||||
void KTinyTabBarConfigPage::setModifiedTabsColor( const QColor& color )
|
||||
{
|
||||
colModified->setColor( color );
|
||||
m_previewMinimum->setModifiedTabsColor( color );
|
||||
m_previewMaximum->setModifiedTabsColor( color );
|
||||
}
|
||||
|
||||
QColor KTinyTabBarConfigPage::modifiedTabsColor() const
|
||||
{
|
||||
return colModified->color();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "moc_ktinytabbarconfigpage.cpp"
|
||||
|
||||
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs off; eol unix;
|
|
@ -1,139 +0,0 @@
|
|||
/***************************************************************************
|
||||
ktinytabbarconfigpage.h
|
||||
-------------------
|
||||
begin : 2005-06-19
|
||||
copyright : (C) 2005 by Dominik Haumann
|
||||
email : dhdev@gmx.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, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef KTINYTABBARCONFIGPAGE_H
|
||||
#define KTINYTABBARCONFIGPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QColor>
|
||||
|
||||
#include "ktinytabbar.h"
|
||||
#include "ui_tabbarconfigwidget.h"
|
||||
|
||||
class KColorButton;
|
||||
class KTinyTabButton;
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QRadioButton>
|
||||
#include <QSlider>
|
||||
#include <QSpinBox>
|
||||
|
||||
/**
|
||||
* The class @p KTinyTabBarConfigPage provides a config page for
|
||||
* @p KTinyTabBar. It provides an interface to set the number of rows,
|
||||
* minimum and maximum tab width, and the tab height.
|
||||
*
|
||||
* @author Dominik Haumann
|
||||
*/
|
||||
class KTinyTabBarConfigPage
|
||||
: public QWidget
|
||||
, private Ui::TabBarConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KTinyTabBarConfigPage( QWidget *parent = 0 );
|
||||
|
||||
~KTinyTabBarConfigPage();
|
||||
|
||||
|
||||
bool locationTop() const;
|
||||
void setLocationTop( bool value );
|
||||
|
||||
|
||||
int minimumTabWidth() const;
|
||||
void setMinimumTabWidth( int value );
|
||||
|
||||
int maximumTabWidth() const;
|
||||
void setMaximumTabWidth( int value );
|
||||
|
||||
int fixedTabHeight() const;
|
||||
void setFixedTabHeight( int value );
|
||||
|
||||
|
||||
int numberOfRows() const;
|
||||
void setNumberOfRows( int value );
|
||||
|
||||
bool followCurrentTab() const;
|
||||
void setFollowCurrentTab( bool value );
|
||||
|
||||
void setTabSortType( KTinyTabBar::SortType type );
|
||||
KTinyTabBar::SortType tabSortType() const;
|
||||
|
||||
void setTabButtonStyle( KTinyTabBar::ButtonStyle style );
|
||||
KTinyTabBar::ButtonStyle tabButtonStyle() const;
|
||||
|
||||
|
||||
void setHighlightActiveTab( bool value );
|
||||
bool highlightActiveTab() const;
|
||||
|
||||
void setActiveTabColor( const QColor& color );
|
||||
QColor activeTabColor() const;
|
||||
|
||||
void setHighlightPreviousTab( bool value );
|
||||
bool highlightPreviousTab() const;
|
||||
|
||||
void setPreviousTabColor( const QColor& color );
|
||||
QColor previousTabColor() const;
|
||||
|
||||
void setHighlightOpacity( int value );
|
||||
int highlightOpacity() const;
|
||||
|
||||
void setHighlightModifiedTabs( bool modified );
|
||||
bool highlightModifiedTabs() const;
|
||||
|
||||
void setModifiedTabsColor( const QColor& color );
|
||||
QColor modifiedTabsColor() const;
|
||||
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
void removeHighlightMarks();
|
||||
|
||||
protected slots:
|
||||
void minimumTabWidthChanged(int value);
|
||||
void maximumTabWidthChanged(int value);
|
||||
void fixedTabHeightChanged(int value);
|
||||
void buttonStyleChanged(int index);
|
||||
void highlightActiveTabChanged( bool highlight );
|
||||
void highlightPreviousTabChanged( bool highlight );
|
||||
void activeTabColorChanged( const QColor& newColor );
|
||||
void previousTabColorChanged( const QColor& newColor );
|
||||
void highlightOpacityChanged( int value );
|
||||
void highlightModifiedTabsChanged( bool highlight );
|
||||
void modifiedTabsColorChanged( const QColor& newColor );
|
||||
|
||||
void buttonActivated( KTinyTabButton* );
|
||||
|
||||
protected:
|
||||
void setupDefaults();
|
||||
void setupConnections();
|
||||
|
||||
private:
|
||||
KTinyTabButton* m_previewMinimum;
|
||||
KTinyTabButton* m_previewMaximum;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// kate: space-indent on; indent-width 2; tab-width 4; replace-tabs off; eol unix;
|
|
@ -1,398 +0,0 @@
|
|||
/***************************************************************************
|
||||
ktinytabbutton.cpp
|
||||
-------------------
|
||||
begin : 2005-06-15
|
||||
copyright : (C) 2005 by Dominik Haumann
|
||||
email : dhdev@gmx.de
|
||||
|
||||
Copyright (C) 2007 Flavio Castelli <flavio.castelli@gmail.com>
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
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 "ktinytabbutton.h"
|
||||
#include "moc_ktinytabbutton.cpp"
|
||||
|
||||
#include <kcolordialog.h>
|
||||
#include <kdebug.h>
|
||||
#include <kiconloader.h>
|
||||
#include <klocale.h>
|
||||
#include <kglobalsettings.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QIcon>
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
#include <QStyle>
|
||||
#include <QtGui/qstyleoption.h>
|
||||
#include <qdrawutil.h>
|
||||
|
||||
QColor KTinyTabButton::s_predefinedColors[] = { Qt::red, Qt::yellow, Qt::green, Qt::cyan, Qt::blue, Qt::magenta };
|
||||
const int KTinyTabButton::s_colorCount = 6;
|
||||
int KTinyTabButton::s_currentColor = 0;
|
||||
|
||||
|
||||
KTinyTabButton::KTinyTabButton( const QString& docurl, const QString& caption,
|
||||
int button_id, bool blockContextMenu, QWidget *parent )
|
||||
: QPushButton( parent )
|
||||
{
|
||||
setFont(KGlobalSettings::toolBarFont());
|
||||
setCheckable( true );
|
||||
setFocusPolicy( Qt::NoFocus );
|
||||
setMinimumWidth( 1 );
|
||||
|
||||
if( blockContextMenu )
|
||||
setContextMenuPolicy( Qt::NoContextMenu );
|
||||
|
||||
m_buttonId = button_id;
|
||||
m_tabButtonStyle = KTinyTabBar::Push;
|
||||
m_highlightModifiedTab = false;
|
||||
m_isPreviousTab = false;
|
||||
m_highlightColor = QColor(); // set to invalid color
|
||||
m_highlightActiveTab = false;
|
||||
m_highlightPreviousTab = false;
|
||||
m_highlightOpacity = 20;
|
||||
m_modified = false;
|
||||
|
||||
setIcon( QIcon() );
|
||||
setText( caption );
|
||||
setURL( docurl );
|
||||
|
||||
connect( this, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
|
||||
}
|
||||
|
||||
KTinyTabButton::~KTinyTabButton()
|
||||
{
|
||||
}
|
||||
|
||||
void KTinyTabButton::setURL( const QString& docurl )
|
||||
{
|
||||
m_url = docurl;
|
||||
if( !m_url.isEmpty() )
|
||||
setToolTip( m_url );
|
||||
else
|
||||
setToolTip( text() );
|
||||
}
|
||||
|
||||
QString KTinyTabButton::url() const
|
||||
{
|
||||
return m_url;
|
||||
}
|
||||
|
||||
|
||||
void KTinyTabButton::buttonClicked()
|
||||
{
|
||||
// once down, stay down until another tab is activated
|
||||
if( isChecked() )
|
||||
emit activated( this );
|
||||
else
|
||||
setChecked( true );
|
||||
}
|
||||
|
||||
void KTinyTabButton::setActivated( bool active )
|
||||
{
|
||||
if( isChecked() == active ) return;
|
||||
setChecked( active );
|
||||
update();
|
||||
}
|
||||
|
||||
bool KTinyTabButton::isActivated() const
|
||||
{
|
||||
return isChecked();
|
||||
}
|
||||
|
||||
void KTinyTabButton::paintEvent( QPaintEvent* ev )
|
||||
{
|
||||
const int opac = m_highlightOpacity;
|
||||
const int comp = 100 - opac;
|
||||
|
||||
QColor mix = ( highlightActiveTab() && isActivated() ) ? m_colorActiveTab :
|
||||
( ( highlightPreviousTab() && previousTab() ) ? m_colorPreviousTab :
|
||||
m_highlightColor );
|
||||
QPalette pal = QApplication::palette();
|
||||
if( isModified() && highlightModifiedTabs() )
|
||||
pal.setColor( QPalette::ButtonText, modifiedTabsColor() );
|
||||
|
||||
|
||||
switch( tabButtonStyle() )
|
||||
{
|
||||
case KTinyTabBar::Push:
|
||||
case KTinyTabBar::Flat:
|
||||
{
|
||||
if( m_highlightColor.isValid()
|
||||
|| ( isActivated() && highlightActiveTab() )
|
||||
|| ( previousTab() && highlightPreviousTab() ) )
|
||||
{
|
||||
QColor col( pal.button().color() );
|
||||
col.setRed( ( col.red()*comp + mix.red()*opac ) / 100 );
|
||||
col.setGreen( ( col.green()*comp + mix.green()*opac ) / 100 );
|
||||
col.setBlue( ( col.blue()*comp + mix.blue()*opac ) / 100 );
|
||||
pal.setColor( QPalette::Button, col );
|
||||
if( tabButtonStyle() == KTinyTabBar::Flat )
|
||||
pal.setColor( QPalette::Background, col );
|
||||
}
|
||||
setPalette( pal );
|
||||
QPushButton::paintEvent( ev );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KTinyTabButton::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( SmallIcon( "colors" ) ), i18n( "C&ustom Color..." ) );
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* aCloseTab = menu.addAction( i18n( "&Close Tab" ) );
|
||||
QAction* aCloseOtherTabs = menu.addAction( i18n( "Close &Other Tabs" ) );
|
||||
QAction* aCloseAllTabs = menu.addAction( i18n( "Close &All Tabs" ) );
|
||||
|
||||
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;
|
||||
int result = KColorDialog::getColor( newColor, m_highlightColor, this );
|
||||
if ( result == KColorDialog::Accepted )
|
||||
{
|
||||
setHighlightColor( newColor );
|
||||
emit highlightChanged( this );
|
||||
}
|
||||
} else if( choice == aCloseTab ) {
|
||||
emit closeRequest( this );
|
||||
} else if (choice == aCloseOtherTabs) {
|
||||
emit closeOtherTabsRequest (this);
|
||||
} else if (choice == aCloseAllTabs) {
|
||||
emit closeAllTabsRequest ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void KTinyTabButton::mousePressEvent( QMouseEvent* ev )
|
||||
{
|
||||
if (ev->button() == Qt::MiddleButton) {
|
||||
if (ev->modifiers() & Qt::ControlModifier) {
|
||||
// clear tab highlight
|
||||
setHighlightColor(QColor());
|
||||
} else {
|
||||
setHighlightColor(s_predefinedColors[s_currentColor]);
|
||||
if (++s_currentColor >= s_colorCount)
|
||||
s_currentColor = 0;
|
||||
}
|
||||
ev->accept();
|
||||
} else {
|
||||
QPushButton::mousePressEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
void KTinyTabButton::setButtonID( int button_id )
|
||||
{
|
||||
m_buttonId = button_id;
|
||||
}
|
||||
|
||||
int KTinyTabButton::buttonID() const
|
||||
{
|
||||
return m_buttonId;
|
||||
}
|
||||
|
||||
void KTinyTabButton::setHighlightColor( const QColor& color )
|
||||
{
|
||||
if( color.isValid() )
|
||||
{
|
||||
m_highlightColor = color;
|
||||
update();
|
||||
}
|
||||
else if( m_highlightColor.isValid() )
|
||||
{
|
||||
m_highlightColor = QColor();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
QColor KTinyTabButton::highlightColor() const
|
||||
{
|
||||
return m_highlightColor;
|
||||
}
|
||||
|
||||
void KTinyTabButton::setTabButtonStyle( KTinyTabBar::ButtonStyle tabStyle )
|
||||
{
|
||||
if( m_tabButtonStyle == tabStyle )
|
||||
return;
|
||||
|
||||
const bool flat = tabStyle == KTinyTabBar::Flat;
|
||||
setFlat( flat );
|
||||
setAutoFillBackground( flat );
|
||||
m_tabButtonStyle = tabStyle;
|
||||
update();
|
||||
}
|
||||
|
||||
KTinyTabBar::ButtonStyle KTinyTabButton::tabButtonStyle() const
|
||||
{
|
||||
return m_tabButtonStyle;
|
||||
}
|
||||
|
||||
void KTinyTabButton::setPreviousTab( bool previous )
|
||||
{
|
||||
m_isPreviousTab = previous;
|
||||
update();
|
||||
}
|
||||
|
||||
bool KTinyTabButton::previousTab() const
|
||||
{
|
||||
return m_isPreviousTab;
|
||||
}
|
||||
|
||||
void KTinyTabButton::setHighlightOpacity( int value )
|
||||
{
|
||||
m_highlightOpacity = value;
|
||||
update();
|
||||
}
|
||||
|
||||
int KTinyTabButton::highlightOpacity() const
|
||||
{
|
||||
return m_highlightOpacity;
|
||||
}
|
||||
|
||||
void KTinyTabButton::setHighlightActiveTab( bool value )
|
||||
{
|
||||
m_highlightActiveTab = value;
|
||||
update();
|
||||
}
|
||||
|
||||
bool KTinyTabButton::highlightActiveTab()
|
||||
{
|
||||
return m_highlightActiveTab;
|
||||
}
|
||||
|
||||
void KTinyTabButton::setHighlightPreviousTab( bool value )
|
||||
{
|
||||
m_highlightPreviousTab = value;
|
||||
update();
|
||||
}
|
||||
|
||||
bool KTinyTabButton::highlightPreviousTab()
|
||||
{
|
||||
return m_highlightPreviousTab;
|
||||
}
|
||||
|
||||
|
||||
void KTinyTabButton::setPreviousTabColor( const QColor& color )
|
||||
{
|
||||
m_colorPreviousTab = color;
|
||||
if( highlightPreviousTab() )
|
||||
update();
|
||||
}
|
||||
|
||||
QColor KTinyTabButton::previousTabColor() const
|
||||
{
|
||||
return m_colorPreviousTab;
|
||||
}
|
||||
|
||||
void KTinyTabButton::setActiveTabColor( const QColor& color )
|
||||
{
|
||||
m_colorActiveTab = color;
|
||||
if( isActivated() )
|
||||
update();
|
||||
}
|
||||
|
||||
QColor KTinyTabButton::activeTabColor() const
|
||||
{
|
||||
return m_colorActiveTab;
|
||||
}
|
||||
|
||||
void KTinyTabButton::setHighlightModifiedTabs( bool highlight )
|
||||
{
|
||||
m_highlightModifiedTab = highlight;
|
||||
if( isModified() )
|
||||
update();
|
||||
}
|
||||
|
||||
bool KTinyTabButton::highlightModifiedTabs() const
|
||||
{
|
||||
return m_highlightModifiedTab;
|
||||
}
|
||||
|
||||
void KTinyTabButton::setModifiedTabsColor( const QColor& color )
|
||||
{
|
||||
m_colorModifiedTab = color;
|
||||
if( isModified() )
|
||||
update();
|
||||
}
|
||||
|
||||
QColor KTinyTabButton::modifiedTabsColor() const
|
||||
{
|
||||
return m_colorModifiedTab;
|
||||
}
|
||||
|
||||
|
||||
void KTinyTabButton::setModified( bool modified )
|
||||
{
|
||||
m_modified = modified;
|
||||
update();
|
||||
}
|
||||
|
||||
bool KTinyTabButton::isModified() const
|
||||
{
|
||||
return m_modified;
|
||||
}
|
||||
|
||||
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on; eol unix;
|
|
@ -1,242 +0,0 @@
|
|||
/***************************************************************************
|
||||
ktinytabbutton.h
|
||||
-------------------
|
||||
begin : 2005-06-15
|
||||
copyright : (C) 2005 by Dominik Haumann
|
||||
email : dhdev@gmx.de
|
||||
|
||||
Copyright (C) 2007 Flavio Castelli <flavio.castelli@gmail.com>
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
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 TINYTABBUTTON_H
|
||||
#define TINYTABBUTTON_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include "ktinytabbar.h"
|
||||
|
||||
|
||||
/**
|
||||
* A \p KTinyTabButton represents a button on the tab bar. It can either be
|
||||
* \e activated or \e deactivated. If the state is \e deactivated it will
|
||||
* be @e activated when the mouse is pressed. It then emits the signal
|
||||
* @p activated(). The \p KTinyTabButton's caption can be set with \p setText()
|
||||
* and an additional pixmap can be shown with \p setPixmap().
|
||||
*
|
||||
* @author Dominik Haumann
|
||||
*/
|
||||
class KTinyTabButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructs a new tab bar button with \a caption and \a parent. If
|
||||
* \e blockContextMenu is \e false the context menu will be blocked, i.e.
|
||||
* hidden. If the @p docurl is unknown, pass QString().
|
||||
*/
|
||||
KTinyTabButton( const QString& docurl, const QString& caption, int button_id,
|
||||
bool blockContextMenu = true, QWidget *parent = 0 );
|
||||
|
||||
virtual ~KTinyTabButton();
|
||||
|
||||
/**
|
||||
* Activate or deactivate the button. If the button is already down
|
||||
* and \a active is \e true nothing happens, otherwise the state toggles.
|
||||
* \note The signal \p activated is \e not emitted.
|
||||
*/
|
||||
void setActivated( bool active );
|
||||
|
||||
/**
|
||||
* Check the button status. The return value is \e true, if the button is
|
||||
* down.
|
||||
*/
|
||||
bool isActivated() const;
|
||||
|
||||
/**
|
||||
* Set a unique button id number.
|
||||
*/
|
||||
void setButtonID( int button_id );
|
||||
|
||||
/**
|
||||
* Get the unique id number.
|
||||
*/
|
||||
int buttonID() const;
|
||||
|
||||
/**
|
||||
* Set the document's url to @p docurl. If unknown, pass QString().
|
||||
*/
|
||||
void setURL( const QString& docurl );
|
||||
|
||||
/**
|
||||
* Get the document's url.
|
||||
*/
|
||||
QString url() const;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
QColor highlightColor() const;
|
||||
|
||||
/**
|
||||
* Set the highlight opacity to @p value.
|
||||
* @param value opacity between 0..100
|
||||
*/
|
||||
void setHighlightOpacity( int value );
|
||||
|
||||
/**
|
||||
* Get the highlight opacity
|
||||
* @return opacity
|
||||
*/
|
||||
int highlightOpacity() const;
|
||||
|
||||
/**
|
||||
* Set whether the tab was previously selected.
|
||||
* @param previous truth vlaue
|
||||
*/
|
||||
void setPreviousTab( bool previous );
|
||||
|
||||
/**
|
||||
* Check whether the tab is the previously selected tab.
|
||||
* @return true, if tab was active before the current active tab
|
||||
*/
|
||||
bool previousTab() const;
|
||||
|
||||
/**
|
||||
* Set the tabbutton style.
|
||||
* @param tabStyle button style
|
||||
*/
|
||||
void setTabButtonStyle( KTinyTabBar::ButtonStyle tabStyle );
|
||||
|
||||
/**
|
||||
* Get the tabbutton style
|
||||
* @return button style
|
||||
*/
|
||||
KTinyTabBar::ButtonStyle tabButtonStyle() const;
|
||||
|
||||
/**
|
||||
* Set whether an active tab should be highlighted.
|
||||
*/
|
||||
void setHighlightActiveTab( bool value );
|
||||
/**
|
||||
* Get whether an active tab should be highlighted.
|
||||
*/
|
||||
bool highlightActiveTab();
|
||||
|
||||
/**
|
||||
* Set whether a previous tab should be highlighted.
|
||||
*/
|
||||
void setHighlightPreviousTab( bool value );
|
||||
/**
|
||||
* Get whether a previous tab is highlighted.
|
||||
*/
|
||||
bool highlightPreviousTab();
|
||||
|
||||
void setPreviousTabColor( const QColor& color );
|
||||
QColor previousTabColor() const;
|
||||
|
||||
void setActiveTabColor( const QColor& color );
|
||||
QColor activeTabColor() const;
|
||||
|
||||
void setHighlightModifiedTabs( bool highlight );
|
||||
bool highlightModifiedTabs() const;
|
||||
|
||||
void setModifiedTabsColor( const QColor& color );
|
||||
QColor modifiedTabsColor() const;
|
||||
|
||||
void setModified( bool modified );
|
||||
bool isModified() const;
|
||||
|
||||
signals:
|
||||
/**
|
||||
* Emitted whenever the button changes state from deactivated to activated.
|
||||
* @param tabbutton the pressed button (this)
|
||||
*/
|
||||
void activated( KTinyTabButton* 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( KTinyTabButton* tabbutton );
|
||||
|
||||
/**
|
||||
* Emitted whenever the user wants to close the tab button.
|
||||
* @param tabbutton the button that emitted this signal
|
||||
*/
|
||||
void closeRequest( KTinyTabButton* tabbutton );
|
||||
|
||||
/**
|
||||
* Emitted whenever the user wants to close all the tab button except the
|
||||
* selected one.
|
||||
* @param tabbutton the button that emitted this signal
|
||||
*/
|
||||
void closeOtherTabsRequest( KTinyTabButton* tabbutton );
|
||||
|
||||
/**
|
||||
* Emitted whenever the user wants to close all the tabs.
|
||||
*/
|
||||
void closeAllTabsRequest();
|
||||
|
||||
protected slots:
|
||||
void buttonClicked();
|
||||
|
||||
protected:
|
||||
/** paint eyecandy rectangles around the button */
|
||||
virtual void paintEvent( QPaintEvent* ev );
|
||||
/** support for context menu */
|
||||
virtual void contextMenuEvent( QContextMenuEvent* ev );
|
||||
/** middle mouse button changes color */
|
||||
virtual void mousePressEvent( QMouseEvent* ev );
|
||||
|
||||
|
||||
private:
|
||||
QString m_url;
|
||||
int m_buttonId;
|
||||
bool m_modified;
|
||||
bool m_highlightModifiedTab;
|
||||
bool m_highlightActiveTab;
|
||||
bool m_highlightPreviousTab;
|
||||
bool m_isPreviousTab;
|
||||
|
||||
QColor m_colorModifiedTab;
|
||||
QColor m_colorActiveTab;
|
||||
QColor m_colorPreviousTab;
|
||||
|
||||
QColor m_highlightColor;
|
||||
KTinyTabBar::ButtonStyle m_tabButtonStyle;
|
||||
int m_highlightOpacity;
|
||||
|
||||
static QColor s_predefinedColors[6];
|
||||
static const int s_colorCount;
|
||||
static int s_currentColor;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on; eol unix;
|
|
@ -1,293 +0,0 @@
|
|||
/***************************************************************************
|
||||
plugin_katetabbarextension.cpp
|
||||
-------------------
|
||||
begin : 2004-04-20
|
||||
copyright : (C) 2004-2005 by Dominik Haumann
|
||||
email : dhdev@gmx.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, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
//BEGIN INCLUDES
|
||||
#include "plugin_katetabbarextension.h"
|
||||
#include "ktinytabbar.h"
|
||||
|
||||
#include <kate/documentmanager.h>
|
||||
#include <kate/application.h>
|
||||
|
||||
#include <klocale.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
#include <kaboutdata.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <QBoxLayout>
|
||||
//END
|
||||
|
||||
|
||||
K_PLUGIN_FACTORY(KateTabBarExtensionFactory, registerPlugin<KatePluginTabBarExtension>();)
|
||||
K_EXPORT_PLUGIN(KateTabBarExtensionFactory(KAboutData("katetabbarextension","katetabbarextension",ki18n("TabBarExtension"), "0.1", ki18n("TabBar extension"), KAboutData::License_LGPL_V2)) )
|
||||
|
||||
|
||||
//BEGIN PluginView
|
||||
PluginView::PluginView( Kate::MainWindow* mainwindow )
|
||||
: Kate::PluginView( mainwindow )
|
||||
{
|
||||
tabbar = new KTinyTabBar( mainWindow()->centralWidget() );
|
||||
|
||||
QBoxLayout* layout = qobject_cast<QBoxLayout*>(mainWindow()->centralWidget()->layout());
|
||||
layout->insertWidget( 0, tabbar );
|
||||
|
||||
connect( Kate::application()->documentManager(), SIGNAL(documentCreated(KTextEditor::Document*)),
|
||||
this, SLOT(slotDocumentCreated(KTextEditor::Document*)) );
|
||||
connect( Kate::application()->documentManager(), SIGNAL(documentDeleted(KTextEditor::Document*)),
|
||||
this, SLOT(slotDocumentDeleted(KTextEditor::Document*)) );
|
||||
connect( mainWindow(), SIGNAL(viewChanged()),
|
||||
this, SLOT(slotViewChanged()) );
|
||||
|
||||
connect( tabbar, SIGNAL(currentChanged(int)),
|
||||
this, SLOT(currentTabChanged(int)) );
|
||||
connect( tabbar, SIGNAL(closeRequest(int)),
|
||||
this, SLOT(closeTabRequest(int)) );
|
||||
|
||||
// add already existing documents
|
||||
foreach( KTextEditor::Document* doc, Kate::application()->documentManager()->documents() )
|
||||
slotDocumentCreated( doc );
|
||||
}
|
||||
|
||||
PluginView::~PluginView()
|
||||
{
|
||||
delete tabbar;
|
||||
}
|
||||
|
||||
void PluginView::readSessionConfig (KConfigBase* config, const QString& groupPrefix)
|
||||
{
|
||||
tabbar->load( config, groupPrefix + ":view" );
|
||||
updateLocation();
|
||||
}
|
||||
|
||||
void PluginView::writeSessionConfig (KConfigBase* config, const QString& groupPrefix)
|
||||
{
|
||||
tabbar->save( config, groupPrefix + ":view" );
|
||||
}
|
||||
|
||||
void PluginView::updateLocation()
|
||||
{
|
||||
QBoxLayout* layout = qobject_cast<QBoxLayout*>(mainWindow()->centralWidget()->layout());
|
||||
if( !layout ) return;
|
||||
|
||||
layout->removeWidget( tabbar );
|
||||
layout->insertWidget( tabbar->locationTop()?0:-1, tabbar );
|
||||
}
|
||||
|
||||
|
||||
void PluginView::currentTabChanged( int button_id )
|
||||
{
|
||||
mainWindow()->activateView( id2doc[button_id] );
|
||||
}
|
||||
|
||||
void PluginView::closeTabRequest( int button_id )
|
||||
{
|
||||
Kate::application()->documentManager()->closeDocument( id2doc[button_id] );
|
||||
}
|
||||
|
||||
void PluginView::slotDocumentCreated( KTextEditor::Document* document )
|
||||
{
|
||||
if( !document )
|
||||
return;
|
||||
|
||||
connect( document, SIGNAL(modifiedChanged(KTextEditor::Document*)),
|
||||
this, SLOT(slotDocumentChanged(KTextEditor::Document*)) );
|
||||
connect( document, SIGNAL( modifiedOnDisk( KTextEditor::Document*, bool,
|
||||
KTextEditor::ModificationInterface::ModifiedOnDiskReason ) ),
|
||||
this, SLOT( slotModifiedOnDisc( KTextEditor::Document*, bool,
|
||||
KTextEditor::ModificationInterface::ModifiedOnDiskReason ) ) );
|
||||
connect( document, SIGNAL(documentNameChanged(KTextEditor::Document*)),
|
||||
this, SLOT(slotNameChanged(KTextEditor::Document*)) );
|
||||
|
||||
|
||||
int tabID = tabbar->addTab( document->url().prettyUrl(), document->documentName() );
|
||||
id2doc[tabID] = document;
|
||||
doc2id[document] = tabID;
|
||||
}
|
||||
|
||||
void PluginView::slotDocumentDeleted( KTextEditor::Document* document )
|
||||
{
|
||||
// kDebug() << "slotDocumentDeleted ";
|
||||
int tabID = doc2id[document];
|
||||
|
||||
tabbar->removeTab( tabID );
|
||||
doc2id.remove( document );
|
||||
id2doc.remove( tabID );
|
||||
}
|
||||
|
||||
void PluginView::slotViewChanged()
|
||||
{
|
||||
KTextEditor::View *view = mainWindow()->activeView();
|
||||
if( !view )
|
||||
return;
|
||||
|
||||
int tabID = doc2id[view->document()];
|
||||
tabbar->setCurrentTab( tabID );
|
||||
}
|
||||
|
||||
void PluginView::slotDocumentChanged( KTextEditor::Document* document )
|
||||
{
|
||||
if( !document )
|
||||
return;
|
||||
|
||||
int tabID = doc2id[document];
|
||||
if( document->isModified() )
|
||||
tabbar->setTabIcon( tabID, KIconLoader::global()
|
||||
->loadIcon( "document-save", KIconLoader::Small, 16 ) );
|
||||
else
|
||||
tabbar->setTabIcon( tabID, QIcon() );
|
||||
|
||||
tabbar->setTabModified( tabID, document->isModified() );
|
||||
}
|
||||
|
||||
void PluginView::slotNameChanged( KTextEditor::Document* document )
|
||||
{
|
||||
if( !document )
|
||||
return;
|
||||
|
||||
int tabID = doc2id[document];
|
||||
tabbar->setTabText( tabID, document->documentName() );
|
||||
if( document->url().prettyUrl() != tabbar->tabURL( tabID ) )
|
||||
tabbar->setTabURL( tabID, document->url().prettyUrl() );
|
||||
}
|
||||
|
||||
void PluginView::slotModifiedOnDisc( KTextEditor::Document* document, bool modified,
|
||||
KTextEditor::ModificationInterface::ModifiedOnDiskReason reason )
|
||||
{
|
||||
kDebug() << "modified: " << modified << ", id: " << reason;
|
||||
int tabID = doc2id[document];
|
||||
if( !modified )
|
||||
{
|
||||
tabbar->setTabIcon( tabID, QIcon() );
|
||||
tabbar->setTabModified( tabID, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE: right now the size 16 pixel is hard coded. If I omit the size
|
||||
// parameter it would use KDE defaults. So if a user requests standard
|
||||
// sized icons (because he changed his KDE defaults) the solution is to
|
||||
// omit the parameter.
|
||||
switch( reason )
|
||||
{
|
||||
case KTextEditor::ModificationInterface::OnDiskModified:
|
||||
tabbar->setTabIcon( tabID, KIconLoader::global()
|
||||
->loadIcon( "dialog-warning", KIconLoader::Small, 16 ) );
|
||||
break;
|
||||
case KTextEditor::ModificationInterface::OnDiskCreated:
|
||||
tabbar->setTabIcon( tabID, KIconLoader::global()
|
||||
->loadIcon( "document-save", KIconLoader::Small, 16 ) );
|
||||
break;
|
||||
case KTextEditor::ModificationInterface::OnDiskDeleted:
|
||||
tabbar->setTabIcon( tabID, KIconLoader::global()
|
||||
->loadIcon( "dialog-warning", KIconLoader::Small, 16 ) );
|
||||
break;
|
||||
default:
|
||||
tabbar->setTabIcon( tabID, KIconLoader::global()
|
||||
->loadIcon( "dialog-warning", KIconLoader::Small, 16 ) );
|
||||
}
|
||||
|
||||
tabbar->setTabModified( tabID, true );
|
||||
}
|
||||
}
|
||||
//END PluginView
|
||||
|
||||
|
||||
|
||||
//BEGIN KatePluginTabBarExtension
|
||||
KatePluginTabBarExtension::KatePluginTabBarExtension(
|
||||
QObject* parent, const QList<QVariant>& )
|
||||
: Kate::Plugin ( (Kate::Application*)parent)
|
||||
{
|
||||
}
|
||||
|
||||
KatePluginTabBarExtension::~KatePluginTabBarExtension()
|
||||
{
|
||||
}
|
||||
|
||||
Kate::PluginView *KatePluginTabBarExtension::createView (Kate::MainWindow *mainWindow)
|
||||
{
|
||||
PluginView *view = new PluginView( mainWindow );
|
||||
connect( view->tabbar, SIGNAL(settingsChanged(KTinyTabBar*)),
|
||||
this, SLOT(tabbarSettingsChanged(KTinyTabBar*)) );
|
||||
connect( view->tabbar, SIGNAL(highlightMarksChanged(KTinyTabBar*)),
|
||||
this, SLOT(tabbarHighlightMarksChanged(KTinyTabBar*)) );
|
||||
m_views.append( view );
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
void KatePluginTabBarExtension::readSessionConfig (KConfigBase* /*config*/, const QString& /*groupPrefix*/)
|
||||
{
|
||||
}
|
||||
|
||||
void KatePluginTabBarExtension::writeSessionConfig (KConfigBase* /*config*/, const QString& /*groupPrefix*/)
|
||||
{
|
||||
}
|
||||
|
||||
void KatePluginTabBarExtension::tabbarHighlightMarksChanged( KTinyTabBar* tabbar )
|
||||
{
|
||||
// synchronize all tabbars
|
||||
foreach( PluginView* view, m_views )
|
||||
{
|
||||
view->updateLocation();
|
||||
if( view->tabbar != tabbar )
|
||||
{
|
||||
view->tabbar->setHighlightMarks( tabbar->highlightMarks() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KatePluginTabBarExtension::tabbarSettingsChanged( KTinyTabBar* tabbar )
|
||||
{
|
||||
// synchronize all tabbars
|
||||
foreach( PluginView* view, m_views )
|
||||
{
|
||||
view->updateLocation();
|
||||
if( view->tabbar != tabbar )
|
||||
{
|
||||
view->tabbar->setLocationTop( tabbar->locationTop() );
|
||||
view->updateLocation();
|
||||
view->tabbar->setNumRows( tabbar->numRows() );
|
||||
view->tabbar->setMinimumTabWidth( tabbar->minimumTabWidth() );
|
||||
view->tabbar->setMaximumTabWidth( tabbar->maximumTabWidth() );
|
||||
view->tabbar->setTabHeight( tabbar->tabHeight() );
|
||||
view->tabbar->setTabButtonStyle( tabbar->tabButtonStyle() );
|
||||
view->tabbar->setFollowCurrentTab( tabbar->followCurrentTab() );
|
||||
view->tabbar->setTabSortType( tabbar->tabSortType() );
|
||||
view->tabbar->setHighlightModifiedTabs( tabbar->highlightModifiedTabs() );
|
||||
view->tabbar->setHighlightActiveTab( tabbar->highlightActiveTab() );
|
||||
view->tabbar->setHighlightPreviousTab( tabbar->highlightPreviousTab() );
|
||||
view->tabbar->setHighlightOpacity( tabbar->highlightOpacity() );
|
||||
view->tabbar->setModifiedTabsColor( tabbar->modifiedTabsColor() );
|
||||
view->tabbar->setActiveTabColor( tabbar->activeTabColor() );
|
||||
view->tabbar->setPreviousTabColor( tabbar->previousTabColor() );
|
||||
}
|
||||
}
|
||||
}
|
||||
//END KatePluginTabBarExtension
|
||||
|
||||
#include "moc_plugin_katetabbarextension.cpp"
|
||||
|
||||
// kate: space-indent on; indent-width 2; tab-width 4; replace-tabs off; eol unix;
|
|
@ -1,99 +0,0 @@
|
|||
/***************************************************************************
|
||||
plugin_katetabbarextension.h
|
||||
-------------------
|
||||
begin : 2004-04-20
|
||||
copyright : (C) 2004-2005 by Dominik Haumann
|
||||
email : dhdev@gmx.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, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef PLUGIN_KATETABBAREXTENSION_H
|
||||
#define PLUGIN_KATETABBAREXTENSION_H
|
||||
|
||||
#include <kate/application.h>
|
||||
#include <kate/documentmanager.h>
|
||||
#include <kate/mainwindow.h>
|
||||
#include <kate/plugin.h>
|
||||
|
||||
#include <ktexteditor/document.h>
|
||||
#include <ktexteditor/view.h>
|
||||
#include <ktexteditor/modificationinterface.h>
|
||||
|
||||
#include <klocale.h>
|
||||
#include <ktoolbar.h>
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <QMap>
|
||||
#include <QList>
|
||||
|
||||
class KateTabBarExtension;
|
||||
class KTinyTabBar;
|
||||
|
||||
class PluginView : public Kate::PluginView
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class KatePluginTabBarExtension;
|
||||
|
||||
public:
|
||||
PluginView( Kate::MainWindow* mainwindow );
|
||||
virtual ~PluginView();
|
||||
|
||||
void updateLocation();
|
||||
|
||||
void readSessionConfig (KConfigBase* config, const QString& groupPrefix);
|
||||
void writeSessionConfig (KConfigBase* config, const QString& groupPrefix);
|
||||
|
||||
public slots:
|
||||
void currentTabChanged( int button_id );
|
||||
void closeTabRequest( int button_id );
|
||||
void slotDocumentCreated( KTextEditor::Document* document );
|
||||
void slotDocumentDeleted( KTextEditor::Document* document );
|
||||
void slotViewChanged();
|
||||
void slotDocumentChanged( KTextEditor::Document* );
|
||||
void slotModifiedOnDisc( KTextEditor::Document* document, bool modified,
|
||||
KTextEditor::ModificationInterface::ModifiedOnDiskReason reason );
|
||||
void slotNameChanged( KTextEditor::Document* document );
|
||||
|
||||
private:
|
||||
KTinyTabBar* tabbar;
|
||||
QMap<int, KTextEditor::Document*> id2doc;
|
||||
QMap<KTextEditor::Document*, int> doc2id;
|
||||
};
|
||||
|
||||
class KatePluginTabBarExtension : public Kate::Plugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KatePluginTabBarExtension( QObject* parent = 0, const QList<QVariant>& = QList<QVariant>() );
|
||||
virtual ~KatePluginTabBarExtension();
|
||||
|
||||
Kate::PluginView *createView (Kate::MainWindow *mainWindow);
|
||||
|
||||
void readSessionConfig (KConfigBase* config, const QString& groupPrefix);
|
||||
void writeSessionConfig (KConfigBase* config, const QString& groupPrefix);
|
||||
|
||||
protected slots:
|
||||
void tabbarSettingsChanged( KTinyTabBar* tabbar );
|
||||
void tabbarHighlightMarksChanged( KTinyTabBar* tabbar );
|
||||
|
||||
private:
|
||||
QList<PluginView*> m_views;
|
||||
};
|
||||
|
||||
#endif // PLUGIN_KATETABBAREXTENSION_H
|
|
@ -1,495 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>TabBarConfigWidget</class>
|
||||
<widget class="QWidget" name="TabBarConfigWidget" >
|
||||
<layout class="QGridLayout" name="gridLayout_4" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QGroupBox" name="gbBehaviour" >
|
||||
<property name="title" >
|
||||
<string>Behavior</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="lblLocation" >
|
||||
<property name="text" >
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QComboBox" name="cmbLocation" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string comment="Tab bar location">Top</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string comment="Tab bar location">Bottom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item rowspan="2" row="0" column="2" >
|
||||
<spacer name="horizontalSpacer_3" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>98</width>
|
||||
<height>53</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="lblRows" >
|
||||
<property name="text" >
|
||||
<string>Rows:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSpinBox" name="sbRows" >
|
||||
<property name="suffix" >
|
||||
<string> rows</string>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="lblSorting" >
|
||||
<property name="text" >
|
||||
<string>Sorting:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkFollowActive" >
|
||||
<property name="text" >
|
||||
<string>Keep activated tab visible</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||
<item>
|
||||
<widget class="QComboBox" name="cmbSorting" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Opening Order</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Document Name</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Document URL</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>File Extension</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>17</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QGroupBox" name="gbTabs" >
|
||||
<property name="title" >
|
||||
<string>Tabs</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="lblMinWidth" >
|
||||
<property name="text" >
|
||||
<string>Minimum width:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSpinBox" name="sbMinWidth" >
|
||||
<property name="suffix" >
|
||||
<string> pixels</string>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item rowspan="3" row="1" column="2" >
|
||||
<spacer name="horizontalSpacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>11</width>
|
||||
<height>96</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="lblMaxWidth" >
|
||||
<property name="text" >
|
||||
<string>Maximum width:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QSpinBox" name="sbMaxWidth" >
|
||||
<property name="text" stdset="0" >
|
||||
<string>20 pixels</string>
|
||||
</property>
|
||||
<property name="suffix" >
|
||||
<string> pixels</string>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>500</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="lblHeight" >
|
||||
<property name="text" >
|
||||
<string>Height:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QSpinBox" name="sbHeight" >
|
||||
<property name="text" stdset="0" >
|
||||
<string>16 pixels</string>
|
||||
</property>
|
||||
<property name="suffix" >
|
||||
<string> pixels</string>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>60</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="lblStyle" >
|
||||
<property name="text" >
|
||||
<string>Style:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QComboBox" name="cmbStyle" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Buttons</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Flat</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2" >
|
||||
<widget class="QGroupBox" name="gbHighlighting" >
|
||||
<property name="title" >
|
||||
<string>Highlighting</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" >
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_3" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="KColorButton" name="colModified" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QCheckBox" name="chkModified" >
|
||||
<property name="text" >
|
||||
<string>Highlight modified tabs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="KColorButton" name="colActive" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QCheckBox" name="chkActive" >
|
||||
<property name="text" >
|
||||
<string>Highlight active tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="KColorButton" name="colPrevious" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QCheckBox" name="chkPrevious" >
|
||||
<property name="text" >
|
||||
<string>Highlight previous tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="lblOpacity" >
|
||||
<property name="text" >
|
||||
<string>Opacity:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QSlider" name="slOpacity" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>241</width>
|
||||
<height>108</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4" >
|
||||
<item>
|
||||
<widget class="QLabel" name="lblNote" >
|
||||
<property name="text" >
|
||||
<string>Note: Use the context menu to highlight a tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnClearCache" >
|
||||
<property name="whatsThis" >
|
||||
<string>Remove all highlight marks in the current session.</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Clear Highlight Cache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<widget class="QGroupBox" name="gbPreview" >
|
||||
<property name="title" >
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KColorButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>kcolorbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>cmbLocation</tabstop>
|
||||
<tabstop>sbRows</tabstop>
|
||||
<tabstop>chkFollowActive</tabstop>
|
||||
<tabstop>cmbSorting</tabstop>
|
||||
<tabstop>cmbStyle</tabstop>
|
||||
<tabstop>sbMinWidth</tabstop>
|
||||
<tabstop>sbMaxWidth</tabstop>
|
||||
<tabstop>sbHeight</tabstop>
|
||||
<tabstop>chkModified</tabstop>
|
||||
<tabstop>colModified</tabstop>
|
||||
<tabstop>chkActive</tabstop>
|
||||
<tabstop>colActive</tabstop>
|
||||
<tabstop>chkPrevious</tabstop>
|
||||
<tabstop>colPrevious</tabstop>
|
||||
<tabstop>slOpacity</tabstop>
|
||||
<tabstop>btnClearCache</tabstop>
|
||||
</tabstops>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>chkModified</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>colModified</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>111</x>
|
||||
<y>237</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>50</x>
|
||||
<y>238</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>chkActive</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>colActive</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>96</x>
|
||||
<y>273</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>55</x>
|
||||
<y>268</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>chkPrevious</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>colPrevious</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>84</x>
|
||||
<y>297</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>60</x>
|
||||
<y>303</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,7 +0,0 @@
|
|||
<!DOCTYPE kpartgui>
|
||||
<gui name="tabbarextension" library="katetabbarextensionplugin" version="1">
|
||||
<ToolBar name="tabbarExtensionToolBar">
|
||||
<text>Tab Bar Extension</text>
|
||||
<Action name="tabbar_widget"/>
|
||||
</ToolBar>
|
||||
</gui>
|
Loading…
Add table
Reference in a new issue