Changeset View
Changeset View
Standalone View
Standalone View
krusader/KViewer/lister.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
55 | #include <KI18n/KLocalizedString> | 55 | #include <KI18n/KLocalizedString> | ||
56 | #include <KIO/CopyJob> | 56 | #include <KIO/CopyJob> | ||
57 | #include <KIO/JobUiDelegate> | 57 | #include <KIO/JobUiDelegate> | ||
58 | #include <KParts/GUIActivateEvent> | 58 | #include <KParts/GUIActivateEvent> | ||
59 | #include <KWidgetsAddons/KMessageBox> | 59 | #include <KWidgetsAddons/KMessageBox> | ||
60 | #include <KXmlGui/KActionCollection> | 60 | #include <KXmlGui/KActionCollection> | ||
61 | 61 | | |||
62 | #include "../krglobal.h" | 62 | #include "../krglobal.h" | ||
63 | #include "../icon.h" | ||||
63 | #include "../kractions.h" | 64 | #include "../kractions.h" | ||
64 | #include "../GUI/krremoteencodingmenu.h" | 65 | #include "../GUI/krremoteencodingmenu.h" | ||
65 | 66 | | |||
66 | #define SEARCH_CACHE_CHARS 100000 | 67 | #define SEARCH_CACHE_CHARS 100000 | ||
67 | #define SEARCH_MAX_ROW_LEN 4000 | 68 | #define SEARCH_MAX_ROW_LEN 4000 | ||
68 | #define CONTROL_CHAR 752 | 69 | #define CONTROL_CHAR 752 | ||
69 | #define CACHE_SIZE 1048576 // cache size set to 1MiB | 70 | #define CACHE_SIZE 1048576 // cache size set to 1MiB | ||
70 | 71 | | |||
▲ Show 20 Lines • Show All 1125 Lines • ▼ Show 20 Line(s) | 1184 | protected: | |||
1196 | 1197 | | |||
1197 | Lister * _lister; | 1198 | Lister * _lister; | ||
1198 | }; | 1199 | }; | ||
1199 | 1200 | | |||
1200 | Lister::Lister(QWidget *parent) : KParts::ReadOnlyPart(parent) | 1201 | Lister::Lister(QWidget *parent) : KParts::ReadOnlyPart(parent) | ||
1201 | { | 1202 | { | ||
1202 | setXMLFile("krusaderlisterui.rc"); | 1203 | setXMLFile("krusaderlisterui.rc"); | ||
1203 | 1204 | | |||
1204 | _actionSaveSelected = new QAction(QIcon::fromTheme("document-save"), i18n("Save selection..."), this); | 1205 | _actionSaveSelected = new QAction(Icon("document-save"), i18n("Save selection..."), this); | ||
1205 | connect(_actionSaveSelected, SIGNAL(triggered(bool)), SLOT(saveSelected())); | 1206 | connect(_actionSaveSelected, SIGNAL(triggered(bool)), SLOT(saveSelected())); | ||
1206 | actionCollection()->addAction("save_selected", _actionSaveSelected); | 1207 | actionCollection()->addAction("save_selected", _actionSaveSelected); | ||
1207 | 1208 | | |||
1208 | _actionSaveAs = new QAction(QIcon::fromTheme("document-save-as"), i18n("Save as..."), this); | 1209 | _actionSaveAs = new QAction(Icon("document-save-as"), i18n("Save as..."), this); | ||
1209 | connect(_actionSaveAs, SIGNAL(triggered(bool)), SLOT(saveAs())); | 1210 | connect(_actionSaveAs, SIGNAL(triggered(bool)), SLOT(saveAs())); | ||
1210 | actionCollection()->addAction("save_as", _actionSaveAs); | 1211 | actionCollection()->addAction("save_as", _actionSaveAs); | ||
1211 | 1212 | | |||
1212 | _actionPrint = new QAction(QIcon::fromTheme("document-print"), i18n("Print..."), this); | 1213 | _actionPrint = new QAction(Icon("document-print"), i18n("Print..."), this); | ||
1213 | connect(_actionPrint, SIGNAL(triggered(bool)), SLOT(print())); | 1214 | connect(_actionPrint, SIGNAL(triggered(bool)), SLOT(print())); | ||
1214 | actionCollection()->addAction("print", _actionPrint); | 1215 | actionCollection()->addAction("print", _actionPrint); | ||
1215 | actionCollection()->setDefaultShortcut(_actionPrint, Qt::CTRL + Qt::Key_P); | 1216 | actionCollection()->setDefaultShortcut(_actionPrint, Qt::CTRL + Qt::Key_P); | ||
1216 | 1217 | | |||
1217 | _actionSearch = new QAction(QIcon::fromTheme("system-search"), i18n("Search"), this); | 1218 | _actionSearch = new QAction(Icon("system-search"), i18n("Search"), this); | ||
1218 | connect(_actionSearch, SIGNAL(triggered(bool)), SLOT(searchAction())); | 1219 | connect(_actionSearch, SIGNAL(triggered(bool)), SLOT(searchAction())); | ||
1219 | actionCollection()->addAction("search", _actionSearch); | 1220 | actionCollection()->addAction("search", _actionSearch); | ||
1220 | actionCollection()->setDefaultShortcut(_actionSearch, Qt::CTRL + Qt::Key_F); | 1221 | actionCollection()->setDefaultShortcut(_actionSearch, Qt::CTRL + Qt::Key_F); | ||
1221 | 1222 | | |||
1222 | _actionSearchNext = new QAction(QIcon::fromTheme("go-down"), i18n("Search next"), this); | 1223 | _actionSearchNext = new QAction(Icon("go-down"), i18n("Search next"), this); | ||
1223 | connect(_actionSearchNext, SIGNAL(triggered(bool)), SLOT(searchNext())); | 1224 | connect(_actionSearchNext, SIGNAL(triggered(bool)), SLOT(searchNext())); | ||
1224 | actionCollection()->addAction("search_next", _actionSearchNext); | 1225 | actionCollection()->addAction("search_next", _actionSearchNext); | ||
1225 | actionCollection()->setDefaultShortcut(_actionSearchNext, Qt::Key_F3); | 1226 | actionCollection()->setDefaultShortcut(_actionSearchNext, Qt::Key_F3); | ||
1226 | 1227 | | |||
1227 | _actionSearchPrev = new QAction(QIcon::fromTheme("go-up"), i18n("Search previous"), this); | 1228 | _actionSearchPrev = new QAction(Icon("go-up"), i18n("Search previous"), this); | ||
1228 | connect(_actionSearchPrev, SIGNAL(triggered(bool)), SLOT(searchPrev())); | 1229 | connect(_actionSearchPrev, SIGNAL(triggered(bool)), SLOT(searchPrev())); | ||
1229 | actionCollection()->addAction("search_prev", _actionSearchPrev); | 1230 | actionCollection()->addAction("search_prev", _actionSearchPrev); | ||
1230 | actionCollection()->setDefaultShortcut(_actionSearchPrev, Qt::SHIFT + Qt::Key_F3); | 1231 | actionCollection()->setDefaultShortcut(_actionSearchPrev, Qt::SHIFT + Qt::Key_F3); | ||
1231 | 1232 | | |||
1232 | _actionJumpToPosition = new QAction(QIcon::fromTheme("go-jump"), i18n("Jump to position"), this); | 1233 | _actionJumpToPosition = new QAction(Icon("go-jump"), i18n("Jump to position"), this); | ||
1233 | connect(_actionJumpToPosition, SIGNAL(triggered(bool)), SLOT(jumpToPosition())); | 1234 | connect(_actionJumpToPosition, SIGNAL(triggered(bool)), SLOT(jumpToPosition())); | ||
1234 | actionCollection()->addAction("jump_to_position", _actionJumpToPosition); | 1235 | actionCollection()->addAction("jump_to_position", _actionJumpToPosition); | ||
1235 | actionCollection()->setDefaultShortcut(_actionJumpToPosition, Qt::CTRL + Qt::Key_G); | 1236 | actionCollection()->setDefaultShortcut(_actionJumpToPosition, Qt::CTRL + Qt::Key_G); | ||
1236 | 1237 | | |||
1237 | _actionHexMode = new QAction(QIcon::fromTheme("document-preview"), i18n("Hex mode"), this); | 1238 | _actionHexMode = new QAction(Icon("document-preview"), i18n("Hex mode"), this); | ||
1238 | connect(_actionHexMode, SIGNAL(triggered(bool)), SLOT(toggleHexMode())); | 1239 | connect(_actionHexMode, SIGNAL(triggered(bool)), SLOT(toggleHexMode())); | ||
1239 | actionCollection()->addAction("hex_mode", _actionHexMode); | 1240 | actionCollection()->addAction("hex_mode", _actionHexMode); | ||
1240 | actionCollection()->setDefaultShortcut(_actionHexMode, Qt::CTRL + Qt::Key_H); | 1241 | actionCollection()->setDefaultShortcut(_actionHexMode, Qt::CTRL + Qt::Key_H); | ||
1241 | 1242 | | |||
1242 | new ListerEncodingMenu(this, i18n("Select charset"), "character-set", actionCollection()); | 1243 | new ListerEncodingMenu(this, i18n("Select charset"), "character-set", actionCollection()); | ||
1243 | 1244 | | |||
1244 | QWidget * widget = new ListerPane(this, parent); | 1245 | QWidget * widget = new ListerPane(this, parent); | ||
1245 | widget->setFocusPolicy(Qt::StrongFocus); | 1246 | widget->setFocusPolicy(Qt::StrongFocus); | ||
Show All 17 Lines | |||||
1263 | _searchProgressBar = new QProgressBar(statusWidget); | 1264 | _searchProgressBar = new QProgressBar(statusWidget); | ||
1264 | _searchProgressBar->setMinimum(0); | 1265 | _searchProgressBar->setMinimum(0); | ||
1265 | _searchProgressBar->setMaximum(1000); | 1266 | _searchProgressBar->setMaximum(1000); | ||
1266 | _searchProgressBar->setValue(0); | 1267 | _searchProgressBar->setValue(0); | ||
1267 | _searchProgressBar->hide(); | 1268 | _searchProgressBar->hide(); | ||
1268 | hbox->addWidget(_searchProgressBar); | 1269 | hbox->addWidget(_searchProgressBar); | ||
1269 | 1270 | | |||
1270 | _searchStopButton = new QToolButton(statusWidget); | 1271 | _searchStopButton = new QToolButton(statusWidget); | ||
1271 | _searchStopButton->setIcon(QIcon::fromTheme("process-stop")); | 1272 | _searchStopButton->setIcon(Icon("process-stop")); | ||
1272 | _searchStopButton->setToolTip(i18n("Stop search")); | 1273 | _searchStopButton->setToolTip(i18n("Stop search")); | ||
1273 | _searchStopButton->hide(); | 1274 | _searchStopButton->hide(); | ||
1274 | connect(_searchStopButton, SIGNAL(clicked()), this, SLOT(searchDelete())); | 1275 | connect(_searchStopButton, SIGNAL(clicked()), this, SLOT(searchDelete())); | ||
1275 | hbox->addWidget(_searchStopButton); | 1276 | hbox->addWidget(_searchStopButton); | ||
1276 | 1277 | | |||
1277 | _searchLineEdit = new KLineEdit(statusWidget); | 1278 | _searchLineEdit = new KLineEdit(statusWidget); | ||
1278 | _searchLineEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); | 1279 | _searchLineEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); | ||
1279 | 1280 | | |||
1280 | _originalBackground = _searchLineEdit->palette().color(QPalette::Base); | 1281 | _originalBackground = _searchLineEdit->palette().color(QPalette::Base); | ||
1281 | _originalForeground = _searchLineEdit->palette().color(QPalette::Text); | 1282 | _originalForeground = _searchLineEdit->palette().color(QPalette::Text); | ||
1282 | 1283 | | |||
1283 | connect(_searchLineEdit, SIGNAL(returnPressed()), this, SLOT(searchNext())); | 1284 | connect(_searchLineEdit, SIGNAL(returnPressed()), this, SLOT(searchNext())); | ||
1284 | connect(_searchLineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged())); | 1285 | connect(_searchLineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged())); | ||
1285 | 1286 | | |||
1286 | hbox->addWidget(_searchLineEdit); | 1287 | hbox->addWidget(_searchLineEdit); | ||
1287 | _searchNextButton = new QPushButton(QIcon::fromTheme("go-down"), i18n("Next"), statusWidget); | 1288 | _searchNextButton = new QPushButton(Icon("go-down"), i18n("Next"), statusWidget); | ||
1288 | _searchNextButton->setToolTip(i18n("Jump to next match")); | 1289 | _searchNextButton->setToolTip(i18n("Jump to next match")); | ||
1289 | connect(_searchNextButton, SIGNAL(clicked()), this, SLOT(searchNext())); | 1290 | connect(_searchNextButton, SIGNAL(clicked()), this, SLOT(searchNext())); | ||
1290 | hbox->addWidget(_searchNextButton); | 1291 | hbox->addWidget(_searchNextButton); | ||
1291 | _searchPrevButton = new QPushButton(QIcon::fromTheme("go-up"), i18n("Previous"), statusWidget); | 1292 | _searchPrevButton = new QPushButton(Icon("go-up"), i18n("Previous"), statusWidget); | ||
1292 | _searchPrevButton->setToolTip(i18n("Jump to previous match")); | 1293 | _searchPrevButton->setToolTip(i18n("Jump to previous match")); | ||
1293 | connect(_searchPrevButton, SIGNAL(clicked()), this, SLOT(searchPrev())); | 1294 | connect(_searchPrevButton, SIGNAL(clicked()), this, SLOT(searchPrev())); | ||
1294 | hbox->addWidget(_searchPrevButton); | 1295 | hbox->addWidget(_searchPrevButton); | ||
1295 | _searchOptions = new QPushButton(i18n("Options"), statusWidget); | 1296 | _searchOptions = new QPushButton(i18n("Options"), statusWidget); | ||
1296 | _searchOptions->setToolTip(i18n("Modify search behavior")); | 1297 | _searchOptions->setToolTip(i18n("Modify search behavior")); | ||
1297 | QMenu * menu = new QMenu(); | 1298 | QMenu * menu = new QMenu(); | ||
1298 | _fromCursorAction = menu->addAction(i18n("From cursor")); | 1299 | _fromCursorAction = menu->addAction(i18n("From cursor")); | ||
1299 | _fromCursorAction->setCheckable(true); | 1300 | _fromCursorAction->setCheckable(true); | ||
▲ Show 20 Lines • Show All 977 Lines • Show Last 20 Lines |