Commit 5036d8cb authored by Robert Knight's avatar Robert Knight

Squashed commit of the following:

commit 99d61f9bdfe29347050162a5a675bb0c276bc1bf
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 20:45:45 2008 +0000

    Allow a normal frame around the table view in ManageProfilesDialog.  Works better with Oxygen style.

commit 7075de00d8cc88568e108e868e08d071d5aa7bcb
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 20:37:38 2008 +0000

    Change base class of ProfileItemDelegate from QItemDelegate to QStyledItemDelegate for better rendering.  Fix updates of favorite / non-favorite status in ManageProfilesDialog.  QVariant equality comparisons are not properly supported for custom types so QAbstractItemModel::match() has to be replaced with manual iteration through the rows.

commit 3baa3307473e037efd500ade7df37d2fd62c60d9
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 20:09:27 2008 +0000

    Remove unecessary deleteProfile() call.  Explicitly add new profiles to the SessionManager.  Mark the temporary profile in the EditProfileDialog as hidden.

commit 53d1e3515d3408c08ba4b019b5faceffae6b0f8a
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 20:02:28 2008 +0000

    Do not track deletion of temporary un-named profiles.

commit 55c69e15a4247319b0cff73691f072fef39684c9
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 20:01:25 2008 +0000

    Make SessionManager::addProfile() public.  Call it automatically in SessionManager::setFavorite() if the profile is not already known to the manager.  When a profile is deleted via SessionManager::deleteProfile() mark it as hidden so that it is not recreated on disk if later changed.  Add debugging in ~Profile to track deletion of profiles.

commit 7a028bac5846cd3689e3351ab139c6f372ca173e
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 19:41:22 2008 +0000

    Fix several signal/slot connections in ManageProfilesDialog after the SessionManager changes.

commit da7c7b4f939c17885cf0fbaa1fb93d2655021b83
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 19:36:57 2008 +0000

    Use a helper class to pop elements from recursion guard stack when a call to loadProfile() returns rather than requiring a manual call to recursionGuard.pop()

commit 14a993d15722ec5270de708154408896fd7418b8
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 19:12:20 2008 +0000

    Fix profiles not being loaded properly if their parent was a profile which had already been loaded.  Profile paths were not being taken off the recursion guard stack at one exit from loadProfile().

commit f946fc0cbde26cd816e3f1d172a5e5327ff3295b
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 19:01:06 2008 +0000

    Adapt Part to the SessionManager/Profile changes.

commit d3155ba0f6dc9ec0ca34a45b5787488c055dc4bf
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 18:55:05 2008 +0000

    Update MainWindow API documentation to reflect string key -> ref counted pointer change for profiles.

commit 5d546054c031ae6ee6915f2cc6bcf61dd4e03520
Author: Robert Knight <robertknight@gmail.com>
Date:   Sat Mar 22 18:53:16 2008 +0000

    Update SessionManager API documentation to reflect string key -> ref counted pointer change for profiles.

commit 856fdf37a5bd81711ff0db1b307b8736ef4ae34e
Author: Robert Knight <robertknight@gmail.com>
Date:   Thu Mar 20 23:43:53 2008 +0000

    Fix assert.  Fall back to current locale's codec if a null pointer is passed to Emulation::setCodec()

commit 127e894d076061b991934adf84256b651bf31724
Author: Robert Knight <robertknight@gmail.com>
Date:   Thu Mar 20 22:45:11 2008 +0000

    Replace string key for profiles with ref-counted profile pointer.

