Ejemplo n.º 1
0
NoteViewer::NoteViewer(NoteData& data, QWidget *parent) :
    QWidget(parent), noteData(data)
{
    this->noteData = noteData;

    setFixedSize(410, 100);

    editButton = new QPushButton(tr("Edit"));
    deleteButton = new QPushButton(tr("Delete"));

    noteText = new QTextEdit;
    noteText->setText(this->noteData.getText());
    noteText->setReadOnly(true);
    noteText->setStyleSheet("border: 1px solid grey");

    time = new QLabel;
    time->setText(QDateTime::currentDateTime().toString("dd.MM.yyyy hh:mm:ss"));
    QFont font = time->font();
    font.setPointSize(12);
    time->setFont(font);

    noteLayout = new QGridLayout;
    noteLayout->addWidget(noteText, 0, 0, 1, 3);
    noteLayout->addWidget(editButton, 1, 1);
    noteLayout->addWidget(deleteButton, 1, 2);
    noteLayout->addWidget(time, 1, 0);
    setLayout(noteLayout);

    connect(editButton, SIGNAL(clicked()), this, SLOT(editNote()));
    connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteNote()));
}
Ejemplo n.º 2
0
void EditNote::ok()
{
    QString text = ui_.pte_text->toPlainText();
    QString title = ui_.le_title->text();
    QString tags = ui_.le_tags->text();

    QDomDocument doc;
    QDomElement noteElem = doc.createElement("note");
    QDomElement titleElem = doc.createElement("title");
    QDomElement textElem = doc.createElement("text");
    textElem.appendChild(doc.createTextNode(text));
    titleElem.appendChild(doc.createTextNode(title));
    noteElem.setAttribute("tags", tags);
    noteElem.appendChild(titleElem);
    noteElem.appendChild(textElem);
    doc.appendChild(noteElem);

    if(!text.isEmpty() || !title.isEmpty() || !tags.isEmpty())
        newNote(doc.documentElement());

    editNote(doc.documentElement(), index_);

    close();
}
Ejemplo n.º 3
0
///Hide or show the media player
void HistoryTreeItem::showRecordPlayer()
{
   if (!m_pAudioSlider) {
      m_pPlayer      = new PlayerWidget       ( this      );
      QWidget* r1w   = new QWidget            ( this      );
      QWidget* r2w   = new QWidget            ( this      );
      QVBoxLayout* l = new QVBoxLayout        ( m_pPlayer );
      QHBoxLayout* r1= new QHBoxLayout        ( r1w       );
      QHBoxLayout* r2= new QHBoxLayout        ( r2w       );
      m_pAudioSlider = new Phonon::SeekSlider ( this      );
      m_pTimeLeftL   = new QLabel             ( "00:00"   );
      m_pTimePlayedL = new QLabel             ( "00:00"   );
      m_pPause       = new QToolButton        (           );
      m_pStop        = new QToolButton        (           );
      m_pNote        = new QToolButton        (           );

      l->addWidget(r1w);
      l->addWidget(r2w);

      m_pPlayer->setAttribute( Qt::WA_TranslucentBackground, true );
      m_pPlayer->setMinimumSize(0,25);
      m_pPlayer->setStyleSheet("margin-top:5px");

      l-> setContentsMargins(0,0,0,0);
      r1->setContentsMargins(0,0,0,0);
      r2->setContentsMargins(0,0,0,0);

      m_pPause->setIcon ( KIcon( "media-playback-pause" ));
      m_pStop->setIcon  ( KIcon( "media-playback-stop"  ));
      m_pNote->setIcon  ( KIcon( "view-pim-notes"       ));

      m_pPause->setMinimumSize(30,30);
      m_pStop->setMinimumSize (30,30);
      m_pNote->setMinimumSize (30,30);
      QSpacerItem* hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);

      r1->addWidget( m_pTimePlayedL );
      r1->addWidget( m_pAudioSlider );
      r1->addWidget( m_pTimeLeftL   );
      r2->addWidget( m_pPause       );
      r2->addWidget( m_pStop        );
      r2->addItem  ( hSpacer        );
      r2->addWidget( m_pNote        );

      m_pPlayer->setMinimumSize(width(),height());
      m_pPlayer->setMaximumSize(width(),height());

      l->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding));
      m_pPlayer->setVisible(true);

      m_pAudioOutput             = new Phonon::AudioOutput(Phonon::MusicCategory, this);
      m_pMediaObject             = new Phonon::MediaObject(this);
      m_pMetaInformationResolver = new Phonon::MediaObject(this);
      Phonon::createPath(m_pMediaObject, m_pAudioOutput);

      m_pAudioSlider->setMediaObject(m_pMediaObject);

      m_pMediaObject->setTickInterval(1000);

      connect( m_pStop        , SIGNAL(clicked()    ) , this , SLOT( stopPlayer()      ));
      connect( m_pPause       , SIGNAL(clicked()    ) , this , SLOT( playPausePlayer() ));
      connect( m_pNote        , SIGNAL(clicked()    ) , this , SLOT( editNote()        ));
      connect( m_pMediaObject , SIGNAL(tick(qint64) ) , this , SLOT( tick(qint64)      ));

      connect(m_pMediaObject  , SIGNAL(stateChanged(Phonon::State,Phonon::State)),
              this, SLOT(stateChanged(Phonon::State,Phonon::State)));

   }
   kDebug() << "Path:" << m_pItemCall->getRecordingPath();
   m_pPlayer->setVisible(true);
   Phonon::MediaSource source(m_pItemCall->getRecordingPath());
   m_lSources.append(source);
   if (m_lSources.size() > 0)
      m_pMetaInformationResolver->setCurrentSource(m_lSources.first());
   m_pMediaObject->play();

}
Ejemplo n.º 4
0
App::App(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl)
{
    showFullScreen = false;
    setCaption("IQNotes");

    toolbar = new QPEToolBar(this);
    toolbar->setVerticalStretchable(false);
    toolbar->setHorizontalStretchable(false);
    
    setToolBarsMovable(false);
    multiTB = new QToolButton(toolbar);
    
    // File menu
    filePopupMenu = new QPopupMenu(this);
	menu = new QPEMenuBar(this);

    int fileID;
	fileID = menu->insertItem("File", filePopupMenu);
	
#ifndef DEMO
    newID = filePopupMenu->insertItem("New", this, SLOT(newFile()), SHIFT+Key_N);
    openID = filePopupMenu->insertItem("Open", this, SLOT(openFile()), SHIFT+Key_O);
    saveID = filePopupMenu->insertItem("Save", this, SLOT(saveFile()), SHIFT+Key_S);
    // file->insertItem("Save as", this, SLOT(saveAsFile()));
    closeID = filePopupMenu->insertItem("Close", this, SLOT(closeFileMenu()));
    filePopupMenu->insertSeparator();
#endif
	
    filePopupMenu->insertItem("Quit", this, SLOT(goodBye()));

    // Tree menu
    treePopupMenu = new QPopupMenu(this);
    treeID = menu->insertItem("Tree", treePopupMenu);

    searchA = new QAction("Search", ToolBarIcon::prepare("iqnotes/find"), QString::null, Key_F, this, 0 );
    connect(searchA, SIGNAL(activated()), this, SLOT(search()));
    //  searchA->addTo(toolbar);
    searchA->addTo(treePopupMenu);
    multiTB->setIconSet(ToolBarIcon::prepare("iqnotes/find"));
    connect(multiTB, SIGNAL(clicked()), this, SLOT(search()));
	//    toolbar->addSeparator(); // no room for this

    treePopupMenu->insertSeparator();

    quickAddA = new QAction("Quick add", ToolBarIcon::prepare("iqnotes/quick_add"), QString::null, Key_Q, this, 0 );
    connect(quickAddA, SIGNAL(activated()), this, SLOT(quickAdd()));
    quickAddA->addTo(toolbar);
    quickAddA->addTo(treePopupMenu);

    addBeforeA = new QAction("Add before", ToolBarIcon::prepare("iqnotes/add_before"), QString::null, 0, this, 0 );
    connect(addBeforeA, SIGNAL(activated()), this, SLOT(addBefore()));
    addBeforeA->addTo(toolbar);
    addBeforeA->addTo(treePopupMenu);

    addAfterA = new QAction("Add after", ToolBarIcon::prepare("iqnotes/add_after"), QString::null, Key_A, this, 0 );
    connect(addAfterA, SIGNAL(activated()), this, SLOT(addAfter()));
    addAfterA->addTo(toolbar);
    addAfterA->addTo(treePopupMenu);

    addChildA = new QAction("Add child", ToolBarIcon::prepare("iqnotes/add_child"), QString::null, Key_E, this, 0 );
    connect(addChildA, SIGNAL(activated()), this, SLOT(addChild()));
    addChildA->addTo(toolbar);
    addChildA->addTo(treePopupMenu);

    treePopupMenu->insertSeparator();
    sortID = treePopupMenu->insertItem("Sort", this, SLOT(sort()));
    treePopupMenu->insertSeparator();

    expandTreeID = treePopupMenu->insertItem("Expand tree", this, SLOT(expandTree()));
    collapseTreeID = treePopupMenu->insertItem("Collapse tree", this, SLOT(collapseTree()));

    treePopupMenu->insertSeparator();

    taskListPopupMenu = new QPopupMenu(this);
    taskListPopupMenu->insertItem("From whole tree", this, SLOT(taskListWholeTree()));
    taskListPopupMenu->insertItem("From current note down", this, SLOT(taskListCurrent()));

    eventListPopupMenu = new QPopupMenu(this);
    eventListPopupMenu->insertItem("From whole tree", this, SLOT(eventListWholeTree()));
    eventListPopupMenu->insertItem("From current note down", this, SLOT(eventListCurrent()));

    taskListID = treePopupMenu->insertItem("Task list", taskListPopupMenu);
    eventListID = treePopupMenu->insertItem("Event list", eventListPopupMenu);

    treePopupMenu->insertSeparator();
    reminderID = treePopupMenu->insertItem("Reminder", this, SLOT(showReminder()));

    toolbar->addSeparator();

    /*
    closeSearchTreeA = new QAction("Close search tree", Resource::loadPixmap("iqnotes/close_search_tree"), QString::null, 0, this, 0 );
    connect(closeSearchTreeA, SIGNAL(activated()), this, SLOT(closeSearchTree()));
    closeSearchTreeA->addTo(tree);*/

    // Note menu
    notePopupMenu = new QPopupMenu(this);
    noteID = menu->insertItem("Note", notePopupMenu);

    renameNoteID = notePopupMenu->insertItem("Rename", this, SLOT(renameNote()), Key_R);

    editA = new QAction("Edit", ToolBarIcon::prepare("iqnotes/edit"), QString::null, Key_Return, this, 0 );
    editA->setToolTip("Edit note");
    connect(editA, SIGNAL(activated()), this, SLOT(editNote()));
    editA->addTo(toolbar);
    editA->addTo(notePopupMenu);

    cutA = new QAction("Cut", ToolBarIcon::prepare("iqnotes/bin"), QString::null, Key_X, this, 0 );
    cutA->setToolTip("Cut note");
    connect(cutA, SIGNAL(activated()), this, SLOT(cutNote()));
    cutA->addTo(toolbar);
    cutA->addTo(notePopupMenu);

    copyNotePopupMenu = new QPopupMenu(this);
    copyNotePopupMenu->insertItem("Only current note", this, SLOT(copyNoteOnlyCurrent()));
    copyNotePopupMenu->insertItem("Current note and down", this, SLOT(copyNoteCurrentAndDown()));
    copyNoteID = notePopupMenu->insertItem("Copy", copyNotePopupMenu);

    pasteNotePopupMenu = new QPopupMenu(this);
    pasteNotePopupMenu->insertItem("Before", this, SLOT(pasteNoteBefore()));
    pasteNotePopupMenu->insertItem("After", this, SLOT(pasteNoteAfter()), SHIFT+Key_A);
    pasteNotePopupMenu->insertItem("As child", this, SLOT(pasteNoteChild()), SHIFT+Key_E);
    pasteNoteID = notePopupMenu->insertItem("Paste", pasteNotePopupMenu);

    notePopupMenu->insertSeparator();

    setPictureA = new QAction("Set picture", ToolBarIcon::prepare("iqnotes/set_picture"), QString::null, CTRL+Key_P, this, 0);
    setPictureA->setToolTip("Set picture");
    connect(setPictureA, SIGNAL(activated()), this, SLOT(setPicture()));
    //setPictureA->addTo(toolbar);
    setPictureA->addTo(notePopupMenu);

    notePopupMenu->insertSeparator();

    setTaskA = new QAction("Set task", ToolBarIcon::prepare("iqnotes/set_task"), QString::null, CTRL+Key_T, this, 0);
    setTaskA->setToolTip("Set task");
    connect(setTaskA, SIGNAL(activated()), this, SLOT(setTask()));
    //setTaskA->addTo(toolbar);
    setTaskA->addTo(notePopupMenu);
    setEventA = new QAction("Set event", ToolBarIcon::prepare("iqnotes/set_event"), QString::null, CTRL+Key_E, this, 0);
    setEventA->setToolTip("Set event");
    connect(setEventA, SIGNAL(activated()), this, SLOT(setEvent()));
    //setEventA->addTo(toolbar);
    setEventA->addTo(notePopupMenu);
    unsetTaskEventID = notePopupMenu->insertItem("Unset", this, SLOT(unsetTaskEvent()));

    notePopupMenu->insertSeparator();
    setReminderID = notePopupMenu->insertItem("Set reminder", this, SLOT(setReminder()));
    unsetReminderID = notePopupMenu->insertItem("Unset reminder", this, SLOT(unsetReminder()));

    // View menu
    viewPopupMenu = new QPopupMenu(this);
    viewID = menu->insertItem("View", viewPopupMenu);

    toolbar->addSeparator();

    hideNoteA = new QAction("Hide note", ToolBarIcon::prepare("iqnotes/hide_note"), QString::null, Key_1, this, 0 );
    hideNoteA->setToolTip("Hide note");
    connect(hideNoteA, SIGNAL(activated()), this, SLOT(hideNote()));
    hideNoteA->addTo(toolbar);
    hideNoteA->addTo(viewPopupMenu);

    hideTreeA = new QAction("Hide tree", ToolBarIcon::prepare("iqnotes/hide_tree"), QString::null, Key_2, this, 0 );
    hideTreeA->setToolTip("Hide tree");
    connect(hideTreeA, SIGNAL(activated()), this, SLOT(hideTree()));
    hideTreeA->addTo(toolbar);
    hideTreeA->addTo(viewPopupMenu);

    halfViewA = new QAction("Half view", ToolBarIcon::prepare("iqnotes/half_view"), QString::null, Key_3, this, 0 );
    halfViewA->setToolTip("Half view");
    connect(halfViewA, SIGNAL(activated()), this, SLOT(halfView()));
    halfViewA->addTo(toolbar);
    halfViewA->addTo(viewPopupMenu);

	/*
    viewPopupMenu->insertSeparator();
    toggleToolBarID = viewPopupMenu->insertItem("Toggle toolbar", this, SLOT(toggleToolBar()));
    toggleFullScreenID = viewPopupMenu->insertItem("Toggle fullscreen", this, SLOT(toggleFullScreen()));
    */
	
    // Options menu
    optionsPopupMenu = new QPopupMenu(this);
    optionsID = menu->insertItem("Options", optionsPopupMenu);

    optionsPopupMenu->insertItem("Define new entry", this, SLOT(defineNewEntry()));
    optionsPopupMenu->insertItem("Change entry", this, SLOT(changeEntry()));
    optionsPopupMenu->insertItem("Delete entry", this, SLOT(deleteEntry()));

    optionsPopupMenu->insertSeparator();

    optionsPopupMenu->insertItem("Preferences", this, SLOT(preferenc()));

    // Help menu
    helpPopupMenu = new QPopupMenu(this);
    menu->insertItem("Help", helpPopupMenu);

    helpPopupMenu->insertItem("About", this, SLOT(about()));

    addToolBar(toolbar);

    IQApp = this;

    //
    notes = new Notes(this, "bla");
    setCentralWidget(notes);

    connect(notes, SIGNAL(emptyNoteTree()), this, SLOT(isEmptyNoteTree()));
    connect(notes, SIGNAL(noEmptyNoteTree()), this, SLOT(isNotEmptyNoteTree()));
    connect(notes, SIGNAL(searchTreeShown()), this, SLOT(searchTreeShown()));
    connect(notes, SIGNAL(searchTreeClosed()), this, SLOT(searchTreeClosed()));
    connect(notes, SIGNAL(taskListShown()), this, SLOT(taskListShown()));
    connect(notes, SIGNAL(taskListClosed()), this, SLOT(taskListClosed()));
    connect(notes, SIGNAL(eventListShown()), this, SLOT(eventListShown()));
    connect(notes, SIGNAL(eventListClosed()), this, SLOT(eventListClosed()));
    connect(notes, SIGNAL(reminderShown()), this, SLOT(reminderShown()));
    connect(notes, SIGNAL(reminderClosed()), this, SLOT(reminderClosed()));
    connect(notes, SIGNAL(noteModified(bool)), this, SLOT(setModified(bool)));

    readConfig();
    changeFont();
    
    noNoteTree();
}