Diffstat (limited to 'noncore/applets/notesapplet/notes.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/notesapplet/notes.cpp | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/noncore/applets/notesapplet/notes.cpp b/noncore/applets/notesapplet/notes.cpp index 4e98b31..e2b0c2a 100644 --- a/noncore/applets/notesapplet/notes.cpp +++ b/noncore/applets/notesapplet/notes.cpp | |||
@@ -79,8 +79,8 @@ static char * notes_xpm[] = { | |||
79 | " . "}; | 79 | " . "}; |
80 | 80 | ||
81 | 81 | ||
82 | NotesControl::NotesControl( QWidget *parent, const char *name ) | 82 | NotesControl::NotesControl( QWidget *, const char * ) |
83 | : QFrame( parent, name,/* WDestructiveClose | */WStyle_StaysOnTop ) | 83 | : QVBox( 0, "NotesControl",/* WDestructiveClose | */WStyle_StaysOnTop ) |
84 | // : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) | 84 | // : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) |
85 | { | 85 | { |
86 | QDir d( QDir::homeDirPath()+"/notes"); | 86 | QDir d( QDir::homeDirPath()+"/notes"); |
@@ -91,19 +91,19 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
91 | } | 91 | } |
92 | Config cfg("Notes"); | 92 | Config cfg("Notes"); |
93 | cfg.setGroup("Options"); | 93 | cfg.setGroup("Options"); |
94 | showMax = cfg.readBoolEntry("ShowMax", false); | 94 | showMax = cfg.readBoolEntry("ShowMax", false); |
95 | 95 | ||
96 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 96 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
97 | loaded=false; | 97 | loaded=false; |
98 | edited=false; | 98 | edited=false; |
99 | doPopulate=true; | 99 | doPopulate=true; |
100 | isNew=false; | 100 | isNew=false; |
101 | QVBoxLayout *vbox = new QVBoxLayout( this,0, -1, "Vlayout" ); | 101 | QVBox *vbox = new QVBox( this, "Vlayout" ); |
102 | QHBoxLayout *hbox = new QHBoxLayout( this, 0, -1, "HLayout" ); | 102 | QHBox *hbox = new QHBox( this, "HLayout" ); |
103 | 103 | ||
104 | view = new QMultiLineEdit(this, "OpieNotesView"); | 104 | view = new QMultiLineEdit(vbox, "OpieNotesView"); |
105 | 105 | ||
106 | box = new QListBox(this, "OpieNotesBox"); | 106 | box = new QListBox(vbox, "OpieNotesBox"); |
107 | 107 | ||
108 | QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold); | 108 | QPEApplication::setStylusOperation( box->viewport(),QPEApplication::RightOnHold); |
109 | 109 | ||
@@ -112,24 +112,22 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
112 | vbox->setMargin( 6 ); | 112 | vbox->setMargin( 6 ); |
113 | vbox->setSpacing( 3 ); | 113 | vbox->setSpacing( 3 ); |
114 | 114 | ||
115 | vbox->addWidget( view); | 115 | |
116 | vbox->addWidget( box); | ||
117 | 116 | ||
118 | setFocusPolicy(QWidget::StrongFocus); | 117 | setFocusPolicy(QWidget::StrongFocus); |
119 | 118 | ||
120 | newButton= new QPushButton( this, "newButton" ); | 119 | newButton= new QPushButton( hbox, "newButton" ); |
121 | newButton->setText(tr("New")); | 120 | newButton->setText(tr("New")); |
122 | hbox->addWidget( newButton); | ||
123 | 121 | ||
124 | saveButton= new QPushButton( this, "saveButton" ); | 122 | |
123 | saveButton= new QPushButton( hbox, "saveButton" ); | ||
125 | saveButton->setText(tr("Save")); | 124 | saveButton->setText(tr("Save")); |
126 | hbox->addWidget( saveButton); | ||
127 | 125 | ||
128 | deleteButton= new QPushButton( this, "deleteButton" ); | 126 | |
127 | deleteButton= new QPushButton( hbox, "deleteButton" ); | ||
129 | deleteButton->setText(tr("Delete")); | 128 | deleteButton->setText(tr("Delete")); |
130 | hbox->addWidget( deleteButton); | 129 | |
131 | 130 | ||
132 | vbox->addItem(hbox); | ||
133 | 131 | ||
134 | connect( box, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint&)), | 132 | connect( box, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint&)), |
135 | this,SLOT( boxPressed(int, QListBoxItem *, const QPoint&)) ); | 133 | this,SLOT( boxPressed(int, QListBoxItem *, const QPoint&)) ); |
@@ -147,7 +145,7 @@ NotesControl::NotesControl( QWidget *parent, const char *name ) | |||
147 | populateBox(); | 145 | populateBox(); |
148 | load(); | 146 | load(); |
149 | setCaption("Notes"); | 147 | setCaption("Notes"); |
150 | // parent->setFocus(); | 148 | // parent->setFocus(); |
151 | } | 149 | } |
152 | 150 | ||
153 | void NotesControl::slotSaveButton() { | 151 | void NotesControl::slotSaveButton() { |
@@ -159,7 +157,7 @@ void NotesControl::slotDeleteButtonClicked() { | |||
159 | switch ( QMessageBox::warning(this,tr("Delete?") | 157 | switch ( QMessageBox::warning(this,tr("Delete?") |
160 | ,tr("Do you really want to<BR><B> delete</B> this note ?") | 158 | ,tr("Do you really want to<BR><B> delete</B> this note ?") |
161 | ,tr("Yes"),tr("No"),0,1,1) ) { | 159 | ,tr("Yes"),tr("No"),0,1,1) ) { |
162 | case 0: | 160 | case 0: |
163 | slotDeleteButton(); | 161 | slotDeleteButton(); |
164 | break; | 162 | break; |
165 | }; | 163 | }; |
@@ -199,11 +197,11 @@ void NotesControl::slotDeleteButton() { | |||
199 | 197 | ||
200 | QFile f( fi); | 198 | QFile f( fi); |
201 | if( !f.remove()) qDebug(".desktop file not removed"); | 199 | if( !f.remove()) qDebug(".desktop file not removed"); |
202 | 200 | ||
203 | } | 201 | } |
204 | } | 202 | } |
205 | view->clear(); | 203 | view->clear(); |
206 | 204 | ||
207 | populateBox(); | 205 | populateBox(); |
208 | } | 206 | } |
209 | } | 207 | } |
@@ -335,8 +333,8 @@ void NotesControl::save() { | |||
335 | populateBox(); | 333 | populateBox(); |
336 | } | 334 | } |
337 | cfg.writeEntry( "LastDoc",oldDocName ); | 335 | cfg.writeEntry( "LastDoc",oldDocName ); |
338 | cfg.write(); | 336 | cfg.write(); |
339 | 337 | ||
340 | } | 338 | } |
341 | } | 339 | } |
342 | 340 | ||
@@ -468,6 +466,7 @@ NotesApplet::NotesApplet( QWidget *parent, const char *name ) | |||
468 | } | 466 | } |
469 | 467 | ||
470 | NotesApplet::~NotesApplet() { | 468 | NotesApplet::~NotesApplet() { |
469 | delete vc; | ||
471 | } | 470 | } |
472 | 471 | ||
473 | void NotesApplet::mousePressEvent( QMouseEvent *) { | 472 | void NotesApplet::mousePressEvent( QMouseEvent *) { |