[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE_3_4_BRANCH: kdepim/kontact/plugins/knotes
From: Mario Teijeiro Otero <emeteo () escomposlinux ! org>
Date: 2005-04-12 18:07:24
Message-ID: 20050412180724.B0DB0633 () office ! kde ! org
[Download RAW message or body]
CVS commit by mteijeiro:
* Open the knote edit dialog on create a "new" note, BTW, create a new note
only requires one step.
* backport bug fix 99286
M +32 -4 knotes_part.cpp 1.51.2.1
M +5 -1 knotes_part.rc 1.4.2.1
M +22 -0 knotes_part_p.h 1.4.2.1
--- kdepim/kontact/plugins/knotes/knotes_part.cpp #1.51:1.51.2.1
@@ -128,5 +128,26 @@ QString KNotesPart::newNote( const QStri
journal->setDescription( text );
- mManager->addNewNote( journal );
+
+
+ // Edit the new note if text is empty
+ if ( text.isNull() )
+ {
+ if ( !mNoteEditDlg )
+ mNoteEditDlg = new KNoteEditDlg( widget() );
+
+ mNoteEditDlg->setTitle( journal->summary() );
+ mNoteEditDlg->setText( journal->description() );
+
+ if ( mNoteEditDlg->exec() == QDialog::Accepted )
+ {
+ journal->setSummary( mNoteEditDlg->title() );
+ journal->setDescription( mNoteEditDlg->text() );
+ }
+ else
+ {
+ delete journal;
+ return "";
+ }
+ }
KNotesIconViewItem *note = mNoteList[ journal->uid() ];
@@ -134,6 +155,6 @@ QString KNotesPart::newNote( const QStri
mNotesView->setCurrentItem( note );
+ mManager->addNewNote( journal );
mManager->save();
-
return journal->uid();
}
@@ -249,7 +270,12 @@ void KNotesPart::killSelectedNotes()
void KNotesPart::popupRMB( QIconViewItem *item, const QPoint& pos )
{
- QPopupMenu *contextMenu = static_cast<QPopupMenu *>( factory()->container( "note_context", this ) );
+ QPopupMenu *contextMenu = NULL;
- if ( !contextMenu || !item )
+ if ( item )
+ contextMenu = static_cast<QPopupMenu *>( factory()->container( "note_context", this ) );
+ else
+ contextMenu = static_cast<QPopupMenu *>( factory()->container( "notepart_context", this ) );
+
+ if ( !contextMenu )
return;
@@ -303,7 +329,9 @@ void KNotesPart::editNote( QIconViewItem
KCal::Journal *journal = static_cast<KNotesIconViewItem *>( item )->journal();
+ mNoteEditDlg->setTitle( journal->summary() );
mNoteEditDlg->setText( journal->description() );
if ( mNoteEditDlg->exec() == QDialog::Accepted ) {
+ journal->setSummary( mNoteEditDlg->title() );
journal->setDescription( mNoteEditDlg->text() );
mManager->save();
--- kdepim/kontact/plugins/knotes/knotes_part.rc #1.4:1.4.2.1
@@ -1,4 +1,4 @@
<!DOCTYPE kpartgui>
-<kpartgui name="knotes" version="2">
+<kpartgui name="knotes" version="3">
<MenuBar>
<Menu name="edit"><text>&Edit</text>
@@ -13,3 +13,7 @@
<Action name="edit_delete"/>
</Menu>
+ <Menu name="notepart_context">
+ <Action name="file_new"/>
+ </Menu>
+
</kpartgui>
--- kdepim/kontact/plugins/knotes/knotes_part_p.h #1.4:1.4.2.1
@@ -34,4 +34,5 @@
#include <qlayout.h>
+#include <qlabel.h>
#include <kactioncollection.h>
@@ -41,4 +42,5 @@
#include <kiconloader.h>
#include <kiconeffect.h>
+#include <klineedit.h>
#include <ktoolbar.h>
#include <kpopupmenu.h>
@@ -105,4 +107,13 @@ class KNoteEditDlg : public KDialogBase,
QVBoxLayout *layout = new QVBoxLayout( page );
+ QHBoxLayout *hbl = new QHBoxLayout( layout );
+ QLabel *label = new QLabel( page);
+ label->setText( i18n( "Name:" ) );
+ hbl->addWidget( label,0 );
+ mTitleEdit= new KLineEdit( page, "name" );
+ hbl->addWidget( mTitleEdit, 1,Qt::AlignVCenter );
+
+// layout->addLayout( hbl);
+
mNoteEdit = new KNoteEdit( actionCollection(), page );
mNoteEdit->setFocus();
@@ -128,5 +139,16 @@ class KNoteEditDlg : public KDialogBase,
}
+ QString title() const
+ {
+ return mTitleEdit->text();
+ }
+
+ void setTitle( const QString& text )
+ {
+ mTitleEdit->setText( text );
+ }
+
private:
+ KLineEdit *mTitleEdit;
KNoteEdit *mNoteEdit;
KToolBar *mTool;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic