Commit 956277c0 authored by Robert Knight's avatar Robert Knight

Convert tabs to 4 spaces to match kdelibs conventions. Previously

there was a mix of tabs and spaces for indentation.

CCMAIL:Stefan.Becker@nokia.com


svn path=/trunk/KDE/kdebase/apps/konsole/; revision=863326
parent 930a8da6
......@@ -121,30 +121,30 @@ int Application::newInstance()
// create new session
Session* session = createSession( window->defaultProfile() , QString() , window->viewManager() );
if ( !args->isSet("close") )
session->setAutoClose(false);
if ( !args->isSet("close") )
session->setAutoClose(false);
// if the background-mode argument is supplied, start the background session
// ( or bring to the front if it already exists )
if ( args->isSet("background-mode") )
startBackgroundMode(window);
else
{
// Qt constrains top-level windows which have not been manually resized
// (via QWidget::resize()) to a maximum of 2/3rds of the screen size.
//
// This means that the terminal display might not get the width/height
// it asks for. To work around this, the widget must be manually resized
// to its sizeHint().
//
// This problem only affects the first time the application is run. After
// that KMainWindow will have manually resized the window to its saved size
// at this point (so the Qt::WA_Resized attribute will be set)
if (!window->testAttribute(Qt::WA_Resized))
window->resize(window->sizeHint());
window->show();
}
{
// Qt constrains top-level windows which have not been manually resized
// (via QWidget::resize()) to a maximum of 2/3rds of the screen size.
//
// This means that the terminal display might not get the width/height
// it asks for. To work around this, the widget must be manually resized
// to its sizeHint().
//
// This problem only affects the first time the application is run. After
// that KMainWindow will have manually resized the window to its saved size
// at this point (so the Qt::WA_Resized attribute will be set)
if (!window->testAttribute(Qt::WA_Resized))
window->resize(window->sizeHint());
window->show();
}
return 0;
}
......@@ -233,7 +233,7 @@ void Application::processProfileChangeArgs(KCmdLineArgs* args,MainWindow* window
if (!newProfile->isEmpty())
{
window->setDefaultProfile(newProfile);
}
}
}
void Application::startBackgroundMode(MainWindow* window)
......@@ -274,8 +274,8 @@ void Application::toggleBackgroundInstance()
Application::~Application()
{
SessionManager::instance()->closeAll();
SessionManager::instance()->saveState();
SessionManager::instance()->closeAll();
SessionManager::instance()->saveState();
}
void Application::detachView(Session* session)
......
......@@ -293,8 +293,8 @@ void BlockArray::increaseBuffer()
FILE *fion = fdopen(dup(ion), "w+b");
if (!fion) {
perror("fdopen/dup");
delete [] buffer1;
delete [] buffer2;
delete [] buffer1;
delete [] buffer2;
return;
}
......
......@@ -84,7 +84,7 @@ void BookmarkHandler::openBookmark( const KBookmark & bm, Qt::MouseButtons, Qt::
}
void BookmarkHandler::openFolderinTabs( const KBookmarkGroup& group )
{
emit openUrls(group.groupUrlList());
emit openUrls(group.groupUrlList());
}
bool BookmarkHandler::enableOption(BookmarkOption option ) const
{
......
/* This file was part of the KDE libraries
Copyright 2002 Carsten Pfeiffer <pfeiffer@kde.org>
Copyright 2007-2008 Robert Knight <robertknight@gmail.com>
Copyright 2002 Carsten Pfeiffer <pfeiffer@kde.org>
Copyright 2007-2008 Robert Knight <robertknight@gmail.com>
library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
......@@ -74,7 +74,7 @@ public:
virtual bool enableOption(BookmarkOption option) const;
virtual bool supportsTabs() const;
virtual QList<QPair<QString,QString> > currentBookmarkList() const;
virtual void openFolderinTabs(const KBookmarkGroup& group);
virtual void openFolderinTabs(const KBookmarkGroup& group);
/**
* Returns the menu which this bookmark handler inserts its actions into.
......@@ -101,14 +101,14 @@ signals:
*/
void openUrl( const KUrl& url );
/**
* Emitted when the user selects 'Open Folder in Tabs'
* from the bookmark menu.
*
* @param urls The urls of the bookmarks in the folder whoose
* 'Open Folder in Tabs' action was triggered
*/
void openUrls( const QList<KUrl>& urls );
/**
* Emitted when the user selects 'Open Folder in Tabs'
* from the bookmark menu.
*
* @param urls The urls of the bookmarks in the folder whoose
* 'Open Folder in Tabs' action was triggered
*/
void openUrls( const QList<KUrl>& urls );
private Q_SLOTS:
void openBookmark( const KBookmark & bm, Qt::MouseButtons, Qt::KeyboardModifiers );
......
......@@ -34,10 +34,10 @@ namespace Konsole
typedef unsigned char LineProperty;
static const int LINE_DEFAULT = 0;
static const int LINE_WRAPPED = (1 << 0);
static const int LINE_DOUBLEWIDTH = (1 << 1);
static const int LINE_DOUBLEHEIGHT = (1 << 2);
static const int LINE_DEFAULT = 0;
static const int LINE_WRAPPED = (1 << 0);
static const int LINE_DOUBLEWIDTH = (1 << 1);
static const int LINE_DOUBLEHEIGHT = (1 << 2);
#define DEFAULT_RENDITION 0
#define RE_BOLD (1 << 0)
......
......@@ -227,14 +227,14 @@ private:
inline bool operator == (const CharacterColor& a, const CharacterColor& b)
{
return a._colorSpace == b._colorSpace &&
a._u == b._u &&
a._v == b._v &&
a._w == b._w;
return a._colorSpace == b._colorSpace &&
a._u == b._u &&
a._v == b._v &&
a._w == b._w;
}
inline bool operator != (const CharacterColor& a, const CharacterColor& b)
{
return !operator==(a,b);
return !operator==(a,b);
}
inline const QColor color256(quint8 u, const ColorEntry* base)
......
......@@ -100,8 +100,8 @@ ColorSchemeEditor::ColorSchemeEditor(QWidget* parent)
else
{
_ui->transparencyWarningWidget->setText(i18n("The background transparency setting will not"
" be used because your desktop does not appear to support"
" transparent windows."));
" be used because your desktop does not appear to support"
" transparent windows."));
}
}
void ColorSchemeEditor::setRandomizedBackgroundColor( bool randomize )
......
......@@ -32,85 +32,85 @@ using namespace Konsole;
CopyInputDialog::CopyInputDialog(QWidget* parent)
: KDialog(parent)
{
setCaption(i18n("Copy Input"));
setButtons( KDialog::Ok | KDialog::Cancel );
setCaption(i18n("Copy Input"));
setButtons( KDialog::Ok | KDialog::Cancel );
_ui = new Ui::CopyInputDialog();
_ui->setupUi(mainWidget());
_ui = new Ui::CopyInputDialog();
_ui->setupUi(mainWidget());
connect(_ui->selectAllButton,SIGNAL(clicked()),this,SLOT(selectAll()));
connect(_ui->deselectAllButton,SIGNAL(clicked()),this,SLOT(deselectAll()));
connect(_ui->selectAllButton,SIGNAL(clicked()),this,SLOT(selectAll()));
connect(_ui->deselectAllButton,SIGNAL(clicked()),this,SLOT(deselectAll()));
_ui->filterEdit->setClearButtonShown(true);
_ui->filterEdit->setFocus();
_ui->filterEdit->setClearButtonShown(true);
_ui->filterEdit->setFocus();
_model = new CheckableSessionModel(parent);
_model->setCheckColumn(1);
_model->setSessions(SessionManager::instance()->sessions());
_model = new CheckableSessionModel(parent);
_model->setCheckColumn(1);
_model->setSessions(SessionManager::instance()->sessions());
QSortFilterProxyModel* filterProxyModel = new QSortFilterProxyModel(this);
filterProxyModel->setDynamicSortFilter(true);
filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
filterProxyModel->setSourceModel(_model);
filterProxyModel->setFilterKeyColumn(-1);
QSortFilterProxyModel* filterProxyModel = new QSortFilterProxyModel(this);
filterProxyModel->setDynamicSortFilter(true);
filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
filterProxyModel->setSourceModel(_model);
filterProxyModel->setFilterKeyColumn(-1);
connect(_ui->filterEdit,SIGNAL(textChanged(QString)),filterProxyModel,
SLOT(setFilterFixedString(QString)));
connect(_ui->filterEdit,SIGNAL(textChanged(QString)),filterProxyModel,
SLOT(setFilterFixedString(QString)));
_ui->sessionList->setModel(filterProxyModel);
_ui->sessionList->setColumnHidden(0,true); // Hide number column
_ui->sessionList->header()->hide();
_ui->sessionList->setModel(filterProxyModel);
_ui->sessionList->setColumnHidden(0,true); // Hide number column
_ui->sessionList->header()->hide();
}
void CopyInputDialog::setChosenSessions(const QSet<Session*>& sessions)
{
QSet<Session*> checked = sessions;
if (_masterSession)
checked.insert(_masterSession);
QSet<Session*> checked = sessions;
if (_masterSession)
checked.insert(_masterSession);
_model->setCheckedSessions(checked);
_model->setCheckedSessions(checked);
}
QSet<Session*> CopyInputDialog::chosenSessions() const
{
return _model->checkedSessions();
return _model->checkedSessions();
}
void CopyInputDialog::setMasterSession(Session* session)
{
if (_masterSession)
_model->setCheckable(_masterSession,true);
if (_masterSession)
_model->setCheckable(_masterSession,true);
_model->setCheckable(session,false);
QSet<Session*> checked = _model->checkedSessions();
checked.insert(session);
_model->setCheckedSessions(checked);
_model->setCheckable(session,false);
QSet<Session*> checked = _model->checkedSessions();
checked.insert(session);
_model->setCheckedSessions(checked);
_masterSession = session;
_masterSession = session;
}
void CopyInputDialog::setSelectionChecked(bool checked)
{
QAbstractItemModel* model = _ui->sessionList->model();
int rows = model->rowCount();
QModelIndexList selected = _ui->sessionList->selectionModel()->selectedIndexes();
if (selected.count() > 1)
{
foreach(const QModelIndex &index,selected)
setRowChecked(index.row(),checked);
}
else
{
for (int i=0;i<rows;i++)
setRowChecked(i,checked);
}
QAbstractItemModel* model = _ui->sessionList->model();
int rows = model->rowCount();
QModelIndexList selected = _ui->sessionList->selectionModel()->selectedIndexes();
if (selected.count() > 1)
{
foreach(const QModelIndex &index,selected)
setRowChecked(index.row(),checked);
}
else
{
for (int i=0;i<rows;i++)
setRowChecked(i,checked);
}
}
void CopyInputDialog::setRowChecked(int row, bool checked)
{
QAbstractItemModel* model = _ui->sessionList->model();
QModelIndex index = model->index(row,_model->checkColumn());
if (checked)
model->setData(index,(int)Qt::Checked,Qt::CheckStateRole);
else
model->setData(index,(int)Qt::Unchecked,Qt::CheckStateRole);
QAbstractItemModel* model = _ui->sessionList->model();
QModelIndex index = model->index(row,_model->checkColumn());
if (checked)
model->setData(index,(int)Qt::Checked,Qt::CheckStateRole);
else
model->setData(index,(int)Qt::Unchecked,Qt::CheckStateRole);
}
CheckableSessionModel::CheckableSessionModel(QObject* parent)
: SessionListModel(parent)
......@@ -119,74 +119,74 @@ CheckableSessionModel::CheckableSessionModel(QObject* parent)
}
void CheckableSessionModel::setCheckColumn(int column)
{
_checkColumn = column;
reset();
_checkColumn = column;
reset();
}
Qt::ItemFlags CheckableSessionModel::flags(const QModelIndex& index) const
{
Session* session = (Session*)index.internalPointer();
if (_fixedSessions.contains(session))
return SessionListModel::flags(index) & ~Qt::ItemIsEnabled;
else
return SessionListModel::flags(index) | Qt::ItemIsUserCheckable;
Session* session = (Session*)index.internalPointer();
if (_fixedSessions.contains(session))
return SessionListModel::flags(index) & ~Qt::ItemIsEnabled;
else
return SessionListModel::flags(index) | Qt::ItemIsUserCheckable;
}
QVariant CheckableSessionModel::data(const QModelIndex& index, int role) const
{
if (role == Qt::CheckStateRole && index.column() == _checkColumn)
{
Session* session = (Session*)index.internalPointer();
if (_checkedSessions.contains(session))
return QVariant::fromValue((int)Qt::Checked);
else
return QVariant::fromValue((int)Qt::Unchecked);
}
else
return SessionListModel::data(index,role);
if (role == Qt::CheckStateRole && index.column() == _checkColumn)
{
Session* session = (Session*)index.internalPointer();
if (_checkedSessions.contains(session))
return QVariant::fromValue((int)Qt::Checked);
else
return QVariant::fromValue((int)Qt::Unchecked);
}
else
return SessionListModel::data(index,role);
}
bool CheckableSessionModel::setData(const QModelIndex& index, const QVariant& value, int role)
{
if (role == Qt::CheckStateRole && index.column() == _checkColumn)
{
Session* session = (Session*)index.internalPointer();
if (_fixedSessions.contains(session))
return false;
if (value.value<int>() == Qt::Checked)
_checkedSessions.insert(session);
else
_checkedSessions.remove(session);
emit dataChanged(index,index);
return true;
}
else
return SessionListModel::setData(index,value,role);
if (role == Qt::CheckStateRole && index.column() == _checkColumn)
{
Session* session = (Session*)index.internalPointer();
if (_fixedSessions.contains(session))
return false;
if (value.value<int>() == Qt::Checked)
_checkedSessions.insert(session);
else
_checkedSessions.remove(session);
emit dataChanged(index,index);
return true;
}
else
return SessionListModel::setData(index,value,role);
}
void CheckableSessionModel::setCheckedSessions(const QSet<Session*> sessions)
{
_checkedSessions = sessions;
reset();
_checkedSessions = sessions;
reset();
}
QSet<Session*> CheckableSessionModel::checkedSessions() const
{
return _checkedSessions;
return _checkedSessions;
}
void CheckableSessionModel::setCheckable(Session* session, bool checkable)
{
if (!checkable)
_fixedSessions.insert(session);
else
_fixedSessions.remove(session);
if (!checkable)
_fixedSessions.insert(session);
else
_fixedSessions.remove(session);
reset();
reset();
}
void CheckableSessionModel::sessionRemoved(Session* session)
{
_checkedSessions.remove(session);
_fixedSessions.remove(session);
_checkedSessions.remove(session);
_fixedSessions.remove(session);
}
......
......@@ -32,7 +32,7 @@
namespace Ui
{
class CopyInputDialog;
class CopyInputDialog;
}
namespace Konsole
......@@ -44,25 +44,25 @@ class CopyInputDialog : public KDialog
Q_OBJECT
public:
CopyInputDialog(QWidget* parent = 0);
CopyInputDialog(QWidget* parent = 0);
void setMasterSession(Session* master);
Session* masterSession() const;
void setMasterSession(Session* master);
Session* masterSession() const;
void setChosenSessions(const QSet<Session*>& sessions);
QSet<Session*> chosenSessions() const;
void setChosenSessions(const QSet<Session*>& sessions);
QSet<Session*> chosenSessions() const;
private slots:
void selectAll() { setSelectionChecked(true); };
void deselectAll() { setSelectionChecked(false); };
void selectAll() { setSelectionChecked(true); };
void deselectAll() { setSelectionChecked(false); };
private:
void setSelectionChecked(bool checked);
void setRowChecked(int row, bool checked);
void setSelectionChecked(bool checked);
void setRowChecked(int row, bool checked);
Ui::CopyInputDialog* _ui;
CheckableSessionModel* _model;
QPointer<Session> _masterSession;
Ui::CopyInputDialog* _ui;
CheckableSessionModel* _model;
QPointer<Session> _masterSession;
};
class CheckableSessionModel : public SessionListModel
......@@ -70,27 +70,27 @@ class CheckableSessionModel : public SessionListModel
Q_OBJECT
public:
CheckableSessionModel(QObject* parent);
CheckableSessionModel(QObject* parent);
void setCheckColumn(int column);
int checkColumn() const;
void setCheckColumn(int column);
int checkColumn() const;
void setCheckable(Session* session, bool checkable);
void setCheckedSessions(const QSet<Session*> sessions);
QSet<Session*> checkedSessions() const;
void setCheckable(Session* session, bool checkable);
void setCheckedSessions(const QSet<Session*> sessions);
QSet<Session*> checkedSessions() const;
virtual Qt::ItemFlags flags(const QModelIndex& index) const;
virtual QVariant data(const QModelIndex& index, int role) const;
virtual bool setData(const QModelIndex& index, const QVariant& value, int role);
virtual Qt::ItemFlags flags(const QModelIndex& index) const;
virtual QVariant data(const QModelIndex& index, int role) const;
virtual bool setData(const QModelIndex& index, const QVariant& value, int role);
protected:
virtual void sessionRemoved(Session*);
virtual void sessionRemoved(Session*);
private:
QSet<Session*> _checkedSessions;
QSet<Session*> _fixedSessions;
int _checkColumn;
QSet<Session*> _checkedSessions;
QSet<Session*> _fixedSessions;
int _checkColumn;
};
inline int CheckableSessionModel::checkColumn() const
{ return _checkColumn; }
......
......@@ -70,11 +70,11 @@ EditProfileDialog::EditProfileDialog(QWidget* parent)
// - Renable in a later KDE 4.x release when this feature works again
_ui->enableResizeWindowButton->setVisible(false);
#ifdef __GNUC__
#warning "Re-enable when flow control is working again - bug in KDE 4.1"
#endif
_ui->enableFlowControlButton->setEnabled(false);
_ui->enableFlowControlButton->setEnabled(false);
// there are various setupXYZPage() methods to load the items
// for each page and update their states to match the profile
......@@ -91,7 +91,7 @@ EditProfileDialog::EditProfileDialog(QWidget* parent)
SLOT(preparePage(int)) );
_tempProfile = new Profile;
_tempProfile->setHidden(true);
_tempProfile->setHidden(true);
}
EditProfileDialog::~EditProfileDialog()
{
......@@ -251,7 +251,7 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr info)
_ui->initialDirEdit->setClearButtonShown(true);
_ui->dirSelectButton->setIcon( KIcon("folder-open") );
_ui->iconSelectButton->setIcon( KIcon(info->icon()) );
_ui->startInSameDirButton->setChecked(info->property<bool>(Profile::StartInCurrentSessionDir));
_ui->startInSameDirButton->setChecked(info->property<bool>(Profile::StartInCurrentSessionDir));
// window options
_ui->showMenuBarButton->setChecked( info->property<bool>(Profile::ShowMenuBar) );
......@@ -259,8 +259,8 @@ void EditProfileDialog::setupGeneralPage(const Profile::Ptr info)
// signals and slots
connect( _ui->dirSelectButton , SIGNAL(clicked()) , this , SLOT(selectInitialDir()) );
connect( _ui->iconSelectButton , SIGNAL(clicked()) , this , SLOT(selectIcon()) );
connect( _ui->startInSameDirButton , SIGNAL(toggled(bool)) , this ,
SLOT(startInSameDir(bool)));
connect( _ui->startInSameDirButton , SIGNAL(toggled(bool)) , this ,
SLOT(startInSameDir(bool)));
connect( _ui->profileNameEdit , SIGNAL(textChanged(const QString&)) , this ,
SLOT(profileNameChanged(const QString&)) );
connect( _ui->initialDirEdit , SIGNAL(textChanged(const QString&)) , this ,
......@@ -397,7 +397,7 @@ void EditProfileDialog::profileNameChanged(const QString& text)
}
void EditProfileDialog::startInSameDir(bool sameDir)
{
_tempProfile->setProperty(Profile::StartInCurrentSessionDir,sameDir);
_tempProfile->setProperty(Profile::StartInCurrentSessionDir,sameDir);
}
void EditProfileDialog::initialDirChanged(const QString& dir)
{
......@@ -431,9 +431,9 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr info)
SLOT(colorSchemeAnimationUpdate()) );
_ui->transparencyWarningWidget->setVisible(false);
_ui->transparencyWarningWidget->setText(i18n("This color scheme uses a transparent background"
" which does not appear to be supported on your"
" desktop"));
_ui->transparencyWarningWidget->setText(i18n("This color scheme uses a transparent background"
" which does not appear to be supported on your"
" desktop"));
_ui->editColorSchemeButton->setEnabled(false);
_ui->removeColorSchemeButton->setEnabled(false);
......@@ -460,14 +460,14 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr info)
SLOT(newColorScheme()) );
// setup font preview
bool antialias = info->property<bool>(Profile::AntiAliasFonts);
bool antialias = info->property<bool>(Profile::AntiAliasFonts);
QFont font = info->font();
if (!antialias)
font.setStyleStrategy(QFont::NoAntialias);
if (!antialias)
font.setStyleStrategy(QFont::NoAntialias);
_ui->fontPreviewLabel->installEventFilter(this);
_ui->fontPreviewLabel->setFont(font);
_ui->fontPreviewLabel->installEventFilter(this);
_ui->fontPreviewLabel->setFont(font);
_ui->fontSizeSlider->setValue( font.pointSize() );
_ui->fontSizeSlider->setMinimum( KGlobalSettings::smallestReadableFont().pointSize() );
......@@ -476,17 +476,17 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr info)
connect( _ui->editFontButton , SIGNAL(clicked()) , this ,
SLOT(showFontDialog()) );
// setup font smoothing
_ui->antialiasTextButton->setChecked(antialias);
connect( _ui->antialiasTextButton , SIGNAL(toggled(bool)) , this ,
SLOT(setAntialiasText(bool)) );
// setup font smoothing
_ui->antialiasTextButton->setChecked(antialias);
connect( _ui->antialiasTextButton , SIGNAL(toggled(bool)) , this ,
SLOT(setAntialiasText(bool)) );
}
void EditProfileDialog::setAntialiasText(bool enable)
{
_tempProfile->setProperty(Profile::AntiAliasFonts,enable);
_tempProfile->setProperty(Profile::AntiAliasFonts,enable);
// update preview to reflect text smoothing state
fontSelected(_ui->fontPreviewLabel->font());
// update preview to reflect text smoothing state
fontSelected(_ui->fontPreviewLabel->font());
}
void EditProfileDialog::colorSchemeAnimationUpdate()
{
......@@ -594,11 +594,11 @@ bool EditProfileDialog::eventFilter( QObject* watched , QEvent* event )
else
unpreview(Profile::ColorScheme);
}
if ( watched == _ui->fontPreviewLabel && event->type() == QEvent::FontChange )
{
const QFont& labelFont = _ui->fontPreviewLabel->font();
_ui->fontPreviewLabel->setText(i18n("%1, size %2",labelFont.family(),labelFont.pointSize()));
}
if ( watched == _ui->fontPreviewLabel && event->type() == QEvent::FontChange )
{
const QFont& labelFont = _ui->fontPreviewLabel->font();
_ui->fontPreviewLabel->setText(i18n("%1, size %2",labelFont.family(),labelFont.pointSize()));