Commit fdfeae05 authored by Kurt Hindenburg's avatar Kurt Hindenburg
Browse files

Add some commented-out code about using QFileSystemModel + QCompleter

This needs looked at later.

The below causes a noticable delay when opening the dialog - I'm not
entirely sure this is the best way to handle this.
Issue is QLineEdit->SetCompleter() won't work w/ KDE's KUrlCompletion
parent 23cda609
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include <QtGui/QLinearGradient> #include <QtGui/QLinearGradient>
#include <QtGui/QRadialGradient> #include <QtGui/QRadialGradient>
#include <QtCore/QTimer> #include <QtCore/QTimer>
#include <QCompleter>
#include <QFileSystemModel>
// KDE // KDE
#include <kdeversion.h> #include <kdeversion.h>
...@@ -261,17 +263,34 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr profile) ...@@ -261,17 +263,34 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr profile)
ShellCommand command(profile->command() , profile->arguments()); ShellCommand command(profile->command() , profile->arguments());
_ui->commandEdit->setText(command.fullCommand()); _ui->commandEdit->setText(command.fullCommand());
#pragma message("Look at this setCompletionObject again") #pragma message("Look at this setCompletionObject again")
// KUrlCompletion* exeCompletion = new KUrlCompletion(KUrlCompletion::ExeCompletion); // KUrlCompletion* exeCompletion = new KUrlCompletion(KUrlCompletion::ExeCompletion);
// exeCompletion->setParent(this); // exeCompletion->setParent(this);
// exeCompletion->setDir(QUrl()); // exeCompletion->setDir(QUrl());
// _ui->commandEdit->setCompletionObject(exeCompletion); // _ui->commandEdit->setCompletionObject(exeCompletion);
/* The below causes a noticable delay when opening the dialog - I'm not entirely sure
this is the best way to handle this.
Issue is that QLineEdit->SetCompleter() won't work w/ KDE's KUrlCompletion
QFileSystemModel *commandEditDirModel = new QFileSystemModel(this);
commandEditDirModel->setFilter(QDir::AllEntries);
QFileInfo commandFileInfo(profile->command());
// If command is /usr/bin/zsh, start at /usr/bin for completion
commandEditDirModel->setRootPath(commandFileInfo.absolutePath());
QCompleter *commandEditCompleter = new QCompleter(this);
commandEditCompleter->setModel(commandEditDirModel);
_ui->commandEdit->setCompleter(commandEditCompleter);
QFileSystemModel *initialEditDirModel = new QFileSystemModel(this);
initialEditDirModel->setFilter(QDir::AllEntries);
initialEditDirModel->setRootPath(QString('/'));
_ui->initialDirEdit->setText(profile->defaultWorkingDirectory()); _ui->initialDirEdit->setText(profile->defaultWorkingDirectory());
#pragma message("Look at this setCompletionObject again") QCompleter *initialDirCompleter = new QCompleter(this);
// KUrlCompletion* dirCompletion = new KUrlCompletion(KUrlCompletion::DirCompletion); initialDirCompleter->setModel(initialEditDirModel);
// dirCompletion->setParent(this); _ui->initialDirEdit->setCompleter(initialDirCompleter);
// _ui->initialDirEdit->setCompletionObject(dirCompletion); */
_ui->initialDirEdit->setClearButtonEnabled(true); _ui->initialDirEdit->setClearButtonEnabled(true);
_ui->dirSelectButton->setIcon(KIcon("folder-open")); _ui->dirSelectButton->setIcon(KIcon("folder-open"));
......
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