summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmlibraryhandleedit.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit47d455dd55be855e4cc691c32f687f723d9247ee (patch)
tree52e236aaa2576bdb3840ebede26619692fed6d7d /kpovmodeler/pmlibraryhandleedit.cpp
downloadtdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.tar.gz
tdegraphics-47d455dd55be855e4cc691c32f687f723d9247ee.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpovmodeler/pmlibraryhandleedit.cpp')
-rw-r--r--kpovmodeler/pmlibraryhandleedit.cpp131
1 files changed, 131 insertions, 0 deletions
diff --git a/kpovmodeler/pmlibraryhandleedit.cpp b/kpovmodeler/pmlibraryhandleedit.cpp
new file mode 100644
index 00000000..8c26682d
--- /dev/null
+++ b/kpovmodeler/pmlibraryhandleedit.cpp
@@ -0,0 +1,131 @@
+/*
+**************************************************************************
+ description
+ --------------------
+ copyright : (C) 2003 by Luis Carvalho
+ email : lpassos@oninetspeed.pt
+**************************************************************************
+
+**************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+**************************************************************************/
+
+#include "pmlibraryhandleedit.h"
+
+#include <qpushbutton.h>
+#include <qcheckbox.h>
+#include <qlineedit.h>
+#include <qtextedit.h>
+#include <qvbox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+
+#include <klocale.h>
+#include <kconfig.h>
+#include <kmessagebox.h>
+#include <kfiledialog.h>
+
+#include "pmlineedits.h"
+#include "pmdialogeditbase.h"
+#include "pmlibraryhandle.h"
+
+QSize PMLibraryHandleEdit::s_size = QSize( 600, 400 );
+
+PMLibraryHandleEdit::PMLibraryHandleEdit( PMLibraryHandle* lib, QWidget* parent, const char* name )
+ : KDialogBase( parent, name, true, i18n( "Create Library" ),
+ Ok | Cancel, Ok )
+{
+ m_pLibrary = lib;
+
+ resize( s_size );
+ QWidget* page = new QWidget( this );
+ setMainWidget( page );
+ QVBoxLayout* vl = new QVBoxLayout( page, KDialog::spacingHint( ) );
+
+ QGridLayout* grid = new QGridLayout( vl, 5, 2 );
+ QLabel* lbl = new QLabel( i18n( "Name: " ), page );
+ m_pNameEdit = new QLineEdit( page );
+ grid->addWidget( lbl, 0, 0 );
+ grid->addWidget( m_pNameEdit, 0, 1 );
+
+ lbl = new QLabel( i18n( "Author: " ), page );
+ m_pAuthorEdit = new QLineEdit( page );
+ grid->addWidget( lbl, 1, 0 );
+ grid->addWidget( m_pAuthorEdit, 1, 1 );
+
+ lbl = new QLabel( i18n( "Description: " ), page );
+ m_pDescriptionEdit = new QTextEdit( page );
+ m_pDescriptionEdit->setMaximumHeight( 120 );
+ grid->addWidget( lbl, 2, 0 );
+ grid->addMultiCellWidget( m_pDescriptionEdit, 2, 3, 1, 1 );
+ grid->setRowStretch( 3, 1 );
+
+ m_pReadOnlyEdit = new QCheckBox( i18n( "Allow changes to the library?" ), page );
+ grid->addMultiCellWidget( m_pReadOnlyEdit, 4, 4, 0, 1 );
+
+ // Load the fields with values
+ m_pNameEdit->setText( lib->name( ) );
+ m_pDescriptionEdit->setText( lib->description( ) );
+ m_pAuthorEdit->setText( lib->author( ) );
+ m_pReadOnlyEdit->setChecked( !lib->isReadOnly( ) );
+
+ // Setup the signals
+ connect( m_pNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( slotEditsChanged( const QString& ) ) );
+ connect( m_pAuthorEdit, SIGNAL( textChanged( const QString& ) ), SLOT( slotEditsChanged( const QString& ) ) );
+ connect( m_pDescriptionEdit, SIGNAL( textChanged( ) ), SLOT( slotDescriptionChanged( ) ) );
+ connect( m_pReadOnlyEdit, SIGNAL( clicked( ) ), SLOT( slotReadOnlyChanged( ) ) );
+
+ // On startup you can only cancel
+ enableButtonOK( false );
+}
+
+void PMLibraryHandleEdit::slotReadOnlyChanged( )
+{
+ enableButtonOK( true );
+}
+
+void PMLibraryHandleEdit::slotEditsChanged( const QString& /*str*/ )
+{
+ enableButtonOK( true );
+}
+
+void PMLibraryHandleEdit::slotDescriptionChanged( )
+{
+ enableButtonOK( true );
+}
+
+void PMLibraryHandleEdit::saveConfig( KConfig* cfg )
+{
+ cfg->setGroup( "Appearance" );
+ cfg->writeEntry( "LibraryHandleEditSize", s_size );
+}
+
+void PMLibraryHandleEdit::restoreConfig( KConfig* cfg )
+{
+ cfg->setGroup( "Appearance" );
+
+ QSize defaultSize( 300, 200 );
+ s_size = cfg->readSizeEntry( "LibraryHandleEditSize", &defaultSize );
+}
+
+void PMLibraryHandleEdit::resizeEvent( QResizeEvent* ev )
+{
+ s_size = ev->size( );
+}
+
+void PMLibraryHandleEdit::slotOk( )
+{
+ m_pLibrary->setName( m_pNameEdit->text( ) );
+ m_pLibrary->setAuthor( m_pAuthorEdit->text( ) );
+ m_pLibrary->setDescription( m_pDescriptionEdit->text( ) );
+ m_pLibrary->setReadOnly( !m_pReadOnlyEdit->isChecked( ) );
+
+ accept( );
+}
+
+#include "pmlibraryhandleedit.moc"