Changeset View
Changeset View
Standalone View
Standalone View
krusader/Locate/locate.cpp
Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Line(s) | 118 | { | |||
---|---|---|---|---|---|
185 | 185 | | |||
186 | resultList->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); | 186 | resultList->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); | ||
187 | resultList->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); | 187 | resultList->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); | ||
188 | resultList->header()->setSortIndicatorShown(false); | 188 | resultList->header()->setSortIndicatorShown(false); | ||
189 | resultList->setSortingEnabled(false); | 189 | resultList->setSortingEnabled(false); | ||
190 | resultList->setSelectionMode(QAbstractItemView::ExtendedSelection); | 190 | resultList->setSelectionMode(QAbstractItemView::ExtendedSelection); | ||
191 | resultList->setDragEnabled(true); | 191 | resultList->setDragEnabled(true); | ||
192 | 192 | | |||
193 | connect(resultList, SIGNAL(itemRightClicked(QTreeWidgetItem*,QPoint,int)), | 193 | connect(resultList, &KrTreeWidget::itemRightClicked, this, &LocateDlg::slotRightClick); | ||
194 | this, SLOT(slotRightClick(QTreeWidgetItem*,QPoint))); | 194 | connect(resultList, &KrTreeWidget::itemDoubleClicked, this, &LocateDlg::slotDoubleClick); | ||
195 | connect(resultList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), | 195 | connect(resultList, &KrTreeWidget::itemActivated, this, &LocateDlg::slotDoubleClick); | ||
196 | this, SLOT(slotDoubleClick(QTreeWidgetItem*))); | | |||
197 | connect(resultList, SIGNAL(itemActivated(QTreeWidgetItem*,int)), | | |||
198 | this, SLOT(slotDoubleClick(QTreeWidgetItem*))); | | |||
199 | 196 | | |||
200 | grid->addWidget(resultList, 3, 0); | 197 | grid->addWidget(resultList, 3, 0); | ||
201 | 198 | | |||
202 | QFrame *line2 = new QFrame(this); | 199 | QFrame *line2 = new QFrame(this); | ||
203 | line2->setFrameStyle(QFrame::HLine | QFrame::Sunken); | 200 | line2->setFrameStyle(QFrame::HLine | QFrame::Sunken); | ||
204 | grid->addWidget(line2, 4, 0); | 201 | grid->addWidget(line2, 4, 0); | ||
205 | 202 | | |||
206 | mainLayout->addLayout(grid); | 203 | mainLayout->addLayout(grid); | ||
207 | 204 | | |||
208 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); | 205 | QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); | ||
209 | mainLayout->addWidget(buttonBox); | 206 | mainLayout->addWidget(buttonBox); | ||
210 | 207 | | |||
211 | locateButton = new QPushButton(i18n("Locate")); | 208 | locateButton = new QPushButton(i18n("Locate")); | ||
212 | locateButton->setIcon(Icon(QStringLiteral("system-search"))); | 209 | locateButton->setIcon(Icon(QStringLiteral("system-search"))); | ||
213 | locateButton->setDefault(true); | 210 | locateButton->setDefault(true); | ||
214 | buttonBox->addButton(locateButton, QDialogButtonBox::ActionRole); | 211 | buttonBox->addButton(locateButton, QDialogButtonBox::ActionRole); | ||
215 | 212 | | |||
216 | updateDbButton = new QPushButton(i18n("Update DB")); | 213 | updateDbButton = new QPushButton(i18n("Update DB")); | ||
217 | updateDbButton->setIcon(Icon(QStringLiteral("view-refresh"))); | 214 | updateDbButton->setIcon(Icon(QStringLiteral("view-refresh"))); | ||
218 | buttonBox->addButton(updateDbButton, QDialogButtonBox::ActionRole); | 215 | buttonBox->addButton(updateDbButton, QDialogButtonBox::ActionRole); | ||
219 | 216 | | |||
220 | feedStopButton = new QPushButton; | 217 | feedStopButton = new QPushButton; | ||
221 | buttonBox->addButton(feedStopButton, QDialogButtonBox::ActionRole); | 218 | buttonBox->addButton(feedStopButton, QDialogButtonBox::ActionRole); | ||
222 | 219 | | |||
223 | connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); | 220 | connect(buttonBox, &QDialogButtonBox::rejected, this, &LocateDlg::reject); | ||
224 | connect(locateButton, SIGNAL(clicked()), this, SLOT(slotLocate())); | 221 | connect(locateButton, &QPushButton::clicked, this, &LocateDlg::slotLocate); | ||
225 | connect(updateDbButton, SIGNAL(clicked()), this, SLOT(slotUpdateDb())); | 222 | connect(updateDbButton, &QPushButton::clicked, this, &LocateDlg::slotUpdateDb); | ||
226 | connect(feedStopButton, SIGNAL(clicked()), this, SLOT(slotFeedStop())); | 223 | connect(feedStopButton, &QPushButton::clicked, this, &LocateDlg::slotFeedStop); | ||
227 | 224 | | |||
228 | updateButtons(false); | 225 | updateButtons(false); | ||
229 | 226 | | |||
230 | if (updateProcess) { | 227 | if (updateProcess) { | ||
231 | if (updateProcess->state() == QProcess::Running) { | 228 | if (updateProcess->state() == QProcess::Running) { | ||
232 | connect(updateProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(updateFinished())); | 229 | connect(updateProcess, QOverload<int, QProcess::ExitStatus>::of(&KProcess::finished), this, &LocateDlg::updateFinished); | ||
233 | updateDbButton->setEnabled(false); | 230 | updateDbButton->setEnabled(false); | ||
234 | } else | 231 | } else | ||
235 | updateFinished(); | 232 | updateFinished(); | ||
236 | } | 233 | } | ||
237 | 234 | | |||
238 | show(); | 235 | show(); | ||
239 | 236 | | |||
240 | LocateDialog = this; | 237 | LocateDialog = this; | ||
Show All 11 Lines | |||||
252 | { | 249 | { | ||
253 | if (!updateProcess) { | 250 | if (!updateProcess) { | ||
254 | KConfigGroup group(krConfig, "Locate"); | 251 | KConfigGroup group(krConfig, "Locate"); | ||
255 | 252 | | |||
256 | updateProcess = new KProcess(); // don't set the parent to 'this'! That would cause this process to be deleted once the dialog is closed | 253 | updateProcess = new KProcess(); // don't set the parent to 'this'! That would cause this process to be deleted once the dialog is closed | ||
257 | *updateProcess << KrServices::fullPathName("updatedb"); | 254 | *updateProcess << KrServices::fullPathName("updatedb"); | ||
258 | *updateProcess << KShell::splitArgs(group.readEntry("UpdateDB Arguments")); | 255 | *updateProcess << KShell::splitArgs(group.readEntry("UpdateDB Arguments")); | ||
259 | 256 | | |||
260 | connect(updateProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(updateFinished())); | 257 | connect(updateProcess, QOverload<int, QProcess::ExitStatus>::of(&KProcess::finished), this, &LocateDlg::updateFinished); | ||
261 | updateProcess->start(); | 258 | updateProcess->start(); | ||
262 | updateDbButton->setEnabled(false); | 259 | updateDbButton->setEnabled(false); | ||
263 | } | 260 | } | ||
264 | } | 261 | } | ||
265 | 262 | | |||
266 | void LocateDlg::updateFinished() | 263 | void LocateDlg::updateFinished() | ||
267 | { | 264 | { | ||
268 | delete updateProcess; | 265 | delete updateProcess; | ||
Show All 25 Lines | 271 | { | |||
294 | 291 | | |||
295 | isFeedToListBox = false; | 292 | isFeedToListBox = false; | ||
296 | resultList->setFocus(); | 293 | resultList->setFocus(); | ||
297 | 294 | | |||
298 | qApp->processEvents(); //FIXME - what's this for ? | 295 | qApp->processEvents(); //FIXME - what's this for ? | ||
299 | 296 | | |||
300 | locateProc = new KProcess(this); | 297 | locateProc = new KProcess(this); | ||
301 | locateProc->setOutputChannelMode(KProcess::SeparateChannels); // default is forwarding to the parent channels | 298 | locateProc->setOutputChannelMode(KProcess::SeparateChannels); // default is forwarding to the parent channels | ||
302 | connect(locateProc, SIGNAL(readyReadStandardOutput()), SLOT(processStdout())); | 299 | connect(locateProc, &KProcess::readyReadStandardOutput, this, &LocateDlg::processStdout); | ||
303 | connect(locateProc, SIGNAL(readyReadStandardError()), SLOT(processStderr())); | 300 | connect(locateProc, &KProcess::readyReadStandardError, this, &LocateDlg::processStderr); | ||
304 | connect(locateProc, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(locateFinished())); | 301 | connect(locateProc, QOverload<int,QProcess::ExitStatus>::of(&KProcess::finished), this, &LocateDlg::locateFinished); | ||
305 | connect(locateProc, SIGNAL(error(QProcess::ProcessError)), SLOT(locateError())); | 302 | connect(locateProc, QOverload<QProcess::ProcessError>::of(&KProcess::error), this, &LocateDlg::locateError); | ||
306 | 303 | | |||
307 | *locateProc << KrServices::fullPathName("locate"); | 304 | *locateProc << KrServices::fullPathName("locate"); | ||
308 | if (!isCs) | 305 | if (!isCs) | ||
309 | *locateProc << "-i"; | 306 | *locateProc << "-i"; | ||
310 | *locateProc << (pattern = locateSearchFor->currentText()); | 307 | *locateProc << (pattern = locateSearchFor->currentText()); | ||
311 | 308 | | |||
312 | if (!pattern.startsWith('*')) | 309 | if (!pattern.startsWith('*')) | ||
313 | pattern = '*' + pattern; | 310 | pattern = '*' + pattern; | ||
▲ Show 20 Lines • Show All 379 Lines • Show Last 20 Lines |