aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Haumann <dhaumann@kde.org>2014-01-23 10:41:21 (GMT)
committerDominik Haumann <dhaumann@kde.org>2014-01-23 10:41:38 (GMT)
commit7fa787bf4c3caa1aab9f79f07ca0a0ee6a2ab857 (patch)
tree7e50bdd6549a01a8db9fbda4b9ff77bcc71e4a4d
parent92d3fe3e3b033e4fe65c27eeca32636539586d54 (diff)
rename setTabURL to setTabToolTip
-rw-r--r--kate/app/katetabbar.cpp42
-rw-r--r--kate/app/katetabbar.h9
-rw-r--r--kate/app/katetabbutton.cpp18
-rw-r--r--kate/app/katetabbutton.h15
-rw-r--r--kate/app/kateviewspace.cpp5
5 files changed, 20 insertions, 69 deletions
diff --git a/kate/app/katetabbar.cpp b/kate/app/katetabbar.cpp
index edd7880..46203b1 100644
--- a/kate/app/katetabbar.cpp
+++ b/kate/app/katetabbar.cpp
@@ -52,21 +52,6 @@ bool tabLessThan(const KateTabButton *a, const KateTabButton *b)
// return KStringHandler::naturalCompare(a->text(), b->text(), Qt::CaseInsensitive) < 0; // FIXME KF5
}
- case KateTabBar::URL: {
- // fall back, if infos not available
- if (a->url().isEmpty() && b->url().isEmpty()) {
- if (a->text().toLower() == b->text().toLower()) {
- return a->buttonID() < b->buttonID();
- }
-
- return a->text() < b->text();
-// return KStringHandler::naturalCompare(a->text(), b->text(), Qt::CaseInsensitive) < 0; FIXME KF5
- }
-
- return a->url() < b->url();
- // return KStringHandler::naturalCompare(a->url(), b->url(), Qt::CaseInsensitive) < 0; FIXME KF5
- }
-
case KateTabBar::Extension: {
// sort by extension, but check whether the files have an
// extension first
@@ -258,12 +243,11 @@ int KateTabBar::tabHeight() const
}
/**
- * Adds a new tab with text \a text. Returns the new tab's ID. The document's
- * url @p docurl is used to sort the documents by URL.
+ * Adds a new tab with text \a text. Returns the new tab's ID.
*/
-int KateTabBar::addTab(const QString &docurl, const QString &text)
+int KateTabBar::addTab(const QString &text)
{
- return addTab(docurl, QIcon(), text);
+ return addTab(QIcon(), text);
}
/**
@@ -272,9 +256,9 @@ int KateTabBar::addTab(const QString &docurl, const QString &text)
*
* Adds a new tab with \a icon and \a text. Returns the new tab's index.
*/
-int KateTabBar::addTab(const QString &docurl, const QIcon &icon, const QString &text)
+int KateTabBar::addTab(const QIcon &icon, const QString &text)
{
- KateTabButton *tabButton = new KateTabButton(docurl, text, m_nextID, this);
+ KateTabButton *tabButton = new KateTabButton(text, m_nextID, this);
tabButton->setIcon(icon);
if (m_highlightedTabs.contains(text)) {
tabButton->setHighlightColor(QColor(m_highlightedTabs[text]));
@@ -410,7 +394,7 @@ void KateTabBar::setTabText(int button_id, const QString &text)
m_IDToTabButton[button_id]->setText(text);
- if (tabSortType() == Name || tabSortType() == URL || tabSortType() == Extension) {
+ if (tabSortType() == Name || tabSortType() == Extension) {
updateSort();
}
}
@@ -430,28 +414,24 @@ QString KateTabBar::tabText(int button_id) const
}
/**
- * Set the button @p button_id's url to @p docurl.
+ * Set the button @p button_id's tool tip to @p tip.
*/
-void KateTabBar::setTabURL(int button_id, const QString &docurl)
+void KateTabBar::setTabToolTip(int button_id, const QString &tip)
{
if (!m_IDToTabButton.contains(button_id)) {
return;
}
- m_IDToTabButton[button_id]->setURL(docurl);
-
- if (tabSortType() == URL) {
- updateSort();
- }
+ m_IDToTabButton[button_id]->setToolTip(tip);
}
/**
* Get the button @p button_id's url. Result is QStrint() if not available.
*/
-QString KateTabBar::tabURL(int button_id) const
+QString KateTabBar::tabToolTip(int button_id) const
{
if (m_IDToTabButton.contains(button_id)) {
- return m_IDToTabButton[button_id]->url();
+ return m_IDToTabButton[button_id]->toolTip();
}
return QString();
diff --git a/kate/app/katetabbar.h b/kate/app/katetabbar.h
index 818815b..f2ccbf2 100644
--- a/kate/app/katetabbar.h
+++ b/kate/app/katetabbar.h
@@ -52,7 +52,6 @@ public:
enum SortType {
OpeningOrder = 0, ///< opening order
Name, ///< alphabetically
- URL, ///< alphabetically URL based
Extension ///< by file extension (suffix)
};
Q_DECLARE_FLAGS(SortTypes, SortType)
@@ -76,8 +75,8 @@ public:
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);
+ int addTab(const QString &text);
+ int addTab(const QIcon &pixmap, const QString &text);
void removeTab(int button_id);
int currentTab() const;
@@ -85,8 +84,8 @@ public:
bool containsTab(int button_id) const;
- void setTabURL(int button_id, const QString &docurl);
- QString tabURL(int button_id) const;
+ void setTabToolTip(int button_id, const QString &tip);
+ QString tabToolTip(int button_id) const;
void setTabText(int button_id, const QString &text);
QString tabText(int button_id) const;
diff --git a/kate/app/katetabbutton.cpp b/kate/app/katetabbutton.cpp
index f86a0f7..e20d527 100644
--- a/kate/app/katetabbutton.cpp
+++ b/kate/app/katetabbutton.cpp
@@ -36,7 +36,7 @@ const int KateTabButton::s_colorCount = 6;
int KateTabButton::s_currentColor = 0;
-KateTabButton::KateTabButton(const QString &docurl, const QString &caption,
+KateTabButton::KateTabButton(const QString &caption,
int button_id, QWidget *parent)
: QPushButton(parent)
{
@@ -52,7 +52,6 @@ KateTabButton::KateTabButton(const QString &docurl, const QString &caption,
setIcon(QIcon());
setText(caption);
- setURL(docurl);
connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked()));
}
@@ -61,21 +60,6 @@ KateTabButton::~KateTabButton()
{
}
-void KateTabButton::setURL(const QString &docurl)
-{
- m_url = docurl;
- if (!m_url.isEmpty()) {
- setToolTip(m_url);
- } else {
- setToolTip(text());
- }
-}
-
-QString KateTabButton::url() const
-{
- return m_url;
-}
-
void KateTabButton::buttonClicked()
{
// once down, stay down until another tab is activated
diff --git a/kate/app/katetabbutton.h b/kate/app/katetabbutton.h
index 3b8b46b..beedda5 100644
--- a/kate/app/katetabbutton.h
+++ b/kate/app/katetabbutton.h
@@ -40,10 +40,8 @@ class KateTabButton : public QPushButton
public:
/**
* Constructs a new tab bar button with \a caption and \a parent.
- * If the @p docurl is unknown, pass QString().
*/
- KateTabButton(const QString &docurl, const QString &caption, int button_id,
- QWidget *parent = 0);
+ KateTabButton(const QString &caption, int button_id, QWidget *parent = 0);
virtual ~KateTabButton();
@@ -71,16 +69,6 @@ public:
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().
@@ -142,7 +130,6 @@ protected:
private:
- QString m_url;
int m_buttonId;
bool m_modified;
diff --git a/kate/app/kateviewspace.cpp b/kate/app/kateviewspace.cpp
index 746cac8..7a55d8d 100644
--- a/kate/app/kateviewspace.cpp
+++ b/kate/app/kateviewspace.cpp
@@ -276,7 +276,8 @@ void KateViewSpace::registerDocument(KTextEditor::Document *doc)
{
Q_ASSERT( ! m_docToTabId.contains(doc));
// add to tab bar
- const int index = m_tabBar->addTab(doc->url().toString(), doc->documentName());
+ const int index = m_tabBar->addTab(doc->documentName());
+ m_tabBar->setTabToolTip(index, doc->url().toString());
m_docToTabId[doc] = index;
connect(doc, SIGNAL(documentNameChanged(KTextEditor::Document*)),
@@ -298,7 +299,7 @@ void KateViewSpace::updateDocumentName(KTextEditor::Document* doc)
const int buttonId = m_docToTabId[doc];
Q_ASSERT(buttonId >= 0);
m_tabBar->setTabText(buttonId, doc->documentName());
- m_tabBar->setTabURL(buttonId, doc->url().toDisplayString());
+ m_tabBar->setTabToolTip(buttonId, doc->url().toDisplayString());
}
void KateViewSpace::saveConfig ( KConfigBase* config, int myIndex , const QString& viewConfGrp)