2nd Patch for GrepDialog (sorry)
Harald Fernengel
harry at bnro.de
Wed May 2 18:53:12 UTC 2001
....... and here it is .........
-------------- next part --------------
Index: ckdevelop_project.cpp
===================================================================
RCS file: /home/kde/kdevelop/kdevelop/Attic/ckdevelop_project.cpp,v
retrieving revision 1.82.2.47.2.53
diff -u -3 -p -r1.82.2.47.2.53 ckdevelop_project.cpp
--- ckdevelop_project.cpp 2001/05/01 22:15:24 1.82.2.47.2.53
+++ ckdevelop_project.cpp 2001/05/02 18:00:04
@@ -520,8 +520,20 @@ void CKDevelop::slotProjectOpen()
void CKDevelop::slotProjectOpenRecent(int id)
{
- slotProjectOpenCmdl(getProjectAsString(id));
- shuffleProjectToTop(id);
+
+ QString proj = getProjectAsString(id);
+
+ if (QFile::exists(proj)) {
+ slotProjectOpenCmdl(proj);
+ shuffleProjectToTop(id);
+ } else {
+ int answer=KMessageBox::questionYesNo(this,i18n("This project does no longer exist. Do you want to remove it from the list?"),
+ i18n("File not Found: ") + proj);
+ if (answer==KMessageBox::Yes) {
+ qDebug(QString("id: %1").arg(id));
+ recent_projects_menu->removeItem(id);
+ }
+ }
}
void CKDevelop::slotProjectOpenCmdl(QString prjname)
Index: grepdialog.cpp
===================================================================
RCS file: /home/kde/kdevelop/kdevelop/Attic/grepdialog.cpp,v
retrieving revision 1.8.2.3.2.6
diff -u -3 -p -r1.8.2.3.2.6 grepdialog.cpp
--- grepdialog.cpp 2001/04/30 22:58:44 1.8.2.3.2.6
+++ grepdialog.cpp 2001/05/02 18:00:04
@@ -61,6 +61,7 @@ GrepDialog::GrepDialog(QString dirname,
config = KGlobal::config();
config->setGroup("GrepDialog");
lastSearchItems = config->readListEntry("LastSearchItems");
+ lastSearchPaths = config->readListEntry("LastSearchPaths");
QGridLayout *layout = new QGridLayout(this, 6, 3, 10, 4);
layout->setColStretch(0, 10);
@@ -130,16 +131,18 @@ GrepDialog::GrepDialog(QString dirname,
QBoxLayout *dir_layout = new QHBoxLayout(4);
input_layout->addLayout(dir_layout, 3, 1);
- dir_edit = new QLineEdit(this);
- dir_label->setBuddy(dir_edit);
- dir_edit->setText(dirname);
- dir_edit->setMinimumSize(dir_edit->sizeHint());
- dir_layout->addWidget(dir_edit, 10);
+ dir_combo = new QComboBox(true, this);
+ dir_combo->insertStringList(lastSearchPaths);
+ dir_combo->setInsertionPolicy(QComboBox::NoInsertion);
+ dir_combo->setEditText(dirname);
+ dir_combo->setMinimumSize(dir_combo->sizeHint());
+ dir_label->setBuddy(dir_combo);
+ dir_layout->addWidget(dir_combo, 10);
QPushButton *dir_button = new QPushButton(this, "dirButton");
QPixmap pix = SmallIcon("fileopen");
dir_button->setPixmap(pix);
- dir_button->setFixedHeight(dir_edit->sizeHint().height());
+ dir_button->setFixedHeight(dir_combo->sizeHint().height());
dir_button->setFixedWidth(30);
dir_layout->addWidget(dir_button);
@@ -217,6 +220,10 @@ GrepDialog::GrepDialog(QString dirname,
"and edit it here. The string %s in the template is replaced\n"
"by the pattern input field, resulting in the regular expression\n"
"to search for."));
+ QWhatsThis::add(dir_combo,
+ i18n("Enter the directory which contains the files you want to search in."));
+ QWhatsThis::add(recursive_box,
+ i18n("Check this box to search in all subdirectories."));
QWhatsThis::add(resultbox,
i18n("The results of the grep run are listed here. Select a\n"
"filename/line number combination and press Enter or doubleclick\n"
@@ -248,7 +255,7 @@ GrepDialog::~GrepDialog()
void GrepDialog::dirButtonClicked()
{
- dir_edit->setText(KFileDialog::getExistingDirectory(dir_edit->text()));
+ dir_combo->setEditText(KFileDialog::getExistingDirectory(dir_combo->currentText()));
}
@@ -322,11 +329,11 @@ void GrepDialog::slotSearch()
status_label->setText(i18n("Searching..."));
QString pattern = template_edit->text();
- pattern.replace(QRegExp("%s"), pattern_combo->lineEdit()->text());
+ pattern.replace(QRegExp("%s"), pattern_combo->currentText());
pattern.replace(QRegExp("'"), "'\\''");
QString filepattern = "`find '";
- filepattern += dir_edit->text();
+ filepattern += dir_combo->currentText();
filepattern += "'";
if (!recursive_box->isChecked())
filepattern += " -maxdepth 1";
@@ -352,7 +359,7 @@ void GrepDialog::slotSearch()
void GrepDialog::slotSearchFor(QString pattern){
slotClear();
- pattern_combo->lineEdit()->setText(pattern);
+ pattern_combo->setEditText(pattern);
slotSearch();
}
@@ -368,16 +375,24 @@ void GrepDialog::finish()
childproc = 0;
config->setGroup("GrepDialog");
- if (lastSearchItems.contains(pattern_combo->lineEdit()->text()) == 0) {
- pattern_combo->insertItem(pattern_combo->lineEdit()->text(), 0);
- lastSearchItems.prepend(pattern_combo->lineEdit()->text());
+ if (lastSearchItems.contains(pattern_combo->currentText()) == 0) {
+ pattern_combo->insertItem(pattern_combo->currentText(), 0);
+ lastSearchItems.prepend(pattern_combo->currentText());
if (lastSearchItems.count() > 10) {
lastSearchItems.remove(lastSearchItems.fromLast());
pattern_combo->removeItem(pattern_combo->count() - 1);
}
config->writeEntry("LastSearchItems", lastSearchItems);
}
-
+ if (lastSearchPaths.contains(dir_combo->currentText()) == 0) {
+ dir_combo->insertItem(dir_combo->currentText(), 0);
+ lastSearchPaths.prepend(dir_combo->currentText());
+ if (lastSearchPaths.count() > 10) {
+ lastSearchPaths.remove(lastSearchPaths.fromLast());
+ dir_combo->removeItem(dir_combo->count() - 1);
+ }
+ config->writeEntry("LastSearchPaths", lastSearchPaths);
+ }
}
@@ -424,6 +439,6 @@ void GrepDialog::slotClear()
void GrepDialog::setDirName(QString dir){
- dir_edit->setText(dir);
+ dir_combo->setEditText(dir);
}
#include "grepdialog.moc"
Index: grepdialog.h
===================================================================
RCS file: /home/kde/kdevelop/kdevelop/Attic/grepdialog.h,v
retrieving revision 1.3.4.2
diff -u -3 -p -r1.3.4.2 grepdialog.h
--- grepdialog.h 2001/04/30 22:58:44 1.3.4.2
+++ grepdialog.h 2001/05/02 18:00:04
@@ -59,8 +59,8 @@ private:
void processOutput();
void finish();
- QLineEdit *template_edit, *dir_edit;
- QComboBox *files_combo, *pattern_combo;
+ QLineEdit *template_edit;
+ QComboBox *files_combo, *pattern_combo, *dir_combo;
QCheckBox *recursive_box;
QListBox *resultbox;
QPushButton *search_button, *cancel_button;
@@ -69,6 +69,7 @@ private:
QString buf;
KConfig* config;
QStringList lastSearchItems;
+ QStringList lastSearchPaths;
};
More information about the KDevelop-devel
mailing list