From 30110d124a1b80f5ab83a13fca1485e5d5bc24ca Mon Sep 17 00:00:00 2001 From: Jekyll Wu Date: Sun, 21 Aug 2011 17:51:31 +0800 Subject: [PATCH] adjust indentation to 4 spaces. --- src/Pty.cpp | 222 +++++++++++++++++++++---------------------- src/ZModemDialog.cpp | 42 ++++---- 2 files changed, 132 insertions(+), 132 deletions(-) diff --git a/src/Pty.cpp b/src/Pty.cpp index fbea64895..cd433eb11 100644 --- a/src/Pty.cpp +++ b/src/Pty.cpp @@ -44,11 +44,11 @@ using namespace Konsole; void Pty::setWindowSize(int lines, int cols) { - _windowColumns = cols; - _windowLines = lines; + _windowColumns = cols; + _windowLines = lines; - if (pty()->masterFd() >= 0) - pty()->setWinSize(lines, cols); + if (pty()->masterFd() >= 0) + pty()->setWinSize(lines, cols); } QSize Pty::windowSize() const { @@ -57,19 +57,19 @@ QSize Pty::windowSize() const void Pty::setFlowControlEnabled(bool enable) { - _xonXoff = enable; + _xonXoff = enable; - if (pty()->masterFd() >= 0) - { - struct ::termios ttmode; - pty()->tcGetAttr(&ttmode); - if (!enable) - ttmode.c_iflag &= ~(IXOFF | IXON); - else - ttmode.c_iflag |= (IXOFF | IXON); - if (!pty()->tcSetAttr(&ttmode)) - kWarning() << "Unable to set terminal attributes."; - } + if (pty()->masterFd() >= 0) + { + struct ::termios ttmode; + pty()->tcGetAttr(&ttmode); + if (!enable) + ttmode.c_iflag &= ~(IXOFF | IXON); + else + ttmode.c_iflag |= (IXOFF | IXON); + if (!pty()->tcSetAttr(&ttmode)) + kWarning() << "Unable to set terminal attributes."; + } } bool Pty::flowControlEnabled() const { @@ -87,34 +87,34 @@ bool Pty::flowControlEnabled() const void Pty::setUtf8Mode(bool enable) { #ifdef IUTF8 // XXX not a reasonable place to check it. - _utf8 = enable; + _utf8 = enable; - if (pty()->masterFd() >= 0) - { - struct ::termios ttmode; - pty()->tcGetAttr(&ttmode); - if (!enable) - ttmode.c_iflag &= ~IUTF8; - else - ttmode.c_iflag |= IUTF8; - if (!pty()->tcSetAttr(&ttmode)) - kWarning() << "Unable to set terminal attributes."; - } + if (pty()->masterFd() >= 0) + { + struct ::termios ttmode; + pty()->tcGetAttr(&ttmode); + if (!enable) + ttmode.c_iflag &= ~IUTF8; + else + ttmode.c_iflag |= IUTF8; + if (!pty()->tcSetAttr(&ttmode)) + kWarning() << "Unable to set terminal attributes."; + } #endif } void Pty::setErase(char erase) { - _eraseChar = erase; - - if (pty()->masterFd() >= 0) - { - struct ::termios ttmode; - pty()->tcGetAttr(&ttmode); - ttmode.c_cc[VERASE] = erase; - if (!pty()->tcSetAttr(&ttmode)) - kWarning() << "Unable to set terminal attributes."; - } + _eraseChar = erase; + + if (pty()->masterFd() >= 0) + { + struct ::termios ttmode; + pty()->tcGetAttr(&ttmode); + ttmode.c_cc[VERASE] = erase; + if (!pty()->tcSetAttr(&ttmode)) + kWarning() << "Unable to set terminal attributes."; + } } char Pty::erase() const @@ -157,75 +157,75 @@ int Pty::start(const QString& program, const QString& dbusService, const QString& dbusSession) { - clearProgram(); + clearProgram(); - // For historical reasons, the first argument in programArguments is the - // name of the program to execute, so create a list consisting of all - // but the first argument to pass to setProgram() - Q_ASSERT(programArguments.count() >= 1); - setProgram(program.toLatin1(),programArguments.mid(1)); + // For historical reasons, the first argument in programArguments is the + // name of the program to execute, so create a list consisting of all + // but the first argument to pass to setProgram() + Q_ASSERT(programArguments.count() >= 1); + setProgram(program.toLatin1(),programArguments.mid(1)); - addEnvironmentVariables(environment); + addEnvironmentVariables(environment); - if ( !dbusService.isEmpty() ) - setEnv("KONSOLE_DBUS_SERVICE",dbusService); - if ( !dbusSession.isEmpty() ) - setEnv("KONSOLE_DBUS_SESSION", dbusSession); + if ( !dbusService.isEmpty() ) + setEnv("KONSOLE_DBUS_SERVICE",dbusService); + if ( !dbusSession.isEmpty() ) + setEnv("KONSOLE_DBUS_SESSION", dbusSession); - setEnv("WINDOWID", QString::number(winid)); + setEnv("WINDOWID", QString::number(winid)); - // unless the LANGUAGE environment variable has been set explicitly - // set it to a null string - // this fixes the problem where KCatalog sets the LANGUAGE environment - // variable during the application's startup to something which - // differs from LANG,LC_* etc. and causes programs run from - // the terminal to display messages in the wrong language - // - // this can happen if LANG contains a language which KDE - // does not have a translation for - // - // BR:149300 - setEnv("LANGUAGE",QString(),false /* do not overwrite existing value if any */); + // unless the LANGUAGE environment variable has been set explicitly + // set it to a null string + // this fixes the problem where KCatalog sets the LANGUAGE environment + // variable during the application's startup to something which + // differs from LANG,LC_* etc. and causes programs run from + // the terminal to display messages in the wrong language + // + // this can happen if LANG contains a language which KDE + // does not have a translation for + // + // BR:149300 + setEnv("LANGUAGE",QString(),false /* do not overwrite existing value if any */); - setUseUtmp(addToUtmp); + setUseUtmp(addToUtmp); - struct ::termios ttmode; - pty()->tcGetAttr(&ttmode); - if (!_xonXoff) - ttmode.c_iflag &= ~(IXOFF | IXON); - else - ttmode.c_iflag |= (IXOFF | IXON); + struct ::termios ttmode; + pty()->tcGetAttr(&ttmode); + if (!_xonXoff) + ttmode.c_iflag &= ~(IXOFF | IXON); + else + ttmode.c_iflag |= (IXOFF | IXON); #ifdef IUTF8 // XXX not a reasonable place to check it. - if (!_utf8) - ttmode.c_iflag &= ~IUTF8; - else - ttmode.c_iflag |= IUTF8; + if (!_utf8) + ttmode.c_iflag &= ~IUTF8; + else + ttmode.c_iflag |= IUTF8; #endif - if (_eraseChar != 0) - ttmode.c_cc[VERASE] = _eraseChar; + if (_eraseChar != 0) + ttmode.c_cc[VERASE] = _eraseChar; - if (!pty()->tcSetAttr(&ttmode)) - kWarning() << "Unable to set terminal attributes."; - - pty()->setWinSize(_windowLines, _windowColumns); + if (!pty()->tcSetAttr(&ttmode)) + kWarning() << "Unable to set terminal attributes."; - KProcess::start(); + pty()->setWinSize(_windowLines, _windowColumns); - if (!waitForStarted()) - return -1; + KProcess::start(); - return 0; + if (!waitForStarted()) + return -1; + + return 0; } void Pty::setWriteable(bool writeable) { - KDE_struct_stat sbuf; - KDE::stat(pty()->ttyName(), &sbuf); - if (writeable) - KDE::chmod(pty()->ttyName(), sbuf.st_mode | S_IWGRP); - else - KDE::chmod(pty()->ttyName(), sbuf.st_mode & ~(S_IWGRP|S_IWOTH)); + KDE_struct_stat sbuf; + KDE::stat(pty()->ttyName(), &sbuf); + if (writeable) + KDE::chmod(pty()->ttyName(), sbuf.st_mode | S_IWGRP); + else + KDE::chmod(pty()->ttyName(), sbuf.st_mode & ~(S_IWGRP|S_IWOTH)); } Pty::Pty(int masterFd, QObject* parent) @@ -240,14 +240,14 @@ Pty::Pty(QObject* parent) } void Pty::init() { - _windowColumns = 0; - _windowLines = 0; - _eraseChar = 0; - _xonXoff = true; - _utf8 =true; + _windowColumns = 0; + _windowLines = 0; + _eraseChar = 0; + _xonXoff = true; + _utf8 =true; - connect(pty(), SIGNAL(readyRead()) , this , SLOT(dataReceived())); - setPtyChannels(KPtyProcess::AllChannels); + connect(pty(), SIGNAL(readyRead()) , this , SLOT(dataReceived())); + setPtyChannels(KPtyProcess::AllChannels); } Pty::~Pty() @@ -256,19 +256,19 @@ Pty::~Pty() void Pty::sendData(const char* data, int length) { - if (!length) - return; - - if (!pty()->write(data,length)) - { - kWarning() << "Pty::doSendJobs - Could not send input data to terminal process."; - return; - } + if (!length) + return; + + if (!pty()->write(data,length)) + { + kWarning() << "Pty::doSendJobs - Could not send input data to terminal process."; + return; + } } void Pty::dataReceived() { - QByteArray data = pty()->readAll(); + QByteArray data = pty()->readAll(); emit receivedData(data.constData(),data.count()); } @@ -276,11 +276,11 @@ void Pty::lockPty(bool lock) { Q_UNUSED(lock); -// TODO: Support for locking the Pty - //if (lock) - //suspend(); - //else - //resume(); + //TODO: Support for locking the Pty + //if (lock) + //suspend(); + //else + //resume(); } int Pty::foregroundProcessGroup() const @@ -298,7 +298,7 @@ int Pty::foregroundProcessGroup() const void Pty::setupChildProcess() { KPtyProcess::setupChildProcess(); - + // reset all signal handlers // this ensures that terminal applications respond to // signals generated via key sequences such as Ctrl+C diff --git a/src/ZModemDialog.cpp b/src/ZModemDialog.cpp index 468a0bc7e..cfcedea79 100644 --- a/src/ZModemDialog.cpp +++ b/src/ZModemDialog.cpp @@ -28,42 +28,42 @@ using namespace Konsole; ZModemDialog::ZModemDialog(QWidget *parent, bool modal, const QString &caption) : KDialog( parent ) { - setObjectName( QLatin1String( "zmodem_progress" ) ); - setModal( modal ); - setCaption( caption ); - setButtons( User1|Close ); - setButtonGuiItem( User1, KGuiItem(i18n("&Stop")) ); + setObjectName( QLatin1String( "zmodem_progress" ) ); + setModal( modal ); + setCaption( caption ); + setButtons( User1|Close ); + setButtonGuiItem( User1, KGuiItem(i18n("&Stop")) ); - setDefaultButton( Close ); - setEscapeButton( User1 ); + setDefaultButton( Close ); + setEscapeButton( User1 ); - enableButton(Close, false); - _textEdit = new KTextEdit(this); - _textEdit->setMinimumSize(400, 100); - _textEdit->setReadOnly(true); - setMainWidget(_textEdit); - connect(this, SIGNAL(user1Clicked()), this, SLOT(slotClose())); - connect(this,SIGNAL(closeClicked()),this,SLOT(slotClose())); + enableButton(Close, false); + _textEdit = new KTextEdit(this); + _textEdit->setMinimumSize(400, 100); + _textEdit->setReadOnly(true); + setMainWidget(_textEdit); + connect(this, SIGNAL(user1Clicked()), this, SLOT(slotClose())); + connect(this,SIGNAL(closeClicked()),this,SLOT(slotClose())); } void ZModemDialog::addProgressText(const QString &txt) { - QTextCursor cursor = _textEdit->textCursor(); + QTextCursor cursor = _textEdit->textCursor(); - cursor.insertBlock(); - cursor.insertText(txt); + cursor.insertBlock(); + cursor.insertText(txt); } void ZModemDialog::transferDone() { - enableButton(Close, true); - enableButton(User1, false); + enableButton(Close, true); + enableButton(User1, false); } void ZModemDialog::slotClose() { - delayedDestruct(); - accept(); + delayedDestruct(); + accept(); } #include "ZModemDialog.moc"