示例#1
0
void Lvk::FE::ChatHistoryWidget::addDateContactTableRow(const Lvk::Cmn::Conversation::Entry &entry)
{
    QString date = entry.dateTime.toString(DATE_FORMAT);
    QString username = getUsername(entry.from);
    QString fullname = getFullname(entry.from);

    if (fullname.isEmpty()) {
        fullname = username;
    }

    int nextRow = ui->dateContactTable->rowCount();
    ui->dateContactTable->insertRow(nextRow);
    ui->dateContactTable->setItem(nextRow, DateColumnn,    new QTableWidgetItem(date));
    ui->dateContactTable->setItem(nextRow, UsernameColumn, new QTableWidgetItem(fullname));

    ui->dateContactTable->item(nextRow, DateColumnn)->setData(HashKeyRole, hashKey(entry));
    ui->dateContactTable->item(nextRow, UsernameColumn)->setData(HashKeyRole, hashKey(entry));
    ui->dateContactTable->item(nextRow, UsernameColumn)->setData(EntryFromRole, entry.from);

    if (username.contains("@gmail.com")) {
        ui->dateContactTable->item(nextRow, UsernameColumn)->setIcon(QIcon(GMAIL_ICON));
    } else if (username.contains("@chat.facebook.com")) {
        ui->dateContactTable->item(nextRow, UsernameColumn)->setIcon(QIcon(FB_ICON));
    } else if (username.contains(tr("(test)"))) {
        ui->dateContactTable->item(nextRow, UsernameColumn)->setIcon(QIcon(LOCAL_TEST_ICON));
    }
}
示例#2
0
bool CUserItem::getAsString( wxString& strUser )
{
    wxString wxstr;
    strUser.Empty();
        
    strUser += wxString::Format( _("%ld;"), getUserID() );
    strUser += getUser();
    strUser += _(";");
    // Protect password
    wxstr = getPassword();
    for ( int i=0; i<wxstr.Length(); i++ ) {
        strUser += _("*");
    }
    //strUser += getPassword();
    strUser += _(";");
    strUser += getFullname();
    strUser += _(";");
    vscp_writeFilterToString( getFilter(), wxstr );
    strUser += wxstr;
    strUser += _(";");
    vscp_writeMaskToString( getFilter(), wxstr );
    strUser += wxstr;
    strUser += _(";");
    strUser += getUserRightsAsString();
    strUser += _(";");
    strUser += getAllowedRemotesAsString();
    strUser += _(";");
    strUser += getAllowedEventsAsString();
    strUser += _(";");
    strUser += wxBase64Encode( getNote().mbc_str(), strlen( getNote().mbc_str() ) ); 	
    //strUser += getNote();
    
    return true;
}
示例#3
0
文件: person.cpp 项目: airways/Rekall
void Person::updateGUI() {
    if(updateGUINeeded) {
        updateGUINeeded = false;
        setIcon(0, QIcon(QPixmap::fromImage(getPhoto())));
        setText(1, getFullname());
    }
}
示例#4
0
/**
 * Write the pid file.
 */
PidFile::PidFile(const char *_name)
  : File(_name && _name[0] ? _name : "???")
{
    if (_name && _name[0])
    {
        setDeleteOnDestroy(true);

        FILE *f = fopen(getFullname().c_str(), "w");
        if (f == NULL) {
            Log::perror(getFullname());
            return;
        }
        fprintf(f, "%d", getpid());
        fclose(f);
        refresh();
    }
}
示例#5
0
/**
 * Recursively visit all files / directories starting at the given directory.
 */
FileVisitor::VisitResult File::visitMe(const VisitOptions &options, unsigned maxDepth) const
{
    FileVisitor::VisitResult vr = FileVisitor::VisitResult::CONTINUE;

    if (isSymlink())
    {
        if (!options.followSymLinks)
            return vr;

        // visit the symlink location instead
        char buf[PATH_MAX];
        ssize_t s = readlink(getFullname().c_str(), buf, sizeof(buf));
        if (s <= 0)
        {
            Log::perror(getFullname());
            throw std::runtime_error(std::string("Cannot read a symlink ") + getFullname());
        }

        // terminate string
        buf[s] = 0;

        if (buf[0] == PATH_SEP_CHAR)
        {
            // absolute link location
            File linked(buf);
            return linked.visitMe(options, maxDepth);
        }
        else {
            // relative link location
            File linked(*this, buf);
            return linked.visitMe(options, maxDepth);
        }
    }

    if (isDirectory())
    {
        if (maxDepth > 0)
        {
            vr = options.visitor.visitDirectory(*this);
            if (vr == FileVisitor::VisitResult::STOP)
                return vr;
            if (vr == FileVisitor::VisitResult::STOP_DIR) {
                options.visitor.afterVisitDirectory(*this);
                return FileVisitor::VisitResult::CONTINUE;
            }

            // recurse with max depth - 1
            vr = recurseInto(options, maxDepth - 1);
            if (vr == FileVisitor::VisitResult::STOP)
                return vr;

            // what to do at end of of directory
            vr = options.visitor.afterVisitDirectory(*this);
        }
    }
    else {
        if (options.visitNonRegular || isRegularFile())
            vr = options.visitor.visitFile(*this);
        else
            vr = FileVisitor::VisitResult::CONTINUE;
    }

    if (vr == FileVisitor::VisitResult::STOP)
        return vr;
    if (vr == FileVisitor::VisitResult::STOP_DIR)
        return FileVisitor::VisitResult::CONTINUE;

    return vr;
}