예제 #1
0
def forumReply(om_gui):
    '''
    reply to an item
    '''
    item = om_gui.ui.forum_treeWidget.currentItem()
    heading = item.text(0)
    if heading[:2] != "re":
        heading = "re. " + heading
    Dialog = QtGui.QDialog(om_gui)
    dl = Ui_forumPost.Ui_Dialog()
    dl.setupUi(Dialog)
    dl.topic_lineEdit.setText(heading)
    dl.from_comboBox.addItems([localsettings.operator, "Anon"] +
                              localsettings.allowed_logins)
    dl.to_comboBox.addItems(["ALL"] + localsettings.allowed_logins)

    if Dialog.exec_():
        parentix = int(item.text(1))
        post = forum.post()
        post.parent_ix = parentix
        post.topic = dl.topic_lineEdit.text().toAscii()
        post.comment = dl.comment_textEdit.toPlainText().toAscii()
        post.inits = dl.from_comboBox.currentText()
        post.recipient = dl.to_comboBox.currentText()
        forum.commitPost(post)
    loadForum(om_gui)
예제 #2
0
def forumNewTopic(om_gui):
    '''
    create a new post
    '''
    Dialog = QtGui.QDialog(om_gui)
    dl = Ui_forumPost.Ui_Dialog()
    dl.setupUi(Dialog)
    dl.from_comboBox.addItems([localsettings.operator, "Anon"] +
                              localsettings.allowed_logins)

    dl.to_comboBox.addItems(["ALL"] + localsettings.allowed_logins)

    while True:
        if Dialog.exec_():
            if dl.topic_lineEdit.text() == "":
                om_gui.advise("Please set a topic", 1)
            else:
                break
        else:
            return

    post = forum.post()
    post.topic = dl.topic_lineEdit.text().toAscii()
    post.comment = dl.comment_textEdit.toPlainText().toAscii()
    post.inits = dl.from_comboBox.currentText()
    if dl.to_comboBox.currentIndex != 0:
        post.recipient = dl.to_comboBox.currentText()
    forum.commitPost(post)
    loadForum(om_gui)