[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/pim/kblogger/src
From: Antonio Aloisio <antonio.aloisio () gmail ! com>
Date: 2008-05-11 0:05:39
Message-ID: 1210464339.597803.26475.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 806318 by aloisio:
Convert KBloggerLinkDialog class from QDialog to KDialog
M +4 -4 composer/composereditor.cpp
M +63 -14 composer/linkdialog.cpp
M +25 -6 composer/linkdialog.h
M +23 -66 composer/linkdialogbase.ui
M +1 -1 mainwidgetbase.ui
--- trunk/playground/pim/kblogger/src/composer/composereditor.cpp #806317:806318
@@ -59,8 +59,6 @@
{
setupUi( this );
- mLinkDialog = new KBloggerLinkDialog( this );
-
kDebug();
//Add a VisualEditor ActionCollection and Toolbar.
@@ -95,8 +93,6 @@
mPreviewBrowser->setPluginsEnabled(true);
mVisualTextEditor->setCheckSpellingEnabled ( true );
- connect ( mLinkDialog, SIGNAL ( addLink ( const QString&, const QString& ) ),
- this, SLOT ( addLink ( const QString&, const QString& ) ) );
connect ( composerTabWidget, SIGNAL ( currentChanged ( int) ),
this, SLOT ( syncEditors (int) ) );
connect ( getStyleButton, SIGNAL( clicked() ),
@@ -346,6 +342,10 @@
ancorHref = currentCharFormat.anchorHref();
kDebug() << "ComposerEditor::showLinkDialog()" << selectedText << endl;
+ mLinkDialog = new KBloggerLinkDialog( this );
+ connect ( mLinkDialog, SIGNAL ( addLink ( const QString&, const QString& ) ),
+ this, SLOT ( addLink ( const QString&, const QString& ) ) );
+
if ( selectedText.isEmpty() ) { //Add a link at the cursor position
mLinkDialog->setLinkName (QString());
mLinkDialog->show();
--- trunk/playground/pim/kblogger/src/composer/linkdialog.cpp #806317:806318
@@ -30,36 +30,85 @@
namespace KBlogger
{
+/** KBloggerLinkDialog Class **/
+KBloggerLinkDialog::KBloggerLinkDialog( QWidget *parent):KDialog(parent){
+ kDebug();
+ mLinkWidget= new LinkWidget(this);
+ setCaption( "Add Link" );
+ setButtons( KDialog::Ok | KDialog::Cancel );
+ setMainWidget( mLinkWidget );
-KBloggerLinkDialog::KBloggerLinkDialog(QWidget *parent)
- : QDialog(parent)
-{
- setupUi(this);
+ connect ( this, SIGNAL ( okClicked() ),
+ this, SLOT( slotAccept() ));
+/*
+ connect (mLinkWidget->targetLineEdit, SLOT( textChanged(QString) ),
+ this, SIGNAL( slotTargetFilled(QString) ) );
+ connect (mLinkWidget->nameLineEdit, SLOT( textChanged(QString) ),
+ this, SIGNAL( slotNameFilled(QString) ) );*/
+
+ //enableButtonOk( false );
+ show();
}
-void KBloggerLinkDialog::setLinkName(const QString &linkName = 0)
+KBloggerLinkDialog::~KBloggerLinkDialog(){
+ kDebug();
+ delete mLinkWidget;
+}
+/*
+void KBloggerLinkDialog::slotEnableButtonOk( bool state ){
+ kDebug();
+ enableButtonOk(state);
+}
+
+void KBloggerLinkDialog::slotTargetFilled(QString target){
+ kDebug();
+ bool state=false;
+ if (! mLinkWidget->nameLineEdit->text().isEmpty() ){
+ state=true;
+ }
+ enableButtonOk(state);
+
+}
+
+void KBloggerLinkDialog::slotNameFilled(QString name){
+ kDebug();
+ bool state=false;
+ if (! mLinkWidget->targetLineEdit->text().isEmpty() ){
+ state=true;
+ }
+ enableButtonOk(state);
+}
+*/
+void KBloggerLinkDialog::setLinkName( const QString &linkName )
{
if ( linkName.isEmpty() )
- nameLineEdit->clear();
+ mLinkWidget->nameLineEdit->clear();
else
- nameLineEdit->setText(linkName);//sanitize(linkName));
+ mLinkWidget->nameLineEdit->setText(linkName);//sanitize(linkName));
}
-
-
-void KBloggerLinkDialog::accept()
+void KBloggerLinkDialog::slotAccept()
{
kDebug();
- if ( targetLineEdit->text().isEmpty() || nameLineEdit->text().isEmpty()) return;
- emit addLink( targetLineEdit->text(), nameLineEdit->text() );
+ if ( mLinkWidget->targetLineEdit->text().isEmpty() ||
+ mLinkWidget->nameLineEdit->text().isEmpty()
+ ){
+ return;
+ }
+ emit addLink( mLinkWidget->targetLineEdit->text(), \
mLinkWidget->nameLineEdit->text() ); //targetLineEdit->setText("http://");
//nameLineEdit->clear();
close();
}
-void KBloggerLinkDialog::reject()
+/** LinkWidget **/
+LinkWidget::LinkWidget(QWidget *parent)
+ : QWidget(parent)
{
+ setupUi(this);
+}
+
+LinkWidget::~LinkWidget(){
kDebug();
- close();
}
} //namespace
--- trunk/playground/pim/kblogger/src/composer/linkdialog.h #806317:806318
@@ -25,24 +25,43 @@
#include <QWidget>
#include <klineedit.h>
+#include <kdialog.h>
+
#include "ui_linkdialogbase.h"
+
namespace KBlogger
{
+class LinkWidget;
-class KBloggerLinkDialog : public QDialog, public Ui::KBloggerLinkDialogBase
+/** Class KBloggerLinkDialog **/
+class KBloggerLinkDialog: public KDialog
{
Q_OBJECT
-
public:
- KBloggerLinkDialog(QWidget *parent = 0);
- void setLinkName(const QString &linkName); //Link Name
+ KBloggerLinkDialog( QWidget *parent = 0 );
+ virtual ~KBloggerLinkDialog();
+ void setLinkName(const QString &linkName);
Q_SIGNALS:
void addLink( const QString&, const QString& );
+
public Q_SLOTS:
- virtual void accept(); // OK Button
- virtual void reject(); // Cancel Button
+// void slotEnableButtonOk(bool state);
+// void slotTargetFilled(QString target);
+// void slotNameFilled(QString name);
+ void slotAccept(); // OK Button
+private:
+ LinkWidget *mLinkWidget;
+};
+/** Class LinkWidget **/
+class LinkWidget : public QWidget, public Ui::LinkWidgetBase
+{
+ Q_OBJECT
+
+public:
+ LinkWidget(QWidget *parent = 0);
+ virtual ~LinkWidget();
};
} //namespace
--- trunk/playground/pim/kblogger/src/composer/linkdialogbase.ui #806317:806318
@@ -1,24 +1,31 @@
<ui version="4.0" >
- <class>KBloggerLinkDialogBase</class>
- <widget class="QDialog" name="KBloggerLinkDialogBase" >
+ <class>LinkWidgetBase</class>
+ <widget class="QWidget" name="LinkWidgetBase" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
- <width>534</width>
- <height>128</height>
+ <width>540</width>
+ <height>119</height>
</rect>
</property>
<property name="windowTitle" >
- <string>Add a Link..</string>
+ <string>Form</string>
</property>
- <layout class="QGridLayout" >
+ <layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Enter the Link Target and the Name that will be displayed and press Ok \
to Add the new Link in your post.</string> + </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="textLabel1" >
<property name="text" >
- <string>Link Target:</string>
+ <string>Target:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
@@ -43,12 +50,12 @@
</item>
</layout>
</item>
- <item row="1" column="0" >
- <layout class="QHBoxLayout" >
+ <item row="2" column="0" >
+ <layout class="QHBoxLayout" name="_2" >
<item>
<widget class="QLabel" name="textLabel2" >
<property name="text" >
- <string>Link name:</string>
+ <string>Name</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
@@ -60,36 +67,19 @@
</item>
</layout>
</item>
- <item row="2" column="0" >
- <spacer>
+ <item row="3" column="0" >
+ <spacer name="spacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
- <width>516</width>
- <height>16</height>
+ <width>523</width>
+ <height>26</height>
</size>
</property>
</spacer>
</item>
- <item row="3" column="0" >
- <widget class="Line" name="line" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="4" column="0" >
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
</layout>
</widget>
<customwidgets>
@@ -100,38 +90,5 @@
</customwidget>
</customwidgets>
<resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>KBloggerLinkDialogBase</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel" >
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>KBloggerLinkDialogBase</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel" >
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>
--- trunk/playground/pim/kblogger/src/mainwidgetbase.ui #806317:806318
@@ -69,7 +69,7 @@
</property>
<column>
<property name="text" >
- <string>Accounts</string>
+ <string>Profiles</string>
</property>
</column>
</widget>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic