KDevelop API Documentation

languages/php/phpconfigwidget.cpp

Go to the documentation of this file.
00001 #include "domutil.h" 00002 #include <kprocess.h> 00003 #include <qlineedit.h> 00004 #include <qmultilineedit.h> 00005 #include <qcstring.h> 00006 #include <iostream> 00007 #include <qradiobutton.h> 00008 #include <kfiledialog.h> 00009 00010 #include "phpinfodlg.h" 00011 #include "phpconfigwidget.h" 00012 #include "phpconfigdata.h" 00013 00014 using namespace std; 00015 00016 PHPConfigWidget::PHPConfigWidget(PHPConfigData* data,QWidget* parent, const char* name, WFlags fl ) 00017 : PHPConfigWidgetBase( parent, name, fl ) 00018 { 00019 configData = data; 00020 m_phpInfo=""; 00021 00022 PHPConfigData::InvocationMode mode = configData->getInvocationMode(); 00023 // page "Invocation" 00024 00025 if(mode == PHPConfigData::Shell){ 00026 callPHPDirectly_radio->setChecked(true); 00027 } 00028 if(mode == PHPConfigData::Web){ 00029 callWebserver_radio->setChecked(true); 00030 } 00031 00032 // page webserver 00033 QString weburl = configData->getWebURL(); 00034 PHPConfigData::WebFileMode webFileMode = configData->getWebFileMode(); 00035 QString webDefaultFile = configData->getWebDefaultFile(); 00036 00037 if(weburl.isEmpty()) weburl = "http://localhost/"; 00038 weburl_edit->setText(weburl); 00039 useDefaultFile_edit->setText(webDefaultFile); 00040 00041 if(webFileMode == PHPConfigData::Current){ 00042 useCurrentFile_radio->setChecked(true); 00043 } 00044 if(webFileMode == PHPConfigData::Default){ 00045 useDefaultFile_radio->setChecked(true); 00046 } 00047 00048 // page shell 00050 QString exepath = configData->getPHPExecPath(); 00051 if(exepath.isEmpty()) exepath = "/usr/local/bin/php"; 00052 exe_edit->setText(exepath); 00053 } 00054 00055 /* 00056 * Destroys the object and frees any allocated resources 00057 */ 00058 PHPConfigWidget::~PHPConfigWidget() 00059 { 00060 // no need to delete child widgets, Qt does it all for us 00061 } 00062 00063 void PHPConfigWidget::accept() 00064 { 00065 cerr << endl << "PHPConfigWidget::accept()"; 00066 // invocation 00067 if(callPHPDirectly_radio->isChecked()){ 00068 configData->setInvocationMode(PHPConfigData::Shell); 00069 } 00070 if(callWebserver_radio->isChecked()){ 00071 configData->setInvocationMode(PHPConfigData::Web); 00072 } 00073 00074 // webserver 00075 configData->setWebURL(weburl_edit->text()); 00076 configData->setWebDefaultFile(useDefaultFile_edit->text()); 00077 00078 if(useCurrentFile_radio->isChecked()){ 00079 configData->setWebFileMode(PHPConfigData::Current); 00080 } 00081 if(useDefaultFile_radio->isChecked()){ 00082 configData->setWebFileMode(PHPConfigData::Default); 00083 } 00084 00085 // shell 00086 configData->setPHPExePath(exe_edit->text()); 00087 00088 configData->storeConfig(); 00089 00090 } 00091 void PHPConfigWidget::slotZendButtonClicked() 00092 { 00093 qWarning( "PHPConfigWidgetBase::slotZendButtonClicked(): Not implemented yet!" ); 00094 } 00095 00096 void PHPConfigWidget::slotAboutClicked() 00097 { 00098 qWarning( "PHPConfigWidget::slotAboutClicked()" ); 00099 KShellProcess proc("/bin/sh"); 00100 proc << exe_edit->text(); 00101 proc << "-m"; 00102 00103 connect(&proc, SIGNAL(receivedStdout (KProcess*, char*, int)), 00104 this, SLOT(slotReceivedPHPInfo (KProcess*, char*, int))); 00105 proc.start(KProcess::Block,KProcess::Stdout); 00106 PHPInfoDlg dlg(this,"phpinfo",true); 00107 dlg.php_edit->setText(m_phpInfo); 00108 dlg.exec(); 00109 m_phpInfo=""; 00110 } 00111 00112 void PHPConfigWidget::slotReceivedPHPInfo (KProcess* /*proc*/, char* buffer, int buflen){ 00113 m_phpInfo += QCString(buffer,buflen+1); 00114 } 00115 void PHPConfigWidget::slotPHPExeButtonClicked(){ 00116 QString exe = KFileDialog::getOpenFileName(QFileInfo(exe_edit->text()).filePath()); 00117 if(!exe.isEmpty()){ 00118 exe_edit->setText(exe); 00119 } 00120 } 00121 00122 void PHPConfigWidget::slotPHPIniButtonClicked() 00123 { 00124 qWarning( "PHPConfigWidget::slotPHPIniButtonClicked(): Not implemented yet!" ); 00125 } 00126 00127 #include "phpconfigwidget.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:39:05 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003