|
|
|
@ -252,7 +252,7 @@ Knowit::Knowit(TQWidget*, const char *name) : KMainWindow(0, name),
|
|
|
|
|
TQT_SLOT(slotItemEnd()), actionCollection(), "note_end");
|
|
|
|
|
new KAction(i18n("Go to first subnote"), "", "Alt+Right", TQT_TQOBJECT(Items),
|
|
|
|
|
TQT_SLOT(slotItemRight()), actionCollection(), "note_right");
|
|
|
|
|
new KAction(i18n("Go to tqparent note"), "", "Alt+Left", TQT_TQOBJECT(Items),
|
|
|
|
|
new KAction(i18n("Go to parent note"), "", "Alt+Left", TQT_TQOBJECT(Items),
|
|
|
|
|
TQT_SLOT(slotItemLeft()), actionCollection(), "note_left");
|
|
|
|
|
|
|
|
|
|
/* Actions */
|
|
|
|
@ -349,15 +349,15 @@ bool Knowit::open(const KURL& fname)
|
|
|
|
|
name = ls.readLine();
|
|
|
|
|
name = name.stripWhiteSpace();
|
|
|
|
|
if (depth == prevdepth) /* same level */
|
|
|
|
|
if (depth) current = new KListViewItem(current->tqparent(), current, name);
|
|
|
|
|
if (depth) current = new KListViewItem(current->parent(), current, name);
|
|
|
|
|
else current = new KListViewItem(Items, current, name);
|
|
|
|
|
else if (depth > prevdepth) /* subnote */
|
|
|
|
|
current = new KListViewItem(current, name);
|
|
|
|
|
else { /* tqparent note */
|
|
|
|
|
else { /* parent note */
|
|
|
|
|
for(uint i=depth; i<prevdepth && current; i++)
|
|
|
|
|
current = current->tqparent();
|
|
|
|
|
if (current && current->tqparent())
|
|
|
|
|
current = new KListViewItem(current->tqparent(), current, name);
|
|
|
|
|
current = current->parent();
|
|
|
|
|
if (current && current->parent())
|
|
|
|
|
current = new KListViewItem(current->parent(), current, name);
|
|
|
|
|
else current = new KListViewItem(Items, current, name);
|
|
|
|
|
}
|
|
|
|
|
prevdepth = depth;
|
|
|
|
@ -627,8 +627,8 @@ void Knowit::slotNoteAdd()
|
|
|
|
|
i18n("Note title:"), Options.defaultName, &Ok);
|
|
|
|
|
if (!Ok) return;
|
|
|
|
|
if (Items->currentItem())
|
|
|
|
|
if (Items->currentItem()->tqparent())
|
|
|
|
|
elt = new KListViewItem(Items->currentItem()->tqparent(),
|
|
|
|
|
if (Items->currentItem()->parent())
|
|
|
|
|
elt = new KListViewItem(Items->currentItem()->parent(),
|
|
|
|
|
Items->currentItem(), text);
|
|
|
|
|
else
|
|
|
|
|
elt = new KListViewItem(Items, Items->currentItem(), text);
|
|
|
|
@ -672,14 +672,14 @@ void Knowit::slotNoteRemove()
|
|
|
|
|
"and its subnotes?</qt>") :
|
|
|
|
|
i18n("<qt>Are you sure you want to delete note<br><b>%1</b>?</qt>");
|
|
|
|
|
if (KMessageBox::questionYesNo(0, msg.tqarg(elt->text(0))) == KMessageBox::Yes) {
|
|
|
|
|
TQListViewItem* tqparent = elt->tqparent();
|
|
|
|
|
TQListViewItem* parent = elt->parent();
|
|
|
|
|
Notes.removeNote(elt);
|
|
|
|
|
if (!Notes.count())
|
|
|
|
|
slotActionUpdate();
|
|
|
|
|
if (!tqparent)
|
|
|
|
|
tqparent = Items->firstChild();
|
|
|
|
|
if (!parent)
|
|
|
|
|
parent = Items->firstChild();
|
|
|
|
|
Items->prevItem = 0;
|
|
|
|
|
slotNoteChanged(tqparent);
|
|
|
|
|
slotNoteChanged(parent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -722,7 +722,7 @@ void Knowit::slotNoteMoveUp()
|
|
|
|
|
{
|
|
|
|
|
TQListViewItem* elt = Items->currentItem();
|
|
|
|
|
if (elt && elt->itemAbove()) {
|
|
|
|
|
TQListViewItem* above = elt->tqparent() ? elt->tqparent()->firstChild()
|
|
|
|
|
TQListViewItem* above = elt->parent() ? elt->parent()->firstChild()
|
|
|
|
|
: Items->firstChild();
|
|
|
|
|
if (above == elt)
|
|
|
|
|
return;
|
|
|
|
@ -733,9 +733,9 @@ void Knowit::slotNoteMoveUp()
|
|
|
|
|
if (above)
|
|
|
|
|
elt->moveItem(above);
|
|
|
|
|
else {
|
|
|
|
|
TQListViewItem* tqparent = elt->tqparent();
|
|
|
|
|
TQListViewItem* parent = elt->parent();
|
|
|
|
|
Items->takeNode(elt);
|
|
|
|
|
Items->insertNode(tqparent, elt);
|
|
|
|
|
Items->insertNode(parent, elt);
|
|
|
|
|
}
|
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
|
Notes.modified = true;
|
|
|
|
@ -756,11 +756,11 @@ void Knowit::slotNoteMoveBegin()
|
|
|
|
|
{
|
|
|
|
|
TQListViewItem* elt = Items->currentItem();
|
|
|
|
|
if (elt) {
|
|
|
|
|
TQListViewItem* tqparent = elt->tqparent();
|
|
|
|
|
TQListViewItem* parent = elt->parent();
|
|
|
|
|
Items->takeNode(elt);
|
|
|
|
|
Items->insertItem(elt);
|
|
|
|
|
if (tqparent)
|
|
|
|
|
Notes.find(tqparent)->updateView();
|
|
|
|
|
if (parent)
|
|
|
|
|
Notes.find(parent)->updateView();
|
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
|
Notes.modified = true;
|
|
|
|
|
}
|
|
|
|
@ -772,15 +772,15 @@ void Knowit::slotNoteMoveEnd()
|
|
|
|
|
if (!elt)
|
|
|
|
|
return;
|
|
|
|
|
TQListViewItem* last = Items->firstChild();
|
|
|
|
|
TQListViewItem* tqparent = elt->tqparent();
|
|
|
|
|
TQListViewItem* parent = elt->parent();
|
|
|
|
|
while (last->nextSibling())
|
|
|
|
|
last = last->nextSibling();
|
|
|
|
|
if (elt && elt != last) {
|
|
|
|
|
Items->takeNode(elt);
|
|
|
|
|
Items->insertNode(0, elt, last);
|
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
|
if (tqparent)
|
|
|
|
|
Notes.find(tqparent)->updateView();
|
|
|
|
|
if (parent)
|
|
|
|
|
Notes.find(parent)->updateView();
|
|
|
|
|
Notes.modified = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -788,11 +788,11 @@ void Knowit::slotNoteMoveEnd()
|
|
|
|
|
void Knowit::slotNoteMoveLeft()
|
|
|
|
|
{
|
|
|
|
|
TQListViewItem* elt = Items->currentItem();
|
|
|
|
|
TQListViewItem* tqparent = elt->tqparent();
|
|
|
|
|
if (elt && tqparent) {
|
|
|
|
|
TQListViewItem* parent = elt->parent();
|
|
|
|
|
if (elt && parent) {
|
|
|
|
|
Items->takeNode(elt);
|
|
|
|
|
Items->insertNode(tqparent->tqparent(), elt, tqparent);
|
|
|
|
|
Notes.find(tqparent)->updateView();
|
|
|
|
|
Items->insertNode(parent->parent(), elt, parent);
|
|
|
|
|
Notes.find(parent)->updateView();
|
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
|
Notes.modified = true;
|
|
|
|
|
}
|
|
|
|
@ -811,9 +811,9 @@ void Knowit::slotNoteMoveRight()
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
while (above->depth() > elt->depth()+1)
|
|
|
|
|
above = above->tqparent();
|
|
|
|
|
above = above->parent();
|
|
|
|
|
Items->takeNode(elt);
|
|
|
|
|
Items->insertNode(above->tqparent(), elt, above);
|
|
|
|
|
Items->insertNode(above->parent(), elt, above);
|
|
|
|
|
}
|
|
|
|
|
Notes.find(above)->updateView();
|
|
|
|
|
slotNoteChanged(elt);
|
|
|
|
|