summaryrefslogtreecommitdiffstats
path: root/kgpg/kgpgeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kgpg/kgpgeditor.cpp')
-rw-r--r--kgpg/kgpgeditor.cpp196
1 files changed, 98 insertions, 98 deletions
diff --git a/kgpg/kgpgeditor.cpp b/kgpg/kgpgeditor.cpp
index 9db9ce3..269f5ea 100644
--- a/kgpg/kgpgeditor.cpp
+++ b/kgpg/kgpgeditor.cpp
@@ -21,20 +21,20 @@
#include <kfiledialog.h>
#include <klocale.h>
#include <dcopclient.h>
-#include <qpaintdevicemetrics.h>
-#include <qcstring.h>
+#include <tqpaintdevicemetrics.h>
+#include <tqcstring.h>
#include <kencodingfiledialog.h>
-#include <qradiobutton.h>
-#include <qclipboard.h>
-#include <qtextcodec.h>
-#include <qpainter.h>
+#include <tqradiobutton.h>
+#include <tqclipboard.h>
+#include <tqtextcodec.h>
+#include <tqpainter.h>
#include <kprinter.h>
#include <kmessagebox.h>
#include <kdebug.h>
#include <klineedit.h>
-#include <qcheckbox.h>
+#include <tqcheckbox.h>
#include <kurlrequester.h>
#include <ktempfile.h>
#include <kio/netaccess.h>
@@ -53,10 +53,10 @@
#include "listkeys.h"
#include "kgpglibrary.h"
-KgpgApp::KgpgApp(QWidget *parent, const char *name, WFlags f,KShortcut goHome,bool mainWindow):KMainWindow(parent, name,f)
+KgpgApp::KgpgApp(TQWidget *parent, const char *name, WFlags f,KShortcut goHome,bool mainWindow):KMainWindow(parent, name,f)
{
isMainWindow=mainWindow;
- textEncoding=QString::null;
+ textEncoding=TQString::null;
readOptions();
goDefaultKey=goHome;
// call inits to invoke all other construction parts
@@ -77,19 +77,19 @@ delete view;
void KgpgApp::slotOptions()
{
-QByteArray data;
+TQByteArray data;
if (!kapp->dcopClient()->send("kgpg", "KeyInterface", "showOptions()",data))
kdDebug(2100) <<"there was some error using DCOP."<<endl;
}
void KgpgApp::slotKeyManager()
{
-QByteArray data;
+TQByteArray data;
if (!kapp->dcopClient()->send("kgpg", "KeyInterface", "showKeyManager()",data))
kdDebug(2100) <<"there was some error using DCOP."<<endl;
}
-void KgpgApp::closeEvent ( QCloseEvent * e )
+void KgpgApp::closeEvent ( TQCloseEvent * e )
{
if (!isMainWindow)
{
@@ -114,10 +114,10 @@ void KgpgApp::saveOptions()
void KgpgApp::readOptions(bool doresize)
{
- customDecrypt=QStringList::split(QString(" "), KGpgSettings::customDecrypt().simplifyWhiteSpace());
+ customDecrypt=TQStringList::split(TQString(" "), KGpgSettings::customDecrypt().simplifyWhiteSpace());
if (doresize) {
- QSize size= KGpgSettings::editorGeometry();
+ TQSize size= KGpgSettings::editorGeometry();
if (!size.isEmpty())
resize(size);
}
@@ -126,36 +126,36 @@ void KgpgApp::readOptions(bool doresize)
void KgpgApp::initActions()
{
- KStdAction::openNew(this, SLOT(slotFileNew()), actionCollection());
- KStdAction::open(this, SLOT(slotFileOpen()), actionCollection());
- KStdAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection());
- KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection());
- KStdAction::cut(this, SLOT(slotEditCut()), actionCollection());
- KStdAction::copy(this, SLOT(slotEditCopy()), actionCollection());
- KStdAction::paste(this, SLOT(slotEditPaste()), actionCollection());
- KStdAction::selectAll(this, SLOT(slotSelectAll()), actionCollection());
- KStdAction::preferences(this, SLOT(slotOptions()), actionCollection(),"kgpg_config");
-
- //KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection());
- //KStdAction::configureToolbars(this, SLOT(slotConfigureToolbars()), actionCollection());
-
- fileSave = KStdAction::save(this, SLOT(slotFileSave()), actionCollection());
- (void) new KAction(i18n("&Encrypt File..."), "encrypted", 0,this, SLOT(slotFilePreEnc()), actionCollection(),"file_encrypt");
- (void) new KAction(i18n("&Decrypt File..."), "decrypted", 0,this, SLOT(slotFilePreDec()), actionCollection(),"file_decrypt");
- (void) new KAction(i18n("&Open Key Manager"), "kgpg", 0,this, SLOT(slotKeyManager()), actionCollection(),"key_manage");
- editUndo = KStdAction::undo(this, SLOT(slotundo()), actionCollection());
- editRedo = KStdAction::redo(this, SLOT(slotredo()), actionCollection());
- //(void) new KAction(i18n("&Manage Keys"), "kgpg_manage", CTRL+Key_K,this, SLOT(slotManageKey()), actionCollection(),"keys_manage");
- (void) new KAction(i18n("&Generate Signature..."),0, this, SLOT(slotPreSignFile()), actionCollection(), "sign_generate");
- (void) new KAction(i18n("&Verify Signature..."),0, this, SLOT(slotPreVerifyFile()), actionCollection(), "sign_verify");
- (void) new KAction(i18n("&Check MD5 Sum..."), 0,this, SLOT(slotCheckMd5()), actionCollection(), "sign_check");
- KStdAction::print(this, SLOT(slotFilePrint()), actionCollection());
+ KStdAction::openNew(this, TQT_SLOT(slotFileNew()), actionCollection());
+ KStdAction::open(this, TQT_SLOT(slotFileOpen()), actionCollection());
+ KStdAction::saveAs(this, TQT_SLOT(slotFileSaveAs()), actionCollection());
+ KStdAction::quit(this, TQT_SLOT(slotFileQuit()), actionCollection());
+ KStdAction::cut(this, TQT_SLOT(slotEditCut()), actionCollection());
+ KStdAction::copy(this, TQT_SLOT(slotEditCopy()), actionCollection());
+ KStdAction::paste(this, TQT_SLOT(slotEditPaste()), actionCollection());
+ KStdAction::selectAll(this, TQT_SLOT(slotSelectAll()), actionCollection());
+ KStdAction::preferences(this, TQT_SLOT(slotOptions()), actionCollection(),"kgpg_config");
+
+ //KStdAction::keyBindings(guiFactory(), TQT_SLOT(configureShortcuts()), actionCollection());
+ //KStdAction::configureToolbars(this, TQT_SLOT(slotConfigureToolbars()), actionCollection());
+
+ fileSave = KStdAction::save(this, TQT_SLOT(slotFileSave()), actionCollection());
+ (void) new KAction(i18n("&Encrypt File..."), "encrypted", 0,this, TQT_SLOT(slotFilePreEnc()), actionCollection(),"file_encrypt");
+ (void) new KAction(i18n("&Decrypt File..."), "decrypted", 0,this, TQT_SLOT(slotFilePreDec()), actionCollection(),"file_decrypt");
+ (void) new KAction(i18n("&Open Key Manager"), "kgpg", 0,this, TQT_SLOT(slotKeyManager()), actionCollection(),"key_manage");
+ editUndo = KStdAction::undo(this, TQT_SLOT(slotundo()), actionCollection());
+ editRedo = KStdAction::redo(this, TQT_SLOT(slotredo()), actionCollection());
+ //(void) new KAction(i18n("&Manage Keys"), "kgpg_manage", CTRL+Key_K,this, TQT_SLOT(slotManageKey()), actionCollection(),"keys_manage");
+ (void) new KAction(i18n("&Generate Signature..."),0, this, TQT_SLOT(slotPreSignFile()), actionCollection(), "sign_generate");
+ (void) new KAction(i18n("&Verify Signature..."),0, this, TQT_SLOT(slotPreVerifyFile()), actionCollection(), "sign_verify");
+ (void) new KAction(i18n("&Check MD5 Sum..."), 0,this, TQT_SLOT(slotCheckMd5()), actionCollection(), "sign_check");
+ KStdAction::print(this, TQT_SLOT(slotFilePrint()), actionCollection());
// comment out for now, only confusing
- //encodingAction=new KToggleAction(i18n("&Unicode (utf-8) Encoding"), 0, 0,this, SLOT(slotSetCharset()),actionCollection(),"charsets");
+ //encodingAction=new KToggleAction(i18n("&Unicode (utf-8) Encoding"), 0, 0,this, TQT_SLOT(slotSetCharset()),actionCollection(),"charsets");
}
-void KgpgApp::slotSetFont(QFont myFont)
+void KgpgApp::slotSetFont(TQFont myFont)
{
view->editor->setFont (myFont);
}
@@ -165,10 +165,10 @@ void KgpgApp::slotSetCharset()
{
//////// work in progress
//if (encodingAction->isChecked())
-//view->editor->setText(QString::fromUtf8(view->editor->text().ascii()));
+//view->editor->setText(TQString::fromUtf8(view->editor->text().ascii()));
//else
{
-if (checkEncoding(QTextCodec::codecForLocale ())) return;
+if (checkEncoding(TQTextCodec::codecForLocale ())) return;
view->editor->setText(view->editor->text().utf8());
}
}
@@ -181,7 +181,7 @@ void KgpgApp::initView()
view = new KgpgView(this,0);
// doc->addView(view);
- connect(view,SIGNAL(resetEncoding(bool)),this,SLOT(slotResetEncoding(bool)));
+ connect(view,TQT_SIGNAL(resetEncoding(bool)),this,TQT_SLOT(slotResetEncoding(bool)));
setCentralWidget(view);
setCaption(i18n("Untitled"),false); /// doc->URL().fileName(),false);
@@ -204,19 +204,19 @@ void KgpgApp::slotFileNew()
{
////// delete all text from editor
- view->editor->setText(QString::null);
+ view->editor->setText(TQString::null);
editRedo->setEnabled(false);
editUndo->setEnabled(false);
setCaption(i18n("Untitled"), false);
fileSave->setEnabled(false);
- Docname=QString::null;
+ Docname=TQString::null;
slotResetEncoding(false);
}
void KgpgApp::slotFilePreEnc()
{
- QStringList opts;
- KURL::List urls=KFileDialog::getOpenURLs(QString::null,
+ TQStringList opts;
+ KURL::List urls=KFileDialog::getOpenURLs(TQString::null,
i18n("*|All Files"), this, i18n("Open File to Encode"));
if (urls.isEmpty())
return;
@@ -226,14 +226,14 @@ void KgpgApp::slotFilePreEnc()
void KgpgApp::slotFilePreDec()
{
- KURL url=KFileDialog::getOpenURL(QString::null,
+ KURL url=KFileDialog::getOpenURL(TQString::null,
i18n("*|All Files"), this, i18n("Open File to Decode"));
if (url.isEmpty())
return;
- QString oldname=url.fileName();
+ TQString oldname=url.fileName();
- QString newname;
+ TQString newname;
if (oldname.endsWith(".gpg") || oldname.endsWith(".asc") || oldname.endsWith(".pgp"))
oldname.truncate(oldname.length()-4);
@@ -252,7 +252,7 @@ void KgpgApp::slotFilePreDec()
page->checkClipboard->setText(i18n("Editor"));
page->resize(page->minimumSize());
popn->resize(popn->minimumSize());
- if (popn->exec()==QDialog::Accepted) {
+ if (popn->exec()==TQDialog::Accepted) {
if (page->checkFile->isChecked())
newname=page->newFilename->url();
} else {
@@ -263,10 +263,10 @@ void KgpgApp::slotFilePreDec()
if (!newname.isEmpty()) {
- QFile fgpg(newname);
+ TQFile fgpg(newname);
if (fgpg.exists()) {
- KIO::RenameDlg *over=new KIO::RenameDlg(0,i18n("File Already Exists"),QString::null,newname,KIO::M_OVERWRITE);
- if (over->exec()==QDialog::Rejected)
+ KIO::RenameDlg *over=new KIO::RenameDlg(0,i18n("File Already Exists"),TQString::null,newname,KIO::M_OVERWRITE);
+ if (over->exec()==TQDialog::Rejected)
{
delete over;
return;
@@ -276,7 +276,7 @@ void KgpgApp::slotFilePreDec()
}
KgpgLibrary *lib=new KgpgLibrary(this);
lib->slotFileDec(url,KURL(newname), customDecrypt);
- connect(lib,SIGNAL(importOver(QStringList)),this,SIGNAL(refreshImported(QStringList)));
+ connect(lib,TQT_SIGNAL(importOver(TQStringList)),this,TQT_SIGNAL(refreshImported(TQStringList)));
} else
openEncryptedDocumentFile(url);
}
@@ -284,7 +284,7 @@ void KgpgApp::slotFilePreDec()
void KgpgApp::slotFileOpen()
{
KEncodingFileDialog::Result loadResult;
- loadResult=KEncodingFileDialog::getOpenURLAndEncoding(QString::null,QString::null,QString::null,this);
+ loadResult=KEncodingFileDialog::getOpenURLAndEncoding(TQString::null,TQString::null,TQString::null,this);
KURL url=loadResult.URLs.first();
textEncoding=loadResult.encoding;
@@ -298,7 +298,7 @@ void KgpgApp::slotFileOpen()
}
-bool KgpgApp::checkEncoding(QTextCodec *codec)
+bool KgpgApp::checkEncoding(TQTextCodec *codec)
{
///////////// KGlobal::locale()->encoding()->name()
return codec->canEncode(view->editor->text());
@@ -306,12 +306,12 @@ return codec->canEncode(view->editor->text());
void KgpgApp::slotFileSave()
{
- QString filn=Docname.path();
+ TQString filn=Docname.path();
if (filn.isEmpty()) {
slotFileSaveAs();
return;
}
- QTextCodec*cod=QTextCodec::codecForName (textEncoding.ascii());
+ TQTextCodec*cod=TQTextCodec::codecForName (textEncoding.ascii());
// slotStatusMsg(i18n("Saving file..."));
if (!checkEncoding(cod)) {
KMessageBox::sorry(this,i18n("The document could not been saved, as the selected encoding cannot encode every unicode character in it."));
@@ -320,31 +320,31 @@ void KgpgApp::slotFileSave()
KTempFile tmpfile;
if (Docname.isLocalFile()) {
- QFile f(filn);
+ TQFile f(filn);
if ( !f.open( IO_WriteOnly ) ) {
KMessageBox::sorry(this,i18n("The document could not be saved, please check your permissions and disk space."));
return;
}
- QTextStream t( &f );
+ TQTextStream t( &f );
t.setCodec(cod);
- //t.setEncoding( QTextStream::Latin1 );
+ //t.setEncoding( TQTextStream::Latin1 );
t << view->editor->text();//.utf8();
f.close();
}
else {
/*FIXME use following code:
- QFile f( fName );
+ TQFile f( fName );
00983 if ( !f.open( IO_ReadOnly ) )
00984 return;
-00985 QFileInfo info ( f );
-00986 smModificationTime = new QTime( info.lastModified().time() );
-00987 QTextStream t(&f);
-00988 t.setEncoding( QTextStream::Latin1 );
-00989 QString s = t.readLine();
+00985 TQFileInfo info ( f );
+00986 smModificationTime = new TQTime( info.lastModified().time() );
+00987 TQTextStream t(&f);
+00988 t.setEncoding( TQTextStream::Latin1 );
+00989 TQString s = t.readLine();
00990 f.close();
*/
- QTextStream *stream = tmpfile.textStream();
+ TQTextStream *stream = tmpfile.textStream();
stream->setCodec(cod);
*stream << view->editor->text();//.utf8();
tmpfile.close();
@@ -364,20 +364,20 @@ void KgpgApp::slotFileSave()
void KgpgApp::slotFileSaveAs()
{
- //KURL url=KFileDialog::getSaveURL(QDir::currentDirPath(),i18n("*|All Files"), this, i18n("Save As"));
+ //KURL url=KFileDialog::getSaveURL(TQDir::currentDirPath(),i18n("*|All Files"), this, i18n("Save As"));
KEncodingFileDialog::Result saveResult;
- saveResult=KEncodingFileDialog::getSaveURLAndEncoding (QString::null,QString::null,QString::null,this);
+ saveResult=KEncodingFileDialog::getSaveURLAndEncoding (TQString::null,TQString::null,TQString::null,this);
KURL url=saveResult.URLs.first();
- QString selectedEncoding=saveResult.encoding;
+ TQString selectedEncoding=saveResult.encoding;
if(!url.isEmpty()) {
if (url.isLocalFile())
{
- QString filn=url.path();
- QFile f(filn);
+ TQString filn=url.path();
+ TQFile f(filn);
if (f.exists()) {
- QString message=i18n("Overwrite existing file %1?").arg(url.fileName());
- int result=KMessageBox::warningContinueCancel(this,QString(message),i18n("Warning"),i18n("Overwrite"));
+ TQString message=i18n("Overwrite existing file %1?").arg(url.fileName());
+ int result=KMessageBox::warningContinueCancel(this,TQString(message),i18n("Warning"),i18n("Overwrite"));
if (result==KMessageBox::Cancel)
return;
}
@@ -385,8 +385,8 @@ void KgpgApp::slotFileSaveAs()
}
else if (KIO::NetAccess::exists(url,false,this))
{
- QString message=i18n("Overwrite existing file %1?").arg(url.fileName());
- int result=KMessageBox::warningContinueCancel(this,QString(message),i18n("Warning"),i18n("Overwrite"));
+ TQString message=i18n("Overwrite existing file %1?").arg(url.fileName());
+ int result=KMessageBox::warningContinueCancel(this,TQString(message),i18n("Warning"),i18n("Overwrite"));
if (result==KMessageBox::Cancel)
return;
}
@@ -396,15 +396,15 @@ void KgpgApp::slotFileSaveAs()
}
}
-void KgpgApp::openDocumentFile(const KURL& url,QString encoding)
+void KgpgApp::openDocumentFile(const KURL& url,TQString encoding)
{
-QString tempOpenFile;
+TQString tempOpenFile;
/////////////////////////////////////////////////
if( KIO::NetAccess::download( url, tempOpenFile,this ) ) {
- QFile qfile(tempOpenFile);
+ TQFile qfile(tempOpenFile);
if (qfile.open(IO_ReadOnly)) {
- QTextStream t( &qfile );
- t.setCodec(QTextCodec::codecForName (encoding.ascii()));
+ TQTextStream t( &qfile );
+ t.setCodec(TQTextCodec::codecForName (encoding.ascii()));
view->editor->setText(t.read());
qfile.close();
fileSave->setEnabled(false);
@@ -419,8 +419,8 @@ void KgpgApp::slotFilePrint()
KPrinter prt;
//kdDebug(2100)<<"Printing..."<<endl;
if (prt.setup(this)) {
- QPainter painter(&prt);
- QPaintDeviceMetrics metrics(painter.device());
+ TQPainter painter(&prt);
+ TQPaintDeviceMetrics metrics(painter.device());
painter.drawText( 0, 0, metrics.width(), metrics.height(), AlignLeft|AlignTop|DontClip,view->editor->text() );
}
}
@@ -463,14 +463,14 @@ void KgpgApp::slotCheckMd5()
{
///////////////////////////////////////////////////////////////////////// display md5 sum for a chosen file
- KURL url=KFileDialog::getOpenURL(QString::null,
+ KURL url=KFileDialog::getOpenURL(TQString::null,
i18n("*|All Files"), this, i18n("Open File to Verify"));
if (!url.isEmpty()) {
Md5Widget *mdwidget=new Md5Widget(this,0,url);
mdwidget->exec();
delete mdwidget;
- // KMessageBox::information(this,QString("MD5 sum for "+url.fileName()+" is:\n"+checkfile.hexDigest().data()));
+ // KMessageBox::information(this,TQString("MD5 sum for "+url.fileName()+" is:\n"+checkfile.hexDigest().data()));
}
}
@@ -478,7 +478,7 @@ void KgpgApp::slotCheckMd5()
void KgpgApp::slotPreSignFile()
{
////////////////////////////////////// create a detached signature for a chosen file
- KURL url=KFileDialog::getOpenURL(QString::null,i18n("*|All Files"), this, i18n("Open File to Sign"));
+ KURL url=KFileDialog::getOpenURL(TQString::null,i18n("*|All Files"), this, i18n("Open File to Sign"));
if (!url.isEmpty())
slotSignFile(url);
}
@@ -486,18 +486,18 @@ void KgpgApp::slotPreSignFile()
void KgpgApp::slotSignFile(KURL url)
{
////////////////////////////////////// create a detached signature for a chosen file
- QString signKeyID;
+ TQString signKeyID;
if (!url.isEmpty()) {
////////////////// select a private key to sign file --> listkeys.cpp
KgpgSelKey *opts=new KgpgSelKey(this,"select_secret");
- if (opts->exec()==QDialog::Accepted)
+ if (opts->exec()==TQDialog::Accepted)
signKeyID=opts->getkeyID();
else {
delete opts;
return;
}
delete opts;
- QString Options;
+ TQString Options;
if (KGpgSettings::asciiArmor())
Options="--armor";
if (KGpgSettings::pgpCompatibility())
@@ -509,7 +509,7 @@ void KgpgApp::slotSignFile(KURL url)
void KgpgApp::slotPreVerifyFile()
{
- KURL url=KFileDialog::getOpenURL(QString::null,
+ KURL url=KFileDialog::getOpenURL(TQString::null,
i18n("*|All Files"), this, i18n("Open File to Verify"));
slotVerifyFile(url);
}
@@ -517,28 +517,28 @@ void KgpgApp::slotPreVerifyFile()
void KgpgApp::slotVerifyFile(KURL url)
{
/////////////////////////////////// check file signature
- QString sigfile=QString::null;
+ TQString sigfile=TQString::null;
if (!url.isEmpty()) {
////////////////////////////////////// try to find detached signature.
if (!url.fileName().endsWith(".sig")) {
sigfile=url.path()+".sig";
- QFile fsig(sigfile);
+ TQFile fsig(sigfile);
if (!fsig.exists()) {
sigfile=url.path()+".asc";
- QFile fsig(sigfile);
+ TQFile fsig(sigfile);
////////////// if no .asc or .sig signature file included, assume the file is internally signed
if (!fsig.exists())
- sigfile=QString::null;
+ sigfile=TQString::null;
}
}
///////////////////////// pipe gpg command
KgpgInterface *verifyFileProcess=new KgpgInterface();
verifyFileProcess->KgpgVerifyFile(url,KURL(sigfile));
- connect (verifyFileProcess,SIGNAL(verifyquerykey(QString)),this,SLOT(importSignatureKey(QString)));
+ connect (verifyFileProcess,TQT_SIGNAL(verifyquerykey(TQString)),this,TQT_SLOT(importSignatureKey(TQString)));
}
}
-void KgpgApp::importSignatureKey(QString ID)
+void KgpgApp::importSignatureKey(TQString ID)
{
keyServer *kser=new keyServer(0,"server_dialog",false);
kser->page->kLEimportid->setText(ID);