Changeset View
Changeset View
Standalone View
Standalone View
krusader/paneltabbar.cpp
Show All 20 Lines | |||||
21 | * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * | 21 | * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * | ||
22 | *****************************************************************************/ | 22 | *****************************************************************************/ | ||
23 | 23 | | |||
24 | #include "paneltabbar.h" | 24 | #include "paneltabbar.h" | ||
25 | 25 | | |||
26 | #include "defaults.h" | 26 | #include "defaults.h" | ||
27 | #include "tabactions.h" | 27 | #include "tabactions.h" | ||
28 | #include "../krglobal.h" | 28 | #include "../krglobal.h" | ||
29 | #include "../icon.h" | ||||
29 | #include "Panel/listpanel.h" | 30 | #include "Panel/listpanel.h" | ||
30 | #include "Panel/panelfunc.h" | 31 | #include "Panel/panelfunc.h" | ||
31 | 32 | | |||
32 | // QtCore | 33 | // QtCore | ||
33 | #include <QEvent> | 34 | #include <QEvent> | ||
34 | // QtGui | 35 | // QtGui | ||
35 | #include <QFontMetrics> | 36 | #include <QFontMetrics> | ||
36 | #include <QResizeEvent> | 37 | #include <QResizeEvent> | ||
37 | #include <QMouseEvent> | 38 | #include <QMouseEvent> | ||
38 | // QtWidgets | 39 | // QtWidgets | ||
39 | #include <QAction> | 40 | #include <QAction> | ||
40 | #include <QMenu> | 41 | #include <QMenu> | ||
41 | 42 | | |||
42 | #include <KConfigCore/KSharedConfig> | 43 | #include <KConfigCore/KSharedConfig> | ||
43 | #include <KI18n/KLocalizedString> | 44 | #include <KI18n/KLocalizedString> | ||
44 | #include <KIconThemes/KIconLoader> | | |||
45 | #include <KWidgetsAddons/KActionMenu> | 45 | #include <KWidgetsAddons/KActionMenu> | ||
46 | 46 | | |||
47 | | ||||
47 | static const int sDragEnterDelay = 500; // msec | 48 | static const int sDragEnterDelay = 500; // msec | ||
48 | 49 | | |||
49 | PanelTabBar::PanelTabBar(QWidget *parent, TabActions *actions): QTabBar(parent), | 50 | PanelTabBar::PanelTabBar(QWidget *parent, TabActions *actions): QTabBar(parent), | ||
50 | _maxTabLength(0), _tabClicked(false), _draggingTab(false), _dragTabIndex(-1) | 51 | _maxTabLength(0), _tabClicked(false), _draggingTab(false), _dragTabIndex(-1) | ||
51 | { | 52 | { | ||
52 | _panelActionMenu = new KActionMenu(i18n("Panel"), this); | 53 | _panelActionMenu = new KActionMenu(i18n("Panel"), this); | ||
53 | 54 | | |||
54 | setAcceptDrops(true); | 55 | setAcceptDrops(true); | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | |||||
155 | void PanelTabBar::duplicateTab() | 156 | void PanelTabBar::duplicateTab() | ||
156 | { | 157 | { | ||
157 | int id = currentIndex(); | 158 | int id = currentIndex(); | ||
158 | emit newTab(((ListPanel*)tabData(id).toLongLong())->virtualPath()); | 159 | emit newTab(((ListPanel*)tabData(id).toLongLong())->virtualPath()); | ||
159 | } | 160 | } | ||
160 | 161 | | |||
161 | void PanelTabBar::setIcon(int index, ListPanel *panel) | 162 | void PanelTabBar::setIcon(int index, ListPanel *panel) | ||
162 | { | 163 | { | ||
163 | QIcon tabIcon; | 164 | Icon tabIcon; | ||
164 | if (panel->isLocked()) { | 165 | if (panel->isLocked()) { | ||
165 | tabIcon = krLoader->loadIcon("lock", KIconLoader::Toolbar, 16); | 166 | tabIcon = Icon("lock"); | ||
166 | } else if (panel->isPinned()) { | 167 | } else if (panel->isPinned()) { | ||
167 | tabIcon = krLoader->loadIcon("pin", KIconLoader::Toolbar, 16); | 168 | tabIcon = Icon("pin"); | ||
168 | } | 169 | } | ||
169 | setTabIcon(index, tabIcon); | 170 | setTabIcon(index, tabIcon); | ||
170 | } | 171 | } | ||
171 | 172 | | |||
172 | QString PanelTabBar::squeeze(const QUrl &url, int tabIndex) | 173 | QString PanelTabBar::squeeze(const QUrl &url, int tabIndex) | ||
173 | { | 174 | { | ||
174 | const QString longText = url.isEmpty() ? i18n("[invalid]") : | 175 | const QString longText = url.isEmpty() ? i18n("[invalid]") : | ||
175 | url.isLocalFile() ? url.path() : url.toDisplayString(); | 176 | url.isLocalFile() ? url.path() : url.toDisplayString(); | ||
▲ Show 20 Lines • Show All 163 Lines • Show Last 20 Lines |