Commit 7fa787bf authored by Dominik Haumann's avatar Dominik Haumann

rename setTabURL to setTabToolTip

parent 92d3fe3e
......@@ -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();
......
......@@ -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;
......
......@@ -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
......
......@@ -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();
......@@ -70,16 +68,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
......@@ -142,7 +130,6 @@ protected:
private:
QString m_url;
int m_buttonId;
bool m_modified;
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment