Commit e0862c60 authored by Kurt Hindenburg's avatar Kurt Hindenburg

Style fixes - separte commands - remove 2 ; - align { elses

parent 8e1bbce1
......@@ -406,8 +406,7 @@ Profile::Ptr Application::processProfileChangeArgs(KCmdLineArgs* args, Profile::
if ( shouldUseNewProfile ) {
return newProfile;
}
else {
} else {
return baseProfile;
}
}
......
......@@ -142,8 +142,7 @@ void ColorSchemeEditor::wallpaperPathChanged(const QString& path)
{
if (path.isEmpty()) {
_colors->setWallpaper(path);
}
else {
} else {
QFileInfo i(path);
if (i.exists() && i.isFile() && i.isReadable())
......
......@@ -819,9 +819,8 @@ void EditProfileDialog::updateButtonApply()
userModified = true;
break;
}
}
// for not-previewed property
else if ((value != _profile->property<QVariant>(aProperty))) {
} else if ((value != _profile->property<QVariant>(aProperty))) {
userModified = true;
break;
}
......
......@@ -181,7 +181,7 @@ void Emulation::receiveChar(int c)
case '\r' : _currentScreen->toStartOfLine(); break;
case 0x07 : emit stateSet(NOTIFYBELL); break;
default : _currentScreen->displayCharacter(c); break;
};
}
}
void Emulation::sendKeyEvent(QKeyEvent* ev)
......
......@@ -459,7 +459,7 @@ void FilterObject::activated()
QList<QAction*> UrlFilter::HotSpot::actions()
{
QAction* openAction = new QAction(_urlObject);
QAction* copyAction = new QAction(_urlObject);;
QAction* copyAction = new QAction(_urlObject);
const UrlType kind = urlType();
Q_ASSERT(kind == StandardUrl || kind == Email);
......
......@@ -96,7 +96,8 @@ void HistoryFile::map()
void HistoryFile::unmap()
{
int result = munmap(_fileMap , _length);
Q_ASSERT(result == 0); Q_UNUSED(result);
Q_ASSERT(result == 0);
Q_UNUSED(result);
_fileMap = 0;
}
......
......@@ -281,9 +281,8 @@ bool KeyboardTranslatorReader::parseAsKeyCode(const QString& item , int& keyCode
if (sequence.count() > 1) {
kWarning() << "Unhandled key codes in sequence: " << item;
}
}
// additional cases implemented for backwards compatibility with KDE 3
else if (item == "prior")
} else if (item == "prior")
keyCode = Qt::Key_PageUp;
else if (item == "next")
keyCode = Qt::Key_PageDown;
......
......@@ -431,8 +431,7 @@ void MainWindow::cloneTab()
Profile::Ptr profile = SessionManager::instance()->sessionProfile(session);
if ( profile) {
createSession( profile , activeSessionDir() );
}
else {
} else {
// something must be wrong: every session should be associated with profile
Q_ASSERT(false);
newTab();
......@@ -635,8 +634,7 @@ void MainWindow::applyKonsoleSettings()
{
if ( KonsoleSettings::allowMenuAccelerators() ) {
recoverMenuAccelerators();
}
else {
} else {
removeMenuAccelerators();
}
......
......@@ -174,7 +174,8 @@ void Screen::reverseIndex()
void Screen::nextLine()
//=NEL
{
toStartOfLine(); index();
toStartOfLine();
index();
}
void Screen::eraseChars(int n)
......@@ -288,7 +289,8 @@ void Screen::resizeImage(int new_lines, int new_columns)
// attempt to preserve focus and _lines
_bottomMargin = _lines - 1; //FIXME: margin lost
for (int i = 0; i < _cuY - (new_lines - 1); i++) {
addHistLine(); scrollUp(0, 1);
addHistLine();
scrollUp(0, 1);
}
}
......@@ -499,9 +501,15 @@ QVector<LineProperty> Screen::getLineProperties(int startLine , int endLine) con
void Screen::reset(bool clearScreen)
{
setMode(MODE_Wrap); saveMode(MODE_Wrap); // wrap at end of margin
resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1]
resetMode(MODE_Insert); saveMode(MODE_Insert); // overstroke
setMode(MODE_Wrap);
saveMode(MODE_Wrap); // wrap at end of margin
resetMode(MODE_Origin);
saveMode(MODE_Origin); // position refere to [1,1]
resetMode(MODE_Insert);
saveMode(MODE_Insert); // overstroke
setMode(MODE_Cursor); // cursor visible
resetMode(MODE_Screen); // screen not inverse
resetMode(MODE_NewLine);
......@@ -553,7 +561,10 @@ void Screen::backtab(int n)
// note that TAB is a format effector (does not write ' ');
if (n == 0) n = 1;
while ((n > 0) && (_cuX > 0)) {
cursorLeft(1); while ((_cuX > 0) && !_tabStops[_cuX]) cursorLeft(1);
cursorLeft(1);
while ((_cuX > 0) && !_tabStops[_cuX]) {
cursorLeft(1);
}
n--;
}
}
......@@ -929,7 +940,8 @@ void Screen::clearEntireScreen()
{
// Add entire screen to history
for (int i = 0; i < (_lines - 1); i++) {
addHistLine(); scrollUp(0, 1);
addHistLine();
scrollUp(0, 1);
}
clearImage(loc(0, 0), loc(_columns - 1, _lines - 1), ' ');
......
......@@ -433,9 +433,8 @@ void Session::run()
// if a program was specified via setProgram(), but it couldn't be found, print a warning
if (choice != 0 && choice < CHOICE_COUNT && !_program.isEmpty()) {
terminalWarning(i18n("Could not find '%1', starting '%2' instead. Please check your profile settings.", _program, exec));
}
// if none of the choices are available, print a warning
else if (choice == CHOICE_COUNT) {
} else if (choice == CHOICE_COUNT) {
terminalWarning(i18n("Could not find an interactive shell to start."));
return;
}
......@@ -1296,11 +1295,9 @@ void Session::setHistorySize(int lines)
{
if ( lines < 0 ) {
setHistoryType(HistoryTypeFile());
}
else if ( lines == 0 ) {
} else if ( lines == 0 ) {
setHistoryType(HistoryTypeNone());
}
else {
} else {
setHistoryType(CompactHistoryType(lines));
}
}
......
......@@ -1622,9 +1622,7 @@ QString SessionController::userTitle () const
{
if ( _session) {
return _session->userTitle();
}
else
{
} else {
return QString();
}
}
......
......@@ -653,9 +653,7 @@ void SessionManager::saveShortcuts()
if (fileInfo.isAbsolute())
{
profileName = fileInfo.fileName();
}
else
{
} else {
profileName = iter.value().profilePath;
}
......@@ -732,9 +730,7 @@ void SessionManager::saveFavorites()
if (fileInfo.isAbsolute())
{
profileName = fileInfo.fileName();
}
else
{
} else {
profileName = profile->path();
}
......
......@@ -112,10 +112,9 @@ static bool expandEnv(QString& text)
//
if (pos > 0 && text.at(pos - 1) == QLatin1Char('\\')) {
pos++;
}
// Variable found => expand
//
else {
} else {
// Find the end of the variable = next '/' or ' '
//
int pos2 = text.indexOf(QLatin1Char(' '), pos + 1);
......
......@@ -688,9 +688,7 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
// This was discussed in: http://lists.kde.org/?t=120552223600002&r=1&w=2
if (_bidiEnabled) {
painter.drawText(rect, 0, text);
}
else
{
} else {
// See bug 280896 for more info
#if QT_VERSION >= 0x040800
painter.drawText(rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + text);
......@@ -844,25 +842,25 @@ QRegion TerminalDisplay::hotSpotRegion() const
r.setTop(hotSpot->startLine());
r.setRight(hotSpot->endColumn());
r.setBottom(hotSpot->endLine());
region |= imageToWidget(r);;
region |= imageToWidget(r);
} else {
r.setLeft(hotSpot->startColumn());
r.setTop(hotSpot->startLine());
r.setRight(_columns);
r.setBottom(hotSpot->startLine());
region |= imageToWidget(r);;
region |= imageToWidget(r);
for (int line = hotSpot->startLine() + 1 ; line < hotSpot->endLine() ; line++) {
r.setLeft(0);
r.setTop(line);
r.setRight(_columns);
r.setBottom(line);
region |= imageToWidget(r);;
region |= imageToWidget(r);
}
r.setLeft(0);
r.setTop(hotSpot->endLine());
r.setRight(hotSpot->endColumn());
r.setBottom(hotSpot->endLine());
region |= imageToWidget(r);;
region |= imageToWidget(r);
}
}
return region;
......@@ -1271,10 +1269,9 @@ void TerminalDisplay::paintFilters(QPainter& painter)
painter.drawLine(r.left() , underlinePos ,
r.right() , underlinePos);
}
}
// Marker hotspots simply have a transparent rectanglular shape
// drawn on top of them
else if (spot->type() == Filter::HotSpot::Marker) {
} else if (spot->type() == Filter::HotSpot::Marker) {
//TODO - Do not use a hardcoded color for this
painter.fillRect(r, QBrush(QColor(255, 0, 0, 120)));
}
......@@ -1978,9 +1975,11 @@ void TerminalDisplay::extendSelection(const QPoint& position)
// Pick which is start (ohere) and which is extension (here)
if (left_not_right) {
here = left; ohere = right;
here = left;
ohere = right;
} else {
here = right; ohere = left;
here = right;
ohere = left;
}
ohere.rx()++;
}
......@@ -2002,9 +2001,11 @@ void TerminalDisplay::extendSelection(const QPoint& position)
// Pick which is start (ohere) and which is extension (here)
if (above_not_below) {
here = above; ohere = below;
here = above;
ohere = below;
} else {
here = below; ohere = above;
here = below;
ohere = above;
}
const QPoint newSelBegin = QPoint(ohere.x(), ohere.y());
......@@ -2049,9 +2050,13 @@ void TerminalDisplay::extendSelection(const QPoint& position)
// Pick which is start (ohere) and which is extension (here)
if (left_not_right) {
here = left; ohere = right; offset = 0;
here = left;
ohere = right;
offset = 0;
} else {
here = right; ohere = left; offset = -1;
here = right;
ohere = left;
offset = -1;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment