[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: [Kde-pim] [PATCH] KNotes (some items of the todo list...)
From: "Gerold J. Wucherpfennig" <gjwucherpfennig () gmx ! net>
Date: 2003-04-22 18:43:09
[Download RAW message or body]
Please review and tell me if I may check this into CVS
(...and please CC me)
["knotes.diff" (text/x-diff)]
diff -u -3 -p -u -r1.51 Makefile.am
--- kdepim/knotes/Makefile.am 26 Jan 2003 22:46:19 -0000 1.51
+++ kdepim/knotes/Makefile.am 22 Apr 2003 10:38:45 -0000
@@ -5,8 +5,8 @@ SUBDIRS = . pics icons
bin_PROGRAMS = knotes
include_HEADERS = KNotesIface.h
-noinst_HEADERS = knotesapp.h knote.h knoteedit.h knoteconfigdlg.h knotebutton.h \
knoteslegacy.h
-knotes_SOURCES = knotesapp.cpp knote.cpp knoteedit.cpp knotebutton.cpp \
knoteconfigdlg.cpp main.cpp KNotesIface.skel knoteslegacy.cpp +noinst_HEADERS = \
knotesapp.h knote.h knoteedit.h knoteconfigdlg.h knotebutton.h knotebutton2.h \
knoteslegacy.h +knotes_SOURCES = knotesapp.cpp knote.cpp knoteedit.cpp \
knotebutton.cpp knotebutton2.cpp knoteconfigdlg.cpp main.cpp KNotesIface.skel \
knoteslegacy.cpp knotes_LDADD = $(LIB_KIO) -lkdeprint \
$(top_builddir)/libkcal/libkcal.la knotes_LDFLAGS = $(all_libraries) $(KDE_RPATH)
diff -u -3 -p -u -r1.80 knote.cpp
--- kdepim/knotes/knote.cpp 3 Apr 2003 17:04:45 -0000 1.80
+++ kdepim/knotes/knote.cpp 22 Apr 2003 10:38:47 -0000
@@ -47,6 +47,7 @@
#include "knote.h"
#include "knotebutton.h"
+#include "knotebutton2.h"
#include "knoteedit.h"
#include "knoteconfigdlg.h"
#include "version.h"
@@ -67,14 +68,14 @@ extern Atom qt_sm_client_id;
using namespace KCal;
-KNote::KNote( KXMLGUIBuilder* builder, QDomDocument buildDoc, Journal *j,
+KNote::KNote( KNotesApp* notesapp, QDomDocument buildDoc, Journal *j,
QWidget* parent, const char* name )
: QFrame( parent, name, WStyle_Customize | WStyle_NoBorder | WDestructiveClose ),
m_journal( j )
{
// to disable kwin's session management (ie. saving positions of windows) we \
need to // remove the session id from all note windows
- XChangeProperty( x11Display(), winId(), qt_sm_client_id, XA_STRING, 8,
+ XChangeProperty( x11Display(), winId(), qt_sm_client_id, XA_STRING, 8,
PropModeReplace, 0, 0 );
// create the menu items for the note - not the editor...
@@ -89,6 +90,13 @@ KNote::KNote( KXMLGUIBuilder* builder, Q
new KAction( i18n("Print..."), "fileprint", 0, this, SLOT(slotPrint()), \
actionCollection(), "print_note" );
new KAction( i18n("Preferences..."), "configure", 0, this, \
SLOT(slotPreferences()), actionCollection(), "configure_note" );
+ new KAction( i18n("Hide"), "fileclose", 0, notesapp, \
SLOT(slotHideSelectedNotes()), actionCollection(), "hide_selected" ); + new \
KAction( i18n("Delete"), "knotes_delete", 0, notesapp, SLOT(slotKillSelectedNotes()), \
actionCollection(), "delete_selected" ); + new KAction( i18n("Deselect"), \
"mime_empty", 0, notesapp, SLOT(slotDeselectAllNotes()), actionCollection(), \
"deselect_notes" ); + new KAction( i18n("Hide"), "fileclose", 0, notesapp, \
SLOT(slotHideAllNotes()), actionCollection(), "hide_all" ); + new KAction( \
i18n("Delete"), "knotes_delete", 0, notesapp, SLOT(slotKillAllNotes()), \
actionCollection(), "delete_all" ); + new KAction( i18n("Show"), "knotes", 0, \
notesapp, SLOT(slotShowAllNotes()), actionCollection(), "show_all" ); +
m_alwaysOnTop = new KToggleAction( i18n("Always on Top"), "attach", 0, this, \
SLOT(slotToggleAlwaysOnTop()), actionCollection(), "always_on_top" );
connect( m_alwaysOnTop, SIGNAL(toggled(bool)), m_alwaysOnTop, \
SLOT(setChecked(bool)) );
m_toDesktop = new KListAction( i18n("To Desktop"), 0, this, \
SLOT(slotPopupActionToDesktop(int)), actionCollection(), "to_desktop" ); @@ -96,7 \
+104,12 @@ KNote::KNote( KXMLGUIBuilder* builder, Q
// create the note header, button and label...
m_button = new KNoteButton( "knotes_close", this );
+ m_button2 = new KNoteButton2( "flag", this );
connect( m_button, SIGNAL( clicked() ), this, SLOT( slotClose() ) );
+ connect( m_button2, SIGNAL( toggled(bool) ), this, SLOT ( slotSelect(bool)) );
+ connect( this, SIGNAL( sigSelected(bool) ), m_button2, SLOT ( setOn(bool)) );
+
+ selected=false;
m_label = new QLabel( this );
m_label->setAlignment( AlignHCenter );
@@ -113,14 +126,15 @@ KNote::KNote( KXMLGUIBuilder* builder, Q
m_editor->viewport()->installEventFilter( this );
setDOMDocument( buildDoc );
- factory = new KXMLGUIFactory( builder, this, "guifactory" );
+ knotesapp = notesapp;
+ factory = new KXMLGUIFactory( (KXMLGUIBuilder*)notesapp, this, "guifactory" );
factory->addClient( this );
m_menu = static_cast<KPopupMenu*>(factory->container( "note_context", this ));
m_edit_menu = static_cast<KPopupMenu*>(factory->container( "note_edit", this ));
setFocusProxy( m_editor );
-
+
// create the resize handle
m_editor->setCornerWidget( new QSizeGrip( this ) );
uint width = m_editor->cornerWidget()->width();
@@ -145,10 +159,10 @@ KNote::KNote( KXMLGUIBuilder* builder, Q
m_editor->setMargin( 5 );
m_editor->setFrameStyle( NoFrame );
m_editor->setBackgroundMode( PaletteBase );
-
+
// get the config attachment
m_configFile = m_journal->attachments(CONFIG_MIME).first()->uri();
-
+
// load the display configuration of the note
KSimpleConfig config( m_configFile );
config.setGroup( "Display" );
@@ -206,7 +220,7 @@ void KNote::saveData()
{
m_journal->setSummary( m_label->text() );
m_journal->setDescription( m_editor->text() );
-
+
// TODO: call m_calendar.update( this ) in knotesapp?
emit sigDataChanged();
m_editor->setModified( false );
@@ -223,7 +237,7 @@ void KNote::saveConfig() const
config.setGroup( "Display" );
config.writeEntry( "width", width() );
config.writeEntry( "height", height() - (m_tool->isHidden() ? \
0:m_tool->height()) );
-
+
NETWinInfo wm_client( qt_xdisplay(), winId(), qt_xrootwin(), NET::WMDesktop | \
NET::WMState ); config.setGroup( "WindowDisplay" );
config.writeEntry( "desktop", wm_client.desktop() );
@@ -335,9 +349,9 @@ void KNote::slotClose()
hide(); //just hide the note so it's still available from the dock window
}
-void KNote::slotKill()
+void KNote::slotKill(bool force)
{
- if ( KMessageBox::warningYesNo( this,
+ if ( force || KMessageBox::warningYesNo( this,
i18n("<qt>Do you really want to delete note <b>%1</b>?</qt>").arg( \
m_label->text() ), i18n("Confirm Delete") ) == KMessageBox::Yes )
{
@@ -345,6 +359,13 @@ void KNote::slotKill()
}
}
+void KNote::slotSelect( bool select )
+{
+ selected=select;
+ updateFocus();
+ emit sigSelected(select);
+}
+
void KNote::slotInsDate()
{
m_editor->insert( \
KGlobal::locale()->formatDateTime(QDateTime::currentDateTime()) ); @@ -451,7 +472,7 \
@@ void KNote::slotPrint()
QPainter painter;
painter.begin( &printer );
-
+
const int margin = 40; // pt
QPaintDeviceMetrics metrics( painter.device() );
@@ -541,11 +562,10 @@ void KNote::slotApplyConfig()
QColor fg = config.readColorEntry( "fgcolor", &(Qt::black) );
setColor( fg, bg );
-
+
emit sigConfigChanged();
}
-
// -------------------- private methods -------------------- //
void KNote::setColor( const QColor &fg, const QColor &bg )
@@ -571,7 +591,8 @@ void KNote::setColor( const QColor &fg,
QPalette darker = palette();
darker.setColor( QColorGroup::Button, bg.dark(116) );
m_button->setPalette( darker );
-
+ m_button2->setPalette( darker );
+
// to set the color of the title
updateFocus();
}
@@ -579,12 +600,13 @@ void KNote::setColor( const QColor &fg,
void KNote::updateFocus()
{
kdDebug(5500) << k_funcinfo << endl;
- if ( hasFocus() )
+ if ( hasFocus() || isSelected() )
{
m_label->setBackgroundColor( palette().active().shadow() );
m_button->show();
+ m_button2->show();
m_editor->cornerWidget()->show();
-
+
if ( m_tool->isHidden() && m_editor->textFormat() == QTextEdit::RichText )
{
m_tool->show();
@@ -595,8 +617,9 @@ kdDebug(5500) << k_funcinfo << endl;
{
m_label->setBackgroundColor( palette().active().background() );
m_button->hide();
+ m_button2->hide();
m_editor->cornerWidget()->hide();
-
+
if ( !m_tool->isHidden() )
{
m_tool->hide();
@@ -615,34 +638,42 @@ kdDebug(5500) << k_funcinfo << endl;
int headerHeight = m_label->sizeHint().height();
int margin = m_editor->margin();
- m_button->setGeometry(
+ m_button->setGeometry(
frameRect().width() - headerHeight - 2,
- frameRect().y() + 2,
- headerHeight,
- headerHeight
+ frameRect().y() + 2,
+ headerHeight,
+ headerHeight
);
- m_label->setGeometry(
- frameRect().x() + 2,
+ m_button2->setGeometry(
+ frameRect().x() + 2,
frameRect().y() + 2,
- frameRect().width() - (m_button->isHidden()?0:headerHeight) - 4,
- headerHeight
+ headerHeight,
+ headerHeight
);
-
- m_tool->setGeometry(
- contentsRect().x(),
+
+
+ m_label->setGeometry(
+ frameRect().x() + (m_button2->isHidden()?0:headerHeight) + 2,
+ frameRect().y() + 2,
+ frameRect().width() - (m_button->isHidden()?0:headerHeight) - \
(m_button2->isHidden()?0:headerHeight) - 4, + headerHeight
+ );
+
+ m_tool->setGeometry(
+ contentsRect().x(),
contentsRect().y() + headerHeight + 2,
- contentsRect().width(),
+ contentsRect().width(),
16
//m_tool->minimumSizeHint().height()
);
int toolHeight = m_tool->isHidden() ? 0 : m_tool->height();
- m_editor->setGeometry(
- contentsRect().x(),
+ m_editor->setGeometry(
+ contentsRect().x(),
contentsRect().y() + headerHeight + toolHeight + 2,
- contentsRect().width(),
+ contentsRect().width(),
contentsRect().height() - headerHeight - toolHeight - 4
);
@@ -691,7 +722,7 @@ bool KNote::eventFilter( QObject* o, QEv
if ( ev->type() == QEvent::MouseButtonDblClick )
slotRename();
- if ( ev->type() == QEvent::MouseButtonRelease &&
+ if ( ev->type() == QEvent::MouseButtonRelease &&
(e->button() == LeftButton || e->button() == MidButton) )
{
m_dragging = false;
@@ -700,13 +731,13 @@ bool KNote::eventFilter( QObject* o, QEv
}
if ( ev->type() == QEvent::MouseButtonPress &&
- (e->button() == LeftButton || e->button() == MidButton))
+ (e->button() == LeftButton || e->button() == MidButton))
{
m_pointerOffset = e->pos();
m_label->grabMouse( sizeAllCursor );
-
+
e->button() == LeftButton ? raise() : lower();
-
+
return true;
}
@@ -721,7 +752,7 @@ bool KNote::eventFilter( QObject* o, QEv
(e->pos().x() - m_pointerOffset.x())
+
(e->pos().y() - m_pointerOffset.y()) *
- (e->pos().y() - m_pointerOffset.y()) >= 9
+ (e->pos().y() - m_pointerOffset.y()) >= 9
);
}
return true;
@@ -736,7 +767,7 @@ bool KNote::eventFilter( QObject* o, QEv
return false;
}
-
+
if ( o == m_editor )
{
if ( ev->type() == QEvent::FocusOut )
@@ -751,7 +782,7 @@ bool KNote::eventFilter( QObject* o, QEv
return false;
}
-
+
if ( o == m_editor->viewport() )
{
if ( ev->type() == QEvent::MouseButtonPress )
@@ -767,3 +798,4 @@ bool KNote::eventFilter( QObject* o, QEv
#include "knote.moc"
#include "knotebutton.moc"
+#include "knotebutton2.moc"
diff -u -3 -p -u -r1.24 knote.h
--- kdepim/knotes/knote.h 3 Apr 2003 17:04:45 -0000 1.24
+++ kdepim/knotes/knote.h 22 Apr 2003 10:38:48 -0000
@@ -28,6 +28,8 @@
#include <kxmlguiclient.h>
+#include "knotesapp.h"
+
class QLabel;
class KXMLGUIBuilder;
@@ -37,6 +39,7 @@ class KPopupMenu;
class KToggleAction;
class KListAction;
class KNoteButton;
+class KNoteButton2;
class KNoteEdit;
namespace KCal {
@@ -48,10 +51,13 @@ class KNote : public QFrame, virtual pub
{
Q_OBJECT
public:
- KNote( KXMLGUIBuilder *builder, QDomDocument buildDoc, KCal::Journal *journal,
+ KNote( KNotesApp *notesapp, QDomDocument buildDoc, KCal::Journal *journal,
QWidget *parent=0, const char *name=0 );
~KNote();
+ bool isSelected() { return selected; }
+ //void select( bool select = true ) { selected=select; }
+
void saveData();
void saveConfig() const;
@@ -71,7 +77,8 @@ public slots:
void slotNewNote();
void slotRename();
void slotClose();
- void slotKill();
+ void slotKill( bool force=false );
+ void slotSelect( bool );
void slotMail() /*const*/;
void slotPrint();
void slotInsDate();
@@ -86,6 +93,7 @@ signals:
void sigKillNote( KCal::Journal* );
void sigDataChanged();
void sigConfigChanged();
+ void sigSelected(bool);
protected:
virtual void resizeEvent( QResizeEvent* );
@@ -99,6 +107,9 @@ private slots:
void slotApplyConfig();
private:
+ bool selected;
+ KNotesApp *knotesapp;
+
void updateFocus();
void updateLayout();
void setColor( const QColor&, const QColor& );
@@ -108,9 +119,10 @@ private:
QLabel *m_label;
KNoteButton *m_button;
+ KNoteButton2 *m_button2;
KNoteEdit *m_editor;
QWidget *m_tool;
-
+
KCal::Journal *m_journal;
QString m_configFile;
@@ -119,7 +131,7 @@ private:
KPopupMenu *m_menu;
KPopupMenu *m_edit_menu;
-
+
KXMLGUIFactory *factory;
};
diff -u -3 -p -u -r1.51 knotesapp.cpp
--- kdepim/knotes/knotesapp.cpp 3 Apr 2003 17:04:45 -0000 1.51
+++ kdepim/knotes/knotesapp.cpp 22 Apr 2003 10:38:49 -0000
@@ -60,30 +60,30 @@ KNotesApp::KNotesApp()
KWin::setSystemTrayWindowFor( winId(), qt_xrootwin() );
setBackgroundMode( X11ParentRelative );
setPixmap( KGlobal::iconLoader()->loadIcon( "knotes", KIcon::Small ) );
-
+
// create the GUI...
new KAction( i18n("New Note"), "filenew", 0, this, SLOT(slotNewNote()), \
actionCollection(), "new_note" );
new KAction( i18n("New Note From Clipboard"), "editpaste", 0, this, \
SLOT(slotNewNoteFromClipboard()), actionCollection(), "new_note_clipboard" ); new \
KHelpMenu( this, kapp->aboutData(), false, actionCollection() );
-
+
KStdAction::preferences( this, SLOT(slotPreferences()), actionCollection() );
KStdAction::keyBindings( this, SLOT(slotConfigureAccels()), actionCollection() \
);
KStdAction::quit( this, SLOT(slotQuit()), actionCollection() )->setShortcut( 0 \
);
-
+
setXMLFile( QString( instance()->instanceName() + "ui.rc" ) );
factory = new KXMLGUIFactory( this, this, "guifactory" );
factory->addClient( this );
m_context_menu = static_cast<KPopupMenu*>(factory->container( "knotes_context", \
this ));
m_note_menu = static_cast<KPopupMenu*>(factory->container( "notes_menu", this \
));
-
+
// create accels for global shortcuts
globalAccel = new KGlobalAccel( this, "global accel" );
- globalAccel->insert( "global_new_note", i18n("New Note"), "",
- ALT+SHIFT+Key_N, ALT+SHIFT+Key_N ,
+ globalAccel->insert( "global_new_note", i18n("New Note"), "",
+ ALT+SHIFT+Key_N, ALT+SHIFT+Key_N ,
this, SLOT(slotNewNote()), true, true );
globalAccel->insert( "global_new_note_clipboard", i18n("New Note From \
Clipboard"), "",
- ALT+SHIFT+Key_C, ALT+SHIFT+Key_C,
+ ALT+SHIFT+Key_C, ALT+SHIFT+Key_C,
this, SLOT(slotNewNoteFromClipboard()), true, true );
globalAccel->readSettings();
@@ -101,7 +101,7 @@ KNotesApp::KNotesApp()
m_calendar.load( KGlobal::dirs()->saveLocation( "appdata" ) + "notes.ics" );
// TODO
- // initialize the Calendar
+ // initialize the Calendar
//m_calendar.setOwner(..);
//m_calendar.setEmail(..);
@@ -120,14 +120,14 @@ KNotesApp::KNotesApp()
QString file = noteDir.absFilePath( note->uid() );
// ...and "fill" it with the default config
- KIO::NetAccess::copy(
+ KIO::NetAccess::copy(
KURL( KGlobal::dirs()->findResource( "config", "knotesrc" ) ),
- KURL( file )
+ KURL( file )
);
-
+
note->addAttachment( new Attachment( file, CONFIG_MIME ) );
}
-
+
if ( note->summary().isNull() && note->dtStart().isValid() )
note->setSummary( KGlobal::locale()->formatDateTime( note->dtStart() ) \
);
@@ -143,9 +143,9 @@ KNotesApp::KNotesApp()
updateNoteActions();
connect( kapp, SIGNAL(lastWindowClosed()), kapp, SLOT(quit()) );
-
+
kapp->installEventFilter( this );
-
+
if ( m_noteList.count() == 0 && !kapp->isRestored() )
newNote();
}
@@ -153,7 +153,7 @@ KNotesApp::KNotesApp()
KNotesApp::~KNotesApp()
{
saveNotes();
-
+
blockSignals( true );
m_noteList.clear();
blockSignals( false );
@@ -187,7 +187,7 @@ QString KNotesApp::newNote( const QStrin
note->setSummary( name );
else
note->setSummary( KGlobal::locale()->formatDateTime( \
QDateTime::currentDateTime() ) );
-
+
note->setDescription( text );
note->addAttachment( new Attachment( file, CONFIG_MIME ) );
m_calendar.addJournal( note );
@@ -218,7 +218,7 @@ void KNotesApp::showNote( const QString&
KNote* note = m_noteList[id];
if ( note )
showNote( note );
- else
+ else
kdWarning(5500) << "No note with id: " << id << endl;
}
@@ -277,7 +277,7 @@ void KNotesApp::setName( const QString&
note->setName( newName );
updateNoteActions();
}
- else
+ else
kdWarning(5500) << "No note with id: " << id << endl;
}
@@ -286,7 +286,7 @@ void KNotesApp::setText( const QString&
KNote* note = m_noteList[id];
if ( note )
note->setText( newText );
- else
+ else
kdWarning(5500) << "No note with id: " << id << endl;
}
@@ -356,7 +356,7 @@ bool KNotesApp::eventFilter( QObject* o,
QDictIterator<KNote> it( m_noteList );
KNote* first = it.toFirst();
for ( ; it.current(); ++it )
- if ( it.current()->hasFocus() )
+ if ( it.current()->hasFocus() )
{
if ( ++it )
showNote( it.current() );
@@ -403,7 +403,7 @@ void KNotesApp::slotNoteKilled( Journal
QString configFile = journal->attachments( CONFIG_MIME ).first()->uri();
if ( !QDir::home().remove( configFile ) )
kdError(5500) << "Can't remove the note config: " << configFile << endl;
-
+
m_calendar.deleteJournal( journal );
updateNoteActions();
@@ -456,7 +456,7 @@ void KNotesApp::saveConfig()
{
QDictIterator<KNote> it( m_noteList );
for ( ; it.current(); ++it )
- it.current()->saveConfig();
+ it.current()->saveConfig();
}
void KNotesApp::saveNotes()
@@ -473,8 +473,8 @@ void KNotesApp::updateNoteActions()
for ( QDictIterator<KNote> it( m_noteList ); it.current(); ++it )
{
- KAction *action = new KAction( it.current()->name().replace( "&", "&&"), \
KShortcut(),
- this, SLOT(slotShowNote()),
+ KAction *action = new KAction( it.current()->name().replace( "&", "&&"), \
KShortcut(), + this, SLOT(slotShowNote()),
(QObject*)0, it.current()->noteId().utf8() );
QPixmap pix( 16, 16 );
pix.fill( it.current()->paletteBackgroundColor() );
@@ -505,7 +505,7 @@ void KNotesApp::updateGlobalAccels()
globalAccel->updateConnections();
}
else
- {
+ {
KAction *action = actionCollection()->action( "new_note" );
if ( action )
action->setShortcut( 0 );
@@ -513,6 +513,66 @@ void KNotesApp::updateGlobalAccels()
if ( action )
action->setShortcut( 0 );
}
+}
+
+
+void KNotesApp::slotDeselectAllNotes()
+{
+ for ( QDictIterator<KNote> it(m_noteList); it.current(); ++it )
+ it.current()->slotSelect(false);
+}
+
+void KNotesApp::slotHideSelectedNotes()
+{
+ for ( QDictIterator<KNote> it(m_noteList); it.current(); ++it )
+ if (it.current()->isSelected())
+ hideNote(it.current()->noteId());
+}
+
+void KNotesApp::slotKillSelectedNotes()
+{
+ if ( KMessageBox::warningYesNo( this,
+ i18n("Do you really want to delete the selected notes?"),
+ i18n("Confirm Delete Selected") ) == KMessageBox::Yes )
+ {
+
+ for ( QDictIterator<KNote> it(m_noteList); it.current(); )
+ if (it.current()->isSelected())
+ killNote(it.current()->noteId());
+ else ++it;
+ }
+}
+
+void KNotesApp::slotKillAllNotes()
+{
+ if ( KMessageBox::warningYesNo( this,
+ i18n("Do you really want to delete all notes?"),
+ i18n("Confirm Delete All") ) == KMessageBox::Yes )
+ {
+
+ KNote* note;
+ for ( QDictIterator<KNote> it(m_noteList); it.current(); ) {
+ note = m_noteList[it.current()->noteId()];
+ if ( note ) {
+ note->slotKill(true);
+ } else {
+ kdWarning(5500) << "No note with id: " << it.current()->noteId() << \
endl; + ++it;
+ }
+ }
+ }
+}
+
+void KNotesApp::slotHideAllNotes()
+{
+ for ( QDictIterator<KNote> it(m_noteList); it.current(); ++it )
+ hideNote(it.current()->noteId());
+}
+
+void KNotesApp::slotShowAllNotes()
+{
+ for ( QDictIterator<KNote> it(m_noteList); it.current(); ++it )
+ showNote(it.current()->noteId());
}
#include "knotesapp.moc"
diff -u -3 -p -u -r1.22 knotesapp.h
--- kdepim/knotes/knotesapp.h 7 Mar 2003 22:06:21 -0000 1.22
+++ kdepim/knotes/knotesapp.h 22 Apr 2003 10:38:49 -0000
@@ -54,7 +54,7 @@ public:
KNotesApp();
~KNotesApp();
- QString newNote( const QString& name = QString::null,
+ QString newNote( const QString& name = QString::null,
const QString& text = QString::null );
QString newNoteFromClipboard( const QString& name = QString::null );
@@ -64,18 +64,26 @@ public:
QString name( const QString& id ) const;
QString text( const QString& id ) const;
-
+
void setName( const QString& id, const QString& newName );
void setText( const QString& id, const QString& newText );
QMap<QString,QString> notes() const;
-
+
void sync( const QString& app );
bool isNew( const QString& app, const QString& id ) const;
bool isModified( const QString& app, const QString& id ) const;
-
+
bool commitData( QSessionManager& );
+public slots:
+ void slotDeselectAllNotes();
+ void slotHideSelectedNotes();
+ void slotKillSelectedNotes();
+ void slotShowAllNotes();
+ void slotHideAllNotes();
+ void slotKillAllNotes();
+
protected:
void mousePressEvent( QMouseEvent* );
bool eventFilter( QObject*, QEvent* );
@@ -95,7 +103,7 @@ protected slots:
private slots:
void updateNoteActions();
void updateGlobalAccels();
-
+
void saveNotes();
private:
diff -u -3 -p -u -r1.4 knotesui.rc
--- kdepim/knotes/knotesui.rc 26 Sep 2002 22:13:23 -0000 1.4
+++ kdepim/knotes/knotesui.rc 22 Apr 2003 10:38:49 -0000
@@ -37,6 +37,16 @@
<Action name="rename_note"/>
<Action name="hide_note"/>
<Action name="delete_note"/>
+ <Menu name="selected" icon="flag" noMerge="1"><text>Selected Notes</text>
+ <Action name="deselect_notes"/>
+ <Action name="hide_selected"/>
+ <Action name="delete_selected"/>
+ </Menu>
+ <Menu name="all" icon="knotes" noMerge="1"><text>All Notes</text>
+ <Action name="show_all"/>
+ <Action name="hide_all"/>
+ <Action name="delete_all"/>
+ </Menu>
<Separator/>
<Action name="to_desktop"/>
<Action name="always_on_top"/>
["knotebutton2.cpp" (text/x-c++src)]
/*******************************************************************
KNotes -- Notes for the KDE project
Copyright (c) 2002, 2003, The KNotes Developers
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*******************************************************************/
#include <qstyle.h>
#include <qpainter.h>
#include <qiconset.h>
#include <qsizepolicy.h>
#include <kglobal.h>
#include <kicontheme.h>
#include <kiconloader.h>
#include "knotebutton2.h"
KNoteButton2::KNoteButton2( const QString& icon, QWidget *parent, const char *name )
: QPushButton( parent, name )
{
setFocusPolicy( NoFocus );
setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
setToggleButton( true );
m_flat = true;
if ( !icon.isEmpty() )
setIconSet( KGlobal::iconLoader()->loadIconSet( icon, KIcon::Small, 10 ) );
}
KNoteButton2::~KNoteButton2()
{
}
void KNoteButton2::enterEvent( QEvent * )
{
m_flat = false;
repaint( false );
}
void KNoteButton2::leaveEvent( QEvent * )
{
m_flat = true;
repaint();
}
QSize KNoteButton2::sizeHint() const
{
return QSize( QPushButton::sizeHint().height(), QPushButton::sizeHint().height() );
}
void KNoteButton2::drawButton( QPainter* p )
{
QStyle::SFlags flags = QStyle::Style_Default;
if ( isEnabled() )
flags |= QStyle::Style_Enabled;
if ( isDown() )
flags |= QStyle::Style_Down;
if ( isOn() )
flags |= QStyle::Style_On;
if ( !isFlat() && !isDown() )
flags |= QStyle::Style_Raised;
if ( !m_flat )
flags |= QStyle::Style_MouseOver;
style().drawPrimitive( QStyle::PE_ButtonTool, p, rect(), colorGroup(), flags );
drawButtonLabel( p );
}
void KNoteButton2::drawButtonLabel( QPainter* p )
{
if ( iconSet() && !iconSet()->isNull() )
{
QIconSet::Mode mode = QIconSet::Disabled;
QIconSet::State state = QIconSet::Off;
if ( isEnabled() )
mode = hasFocus() ? QIconSet::Active : QIconSet::Normal;
if ( isToggleButton() && isOn() )
state = QIconSet::On;
QPixmap pix = iconSet()->pixmap( QIconSet::Small, mode, state );
int dx = ( width() - pix.width() ) / 2;
int dy = ( height() - pix.height() ) / 2;
// Shift button contents if pushed.
if ( isOn() || isDown() )
{
dx += style().pixelMetric( QStyle::PM_ButtonShiftHorizontal, this );
dy += style().pixelMetric( QStyle::PM_ButtonShiftVertical, this );
}
p->drawPixmap( dx, dy, pix );
}
}
["knotebutton2.h" (text/x-chdr)]
/*******************************************************************
KNotes -- Notes for the KDE project
Copyright (c) 1997-2003, The KNotes Developers
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*******************************************************************/
#ifndef KNOTEBUTTON2_H
#define KNOTEBUTTON2_H
#include <qpushbutton.h>
class QPainter;
class QEvent;
class QResizeEvent;
class KNoteButton2: public QPushButton
{
Q_OBJECT
public:
KNoteButton2( const QString& icon, QWidget *parent=0, const char *name=0 );
~KNoteButton2();
virtual QSize sizeHint() const;
protected:
virtual void enterEvent( QEvent * );
virtual void leaveEvent( QEvent * );
virtual void drawButton( QPainter *p );
virtual void drawButtonLabel( QPainter *p );
private:
bool m_flat;
};
#endif
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic