quickopenfiledialog.cpp
Go to the documentation of this file.00001 /* 00002 * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org) 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 * 00019 */ 00020 00021 #include <kdevproject.h> 00022 #include <kdevpartcontroller.h> 00023 00024 #include "doclineedit.h" 00025 00026 #include <klistbox.h> 00027 #include <klocale.h> 00028 #include <kdebug.h> 00029 00030 #include <qregexp.h> 00031 #include <qlabel.h> 00032 00033 #include "quickopenfiledialog.h" 00034 #include "quickopen_part.h" 00035 00036 QuickOpenFileDialog::QuickOpenFileDialog(QuickOpenPart* part, QWidget* parent, const char* name, bool modal, WFlags fl) 00037 : QuickOpenDialog( part, parent, name, modal, fl ) 00038 { 00039 nameLabel->setText( i18n("File &name:") ); 00040 itemListLabel->setText( i18n("File &list:") ); 00041 00042 m_fileList = m_part->project()->allFiles(); 00043 00044 m_completion = new KCompletion(); 00045 m_completion->insertItems( m_fileList ); 00046 m_completion->setIgnoreCase( true ); 00047 00048 nameEdit->setFocus(); 00049 00050 itemList->insertStringList( m_fileList ); 00051 itemList->setCurrentItem(0); 00052 } 00053 00054 QuickOpenFileDialog::~QuickOpenFileDialog() 00055 { 00056 delete( m_completion ); 00057 m_completion = 0; 00058 } 00059 00060 void QuickOpenFileDialog::slotExecuted( QListBoxItem* item ) 00061 { 00062 m_part->partController()->editDocument( KURL::fromPathOrURL( m_part->project()->projectDirectory() + "/" + item->text() ) ); 00063 accept(); 00064 } 00065 00066 void QuickOpenFileDialog::slotReturnPressed( ) 00067 { 00068 /* if( m_fileList.contains(nameEdit->text()) ) { 00069 m_part->partController()->editDocument( m_part->project()->projectDirectory() + "/" + nameEdit->text() ); 00070 accept(); 00071 }*/ 00072 if( itemList->currentItem() != -1 ) { 00073 m_part->partController()->editDocument( KURL::fromPathOrURL( m_part->project()->projectDirectory() + "/" + itemList->currentText() ) ); 00074 accept(); 00075 } 00076 } 00077 00078 #include "quickopenfiledialog.moc" 00079