commit 53246e5bd4ffcec56ca0ff94730f9ef3946e3f4c
Author: Robert Knight <robertknight@gmail.com>
Date:   Thu Mar 20 20:50:17 2008 +0000

    First step towards removing string keys as a means to reference profiles.  Change Profile base class from QObject to QSharedData and replace all usage of Profile* with KSharedPtr<Profile>

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=788936
parent ede5253a
......@@ -81,10 +81,10 @@ MainWindow* Application::newMainWindow()
MainWindow* window = new MainWindow();
window->setSessionList( new ProfileList(true,window) );
connect( window , SIGNAL(newSessionRequest(const QString&,const QString&,ViewManager*)),
this , SLOT(createSession(const QString&,const QString&,ViewManager*)));
connect( window , SIGNAL(newWindowRequest(const QString&,const QString&)),
this , SLOT(createWindow(const QString&,const QString&)) );
connect( window , SIGNAL(newSessionRequest(Profile::Ptr,const QString&,ViewManager*)),
this , SLOT(createSession(Profile::Ptr,const QString&,ViewManager*)));
connect( window , SIGNAL(newWindowRequest(Profile::Ptr,const QString&)),
this , SLOT(createWindow(Profile::Ptr,const QString&)) );
connect( window->viewManager() , SIGNAL(viewDetached(Session*)) , this , SLOT(detachView(Session*)) );
return window;
......@@ -162,8 +162,8 @@ void Application::processProfileSelectArgs(KCmdLineArgs* args,MainWindow* window
{
if ( args->isSet("profile") )
{
QString key = SessionManager::instance()->loadProfile(args->getOption("profile"));
window->setDefaultProfile(key);
Profile::Ptr profile = SessionManager::instance()->loadProfile(args->getOption("profile"));
window->setDefaultProfile(profile);
}
}
......@@ -178,10 +178,8 @@ bool Application::processHelpArgs(KCmdLineArgs* args)
}
void Application::processProfileChangeArgs(KCmdLineArgs* args,MainWindow* window)
{
SessionManager* const manager = SessionManager::instance();
Profile* defaultProfile = manager->profile(window->defaultProfile());
Profile* const newProfile = new Profile(defaultProfile);
Profile::Ptr defaultProfile = window->defaultProfile();
Profile::Ptr newProfile = Profile::Ptr(new Profile(defaultProfile));
newProfile->setHidden(true);
// run a custom command
......@@ -215,13 +213,9 @@ void Application::processProfileChangeArgs(KCmdLineArgs* args,MainWindow* window
}
}
if (newProfile->isEmpty())
{
delete newProfile;
}
else
if (!newProfile->isEmpty())
{
window->setDefaultProfile(SessionManager::instance()->addProfile(newProfile));
window->setDefaultProfile(newProfile);
}
}
......@@ -272,17 +266,17 @@ void Application::detachView(Session* session)
window->show();
}
void Application::createWindow(const QString& key , const QString& directory)
void Application::createWindow(Profile::Ptr profile , const QString& directory)
{
MainWindow* window = newMainWindow();
window->setDefaultProfile(key);
createSession(key,directory,window->viewManager());
window->setDefaultProfile(profile);
createSession(profile,directory,window->viewManager());
window->show();
}
Session* Application::createSession(const QString& key , const QString& directory , ViewManager* view)
Session* Application::createSession(Profile::Ptr profile, const QString& directory , ViewManager* view)
{
Session* session = SessionManager::instance()->createSession(key);
Session* session = SessionManager::instance()->createSession(profile);
if (!directory.isEmpty() && session->initialWorkingDirectory().isEmpty())
session->setInitialWorkingDirectory(directory);
......
......@@ -23,6 +23,9 @@
// KDE
#include <KUniqueApplication>
// Konsole
#include "Profile.h"
class KCmdLineArgs;
namespace Konsole
......@@ -72,8 +75,8 @@ public:
static Application* self();
private slots:
Session* createSession(const QString& key, const QString& directory , ViewManager* view);
void createWindow(const QString& key , const QString& directory);
Session* createSession(Profile::Ptr profile, const QString& directory , ViewManager* view);
void createWindow(Profile::Ptr profile , const QString& directory);
void detachView(Session* session);
void toggleBackgroundInstance();
......
......@@ -50,7 +50,6 @@
#include "ui_EditProfileDialog.h"
#include "KeyBindingEditor.h"
#include "KeyboardTranslator.h"
#include "Profile.h"
#include "SessionManager.h"
#include "ShellCommand.h"
#include "TabTitleFormatAction.h"
......@@ -91,11 +90,11 @@ EditProfileDialog::EditProfileDialog(QWidget* parent)
SLOT(preparePage(int)) );
_tempProfile = new Profile;
_tempProfile->setHidden(true);
}
EditProfileDialog::~EditProfileDialog()
{
delete _ui;
delete _tempProfile;
}
void EditProfileDialog::save()
{
......@@ -128,16 +127,14 @@ void EditProfileDialog::updateCaption(const QString& profileName)
{
setCaption( i18n("Edit Profile \"%1\"",profileName) );
}
void EditProfileDialog::setProfile(const QString& key)
void EditProfileDialog::setProfile(Profile::Ptr profile)
{
_profileKey = key;
_profileKey = profile;
const Profile* info = SessionManager::instance()->profile(key);
Q_ASSERT( info );
Q_ASSERT( profile );
// update caption
updateCaption(info->name());
updateCaption(profile->name());
// mark each page of the dialog as out of date
// and force an update of the currently visible page
......@@ -148,17 +145,16 @@ void EditProfileDialog::setProfile(const QString& key)
if ( _tempProfile )
{
delete _tempProfile;
_tempProfile = new Profile;
}
}
const Profile* EditProfileDialog::lookupProfile() const
const Profile::Ptr EditProfileDialog::lookupProfile() const
{
return SessionManager::instance()->profile(_profileKey);
return _profileKey;
}
void EditProfileDialog::preparePage(int page)
{
const Profile* info = lookupProfile();
const Profile::Ptr info = lookupProfile();
Q_ASSERT( _pageNeedsUpdate.count() > page );
Q_ASSERT( info );
......@@ -194,7 +190,7 @@ void EditProfileDialog::selectProfileName()
_ui->profileNameEdit->selectAll();
_ui->profileNameEdit->setFocus();
}
void EditProfileDialog::setupGeneralPage(const Profile* info)
void EditProfileDialog::setupGeneralPage(const Profile::Ptr info)
{
// basic profile options
......@@ -238,7 +234,7 @@ void EditProfileDialog::setupGeneralPage(const Profile* info)
}
void EditProfileDialog::showEnvironmentEditor()
{
const Profile* info = lookupProfile();
const Profile::Ptr info = lookupProfile();
KDialog* dialog = new KDialog(this);
QTextEdit* edit = new QTextEdit(dialog);
......@@ -257,7 +253,7 @@ void EditProfileDialog::showEnvironmentEditor()
dialog->deleteLater();
}
void EditProfileDialog::setupTabsPage(const Profile* info)
void EditProfileDialog::setupTabsPage(const Profile::Ptr info)
{
// tab title format
_ui->tabTitleEdit->setClearButtonShown(true);
......@@ -372,7 +368,7 @@ void EditProfileDialog::selectInitialDir()
if ( !url.isEmpty() )
_ui->initialDirEdit->setText(url.path());
}
void EditProfileDialog::setupAppearancePage(const Profile* info)
void EditProfileDialog::setupAppearancePage(const Profile::Ptr info)
{
ColorSchemeViewDelegate* delegate = new ColorSchemeViewDelegate(this);
_ui->colorSchemeList->setItemDelegate(delegate);
......@@ -609,7 +605,7 @@ void EditProfileDialog::preview(int property , const QVariant& value)
_delayedPreviewProperties.remove(property);
const Profile* original = lookupProfile();
const Profile::Ptr original = lookupProfile();
if (!_previewedProperties.contains(property))
_previewedProperties.insert(property , original->property<QVariant>((Profile::Property)property) );
......@@ -729,7 +725,7 @@ void EditProfileDialog::updateTransparencyWarning()
_ui->transparencyWarningIcon->setPixmap( KIcon("dialog-warning").pixmap(QSize(48,48)) );
}
}
void EditProfileDialog::setupKeyboardPage(const Profile* /* info */)
void EditProfileDialog::setupKeyboardPage(const Profile::Ptr /* info */)
{
// setup translator list
updateKeyBindingsList(true);
......@@ -829,7 +825,7 @@ void EditProfileDialog::editKeyBinding()
{
showKeyBindingEditor(false);
}
void EditProfileDialog::setupCombo( ComboOption* options , const Profile* profile )
void EditProfileDialog::setupCombo( ComboOption* options , const Profile::Ptr profile )
{
while ( options->button != 0 )
{
......@@ -854,7 +850,7 @@ void EditProfileDialog::setupRadio( RadioOption* possible , int actual )
}
}
void EditProfileDialog::setupScrollingPage(const Profile* profile)
void EditProfileDialog::setupScrollingPage(const Profile::Ptr profile)
{
// setup scrollbar radio
int scrollBarPosition = profile->property<int>(Profile::ScrollBarPosition);
......@@ -912,7 +908,7 @@ void EditProfileDialog::showScrollBarRight()
{
_tempProfile->setProperty(Profile::ScrollBarPosition , Profile::ScrollBarRight );
}
void EditProfileDialog::setupAdvancedPage(const Profile* profile)
void EditProfileDialog::setupAdvancedPage(const Profile::Ptr profile)
{
ComboOption options[] = { { _ui->enableBlinkingTextButton , Profile::BlinkingTextEnabled ,
SLOT(toggleBlinkingText(bool)) },
......
......@@ -30,6 +30,9 @@
// KDE
#include <KDialog>
// Local
#include "Profile.h"
class QAbstractButton;
class QItemSelectionModel;
class QTextCodec;
......@@ -76,7 +79,7 @@ public:
*
* @param key The key for the session type provided by the SessionManager instance
*/
void setProfile(const QString& key);
void setProfile(Profile::Ptr profile);
/**
* Selects the text in the profile name edit area.
......@@ -168,12 +171,12 @@ private slots:
private:
// initialize various pages of the dialog
void setupGeneralPage(const Profile* info);
void setupTabsPage(const Profile* info);
void setupAppearancePage(const Profile* info);
void setupKeyboardPage(const Profile* info);
void setupScrollingPage(const Profile* info);
void setupAdvancedPage(const Profile* info);
void setupGeneralPage(const Profile::Ptr info);
void setupTabsPage(const Profile::Ptr info);
void setupAppearancePage(const Profile::Ptr info);
void setupKeyboardPage(const Profile::Ptr info);
void setupScrollingPage(const Profile::Ptr info);
void setupAdvancedPage(const Profile::Ptr info);
void updateColorSchemeList(bool selectCurrentScheme = false);
void updateColorSchemeButtons();
......@@ -207,13 +210,13 @@ private:
int property;
const char* slot;
};
void setupCombo(ComboOption* options , const Profile* profile);
void setupCombo(ComboOption* options , const Profile::Ptr profile);
const Profile* lookupProfile() const;
const Profile::Ptr lookupProfile() const;
Ui::EditProfileDialog* _ui;
Profile* _tempProfile;
QString _profileKey;
Profile::Ptr _tempProfile;
Profile::Ptr _profileKey;
// keeps track of pages which need to be updated to match the current
// profile. all elements in this vector are set to true when the
......
......@@ -163,9 +163,11 @@ const HistoryType& Emulation::history()
void Emulation::setCodec(const QTextCodec * qtc)
{
Q_ASSERT( qtc );
if (qtc)
_codec = qtc;
else
setCodec(LocaleCodec);
_codec = qtc;
delete _decoder;
_decoder = _codec->makeDecoder();
......
......@@ -115,11 +115,11 @@ void MainWindow::correctShortcuts()
helpAction->setShortcut( QKeySequence() );
}
void MainWindow::setDefaultProfile(const QString& key)
void MainWindow::setDefaultProfile(Profile::Ptr profile)
{
_defaultProfile = key;
_defaultProfile = profile;
}
QString MainWindow::defaultProfile() const
Profile::Ptr MainWindow::defaultProfile() const
{
return _defaultProfile;
}
......@@ -268,8 +268,8 @@ void MainWindow::setSessionList(ProfileList* list)
{
sessionListChanged(list->actions());
connect( list , SIGNAL(profileSelected(const QString&)) , this ,
SLOT(newFromProfile(const QString&)) );
connect( list , SIGNAL(profileSelected(Profile::Ptr)) , this ,
SLOT(newFromProfile(Profile::Ptr)) );
connect( list , SIGNAL(actionsChanged(const QList<QAction*>&)) , this ,
SLOT(sessionListChanged(const QList<QAction*>&)) );
......@@ -348,9 +348,9 @@ void MainWindow::showShortcutsDialog()
KShortcutsEditor::LetterShortcutsDisallowed, this );
}
void MainWindow::newFromProfile(const QString& key)
void MainWindow::newFromProfile(Profile::Ptr profile)
{
emit newSessionRequest(key, activeSessionDir(), _viewManager);
emit newSessionRequest(profile, activeSessionDir(), _viewManager);
}
void MainWindow::showManageProfilesDialog()
{
......@@ -360,9 +360,9 @@ void MainWindow::showManageProfilesDialog()
void MainWindow::showRemoteConnectionDialog()
{
RemoteConnectionDialog dialog(this);
if ( dialog.exec() == QDialog::Accepted )
emit newSessionRequest(dialog.sessionKey(),QString(),_viewManager);
// RemoteConnectionDialog dialog(this);
// if ( dialog.exec() == QDialog::Accepted )
// emit newSessionRequest(dialog.sessionKey(),QString(),_viewManager);
}
void MainWindow::setupWidgets()
......
......@@ -27,6 +27,9 @@
#include <KXmlGuiWindow>
#include <KUrl>
// Local
#include "Profile.h"
class KToggleAction;
namespace Konsole
......@@ -36,7 +39,6 @@ class IncrementalSearchBar;
class ViewManager;
class ViewProperties;
class SessionController;
class Profile;
class ProfileList;
class BookmarkHandler;
......@@ -82,30 +84,30 @@ class MainWindow : public KXmlGuiWindow
BookmarkHandler* bookmarkHandler() const;
/**
* Sets the default profile key for this window.
* This is the default value for the key argument
* Sets the default profile for this window.
* This is the default value for the profile argument
* when the newSessionRequest() and newWindow() signals
* are emitted.
*/
void setDefaultProfile(const QString& key);
void setDefaultProfile(Profile::Ptr profile);
/**
* Returns the default profile key for this window.
* Returns the default profile for this window.
* See setDefaultProfile()
*/
QString defaultProfile() const;
Profile::Ptr defaultProfile() const;
signals:
/**
* Emitted by the main window to request the creation of a new session.
*
* @param key The key for the profile to use to create the new session.
* @param profile The profile to use to create the new session.
* @param directory Initial working directory for the new session or empty
* if the default working directory associated with the profile should be used.
* @param view The view manager owned by this main window
*/
void newSessionRequest(const QString& key ,
void newSessionRequest(Profile::Ptr profile,
const QString& directory,
ViewManager* view);
......@@ -113,13 +115,13 @@ class MainWindow : public KXmlGuiWindow
* Emitted by the main window to request the creation of a
* new session in a new window.
*
* @param key The key for the profile to use to create the
* @param profile The profile to use to create the
* first session in the new window.
* @param directory Initial working directory for the new window or empty
* if the default working directory associated with the profile should
* be used.
*/
void newWindowRequest(const QString& key,
void newWindowRequest(Profile::Ptr profile,
const QString& directory);
/**
......@@ -137,7 +139,7 @@ class MainWindow : public KXmlGuiWindow
void showManageProfilesDialog();
void showRemoteConnectionDialog();
void showShortcutsDialog();
void newFromProfile(const QString&);
void newFromProfile(Profile::Ptr profile);
void activeViewChanged(SessionController* controller);
void activeViewTitleChanged(ViewProperties*);
......@@ -166,7 +168,7 @@ class MainWindow : public KXmlGuiWindow
QPointer<SessionController> _pluggedController;
QString _defaultProfile;
Profile::Ptr _defaultProfile;
bool _menuBarVisibilitySet;
};
......
This diff is collapsed.
......@@ -21,11 +21,14 @@
#define MANAGEPROFILESDIALOG_H
// Qt
#include <QtGui/QItemDelegate>
#include <QtGui/QStyledItemDelegate>
// KDE
#include <KDialog>
// Konsole
#include "Profile.h"
class QItemSelection;
class QShowEvent;
class QStandardItem;
......@@ -85,10 +88,10 @@ private slots:
// session manager
void updateTableModel();
void updateFavoriteStatus(const QString& key , bool favorite);
void updateFavoriteStatus(Profile::Ptr profile, bool favorite);
private:
QString selectedKey() const; // return the key associated with the currently selected
Profile::Ptr selectedKey() const; // return the profile associated with the currently selected
// item in the profile table
void updateDefaultItem(); // updates the font of the items to match
......@@ -102,7 +105,7 @@ private:
static const int ShortcutRole = Qt::UserRole + 1;
};
class ProfileItemDelegate : public QItemDelegate
class ProfileItemDelegate : public QStyledItemDelegate
{
public:
ProfileItemDelegate(QObject* parent = 0);
......
......@@ -89,9 +89,6 @@
<property name="whatsThis" >
<string/>
</property>
<property name="frameShadow" >
<enum>QFrame::Plain</enum>
</property>
<property name="alternatingRowColors" >
<bool>true</bool>
</property>
......
......@@ -101,7 +101,7 @@ Part::Part(QWidget* parentWidget , QObject* parent)
action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
// create basic session
createSession(QString());
createSession();
}
Part::~Part()
{
......@@ -155,7 +155,7 @@ void Part::terminalExited()
}
void Part::newTab()
{
createSession( QString() );
createSession();
showShellInDir( QString() );
}
Session* Part::activeSession() const
......@@ -204,9 +204,9 @@ void Part::sendInput( const QString& text )
activeSession()->emulation()->sendText(text);
}
Session* Part::createSession(const QString& key)
Session* Part::createSession(const Profile::Ptr profile)
{
Session* session = SessionManager::instance()->createSession(key);
Session* session = SessionManager::instance()->createSession(profile);
_viewManager->createView(session);
return session;
......@@ -254,7 +254,7 @@ void Part::showEditCurrentProfileDialog(QWidget* parent)
EditProfileDialog* dialog = new EditProfileDialog(parent);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setProfile( activeSession()->profileKey() );
dialog->setProfile( SessionManager::instance()->sessionProfile(activeSession()) );
dialog->show();
}
void Part::changeSessionSettings(const QString& text)
......
......@@ -25,6 +25,9 @@
#include <KParts/Part>
#include <kde_terminal_interface.h>
// Konsole
#include "Profile.h"
class QAction;
class QStringList;
......@@ -106,9 +109,9 @@ protected:
virtual bool openFile();
private slots:
// creates a new session using the specified key.
// creates a new session using the specified profile.
// call the run() method on the returned Session instance to begin the session
Session* createSession(const QString& key);
Session* createSession(const Profile::Ptr profile = Profile::Ptr());
void activeViewChanged(SessionController* controller);
void activeViewTitleChanged(ViewProperties* properties);
void showManageProfilesDialog();
......
......@@ -134,7 +134,7 @@ void Profile::fillTableWithDefaultNames()
}
FallbackProfile::FallbackProfile()
: Profile(0)
: Profile()
{
// Fallback settings
setProperty(Name,i18n("Shell"));
......@@ -176,17 +176,21 @@ FallbackProfile::FallbackProfile()
setHidden(true);
}
Profile::Profile(Profile* parent)
Profile::Profile(Profile::Ptr parent)
: _parent(parent)
,_hidden(false)
{
}
Profile::~Profile()
{
if (!name().isEmpty() && !isHidden())
kDebug() << "Destroying profile " << name();
}
bool Profile::isHidden() const { return _hidden; }
void Profile::setHidden(bool hidden) { _hidden = hidden; }
void Profile::setParent(Profile* parent) { _parent = parent; }
const Profile* Profile::parent() const { return _parent; }
void Profile::setParent(Profile::Ptr parent) { _parent = parent; }
const Profile::Ptr Profile::parent() const { return _parent; }
bool Profile::isEmpty() const
{
......@@ -244,7 +248,7 @@ void Profile::registerProperty(const PropertyInfo& info)
_infoByProperty.insert(info.property,info);
}
QString KDE4ProfileWriter::getPath(const Profile* info)
QString KDE4ProfileWriter::getPath(const Profile::Ptr info)
{
QString newPath;
......@@ -264,7 +268,7 @@ QString KDE4ProfileWriter::getPath(const Profile* info)
return newPath;
}
void KDE4ProfileWriter::writeProperties(KConfig& config,
const Profile* profile,
const Profile::Ptr profile,
const Profile::PropertyInfo* properties)
{
const char* groupName = 0;
......@@ -288,7 +292,7 @@ void KDE4ProfileWriter::writeProperties(KConfig& config,
properties++;
}
}
bool KDE4ProfileWriter::writeProfile(const QString& path , const Profile* profile)
bool KDE4ProfileWriter::writeProfile(const QString& path , const Profile::Ptr profile)
{
KConfig config(path,KConfig::NoGlobals);
......@@ -296,7 +300,7 @@ bool KDE4ProfileWriter::writeProfile(const QString& path , const Profile* profil
// Parent profile if set, when loading the profile in future, the parent
// must be loaded as well if it exists.
if ( profile->parent() != 0 )
if ( profile->parent() )
general.writeEntry("Parent",profile->parent()->path());
if ( profile->isPropertySet(Profile::Command)
......@@ -315,7 +319,7 @@ QStringList KDE4ProfileReader::findProfiles()
return KGlobal::dirs()->findAllResources("data","konsole/*.profile",
KStandardDirs::NoDuplicates);
}
void KDE4ProfileReader::readProperties(const KConfig& config, Profile* profile,
void KDE4ProfileReader::readProperties(const KConfig& config, Profile::Ptr profile,
const Profile::PropertyInfo* properties)
{
const char* groupName = 0;
......@@ -343,7 +347,7 @@ void KDE4ProfileReader::readProperties(const KConfig& config, Profile* profile,
}
}
bool KDE4ProfileReader::readProfile(const QString& path , Profile* profile , QString& parentProfile)
bool KDE4ProfileReader::readProfile(const QString& path , Profile::Ptr profile , QString& parentProfile)
{
KConfig config(path,KConfig::NoGlobals);
......@@ -369,7 +373,7 @@ QStringList KDE3ProfileReader::findProfiles()
return KGlobal::dirs()->findAllResources("data", "konsole/*.desktop",
KStandardDirs::NoDuplicates);
}
bool KDE3ProfileReader::readProfile(const QString& path , Profile* profile , QString& parentProfile)
bool KDE3ProfileReader::readProfile(const QString& path , Profile::Ptr profile , QString& parentProfile)
{
if (!QFile::exists(path))
return false;
......
......@@ -31,6 +31,9 @@
#include <QtGui/QFont>
// KDE
#include <KSharedPtr>
class KConfig;
class KConfigGroup;
......@@ -59,14 +62,15 @@ namespace Konsole
* pointer to the parent profile using QPointer<Profile>. Try to find
* a more light-weight solution to this.
*/
class Profile : public QObject
class Profile : public QSharedData
{
Q_OBJECT
friend class KDE4ProfileReader;
friend class KDE4ProfileWriter;
public:
typedef KSharedPtr<Profile> Ptr;
/**
* This enum describes the available properties
* which a Profile may consist of.
......@@ -254,18 +258,18 @@ public:
/**
* Constructs a new profile
*/
Profile(Profile* parent = 0);
virtual ~Profile() {}
explicit Profile(Ptr parent = Ptr());
virtual ~Profile();
/**