📄 ablabel.cpp
字号:
} // name QString nametxt; if ( !(value = contact.fileAs()).isEmpty() ) nametxt = "<b>" + Qtopia::escapeString(value) + "</b>"; // also part of name is how to pronounce it. if ( !(value = contact.firstNamePronunciation()).isEmpty() ) { nametxt += " <i>\"" + Qtopia::escapeString(value); if( contact.lastNamePronunciation().isEmpty() ) nametxt += "\""; nametxt += "</i>"; } if ( !(value = contact.lastNamePronunciation()).isEmpty() ) { nametxt += " <i>"; if( contact.firstNamePronunciation().isEmpty() ) nametxt += "\""; nametxt += Qtopia::escapeString(value) + "\"</i>"; } if ( thumbtxt.isEmpty() ) { text += "<center>"+nametxt+"</center>"; } else { text += "<table cellspacing=0 cellpadding=0>"; text += "<tr><td>"+thumbtxt+"<td>"+nametxt; text += "</table>"; } // job Categories c; bool lo = c.load( categoryFileName() ); int bcatid = 0; if( lo ) bcatid = c.id( "addressbook", "_Business"); bool isBus = contact.categories().contains( bcatid ); QString job; if( isBus ) { QStringList lines; QString str; str = contact.jobTitle(); if ( !str.isEmpty() ) lines += Qtopia::escapeString(str); str = contact.company(); if( !str.isEmpty() ) lines += "<b>" + Qtopia::escapeString(str) + "</b>"; if ( lines.count() ) { if ( !nametxt.isEmpty() ) job += " "; job += "<small>"+lines.join(" ")+"</small>"; } } text += "<center>"+job+"</center>"; // voice and messaging... if( isBus ) { text += busPhoneRichText( contact, dialer ); text += homePhoneRichText( contact, dialer ); text += phoneToRichText( "businessmessage", contact.businessMobile(), Messaging, PimContact::BusinessMobile ); text += phoneToRichText( "homemessage", contact.homeMobile(), Messaging, PimContact::HomeMobile ); } else { text += homePhoneRichText( contact, dialer ); text += busPhoneRichText( contact, dialer ); text += phoneToRichText( "homemessage", contact.homeMobile(), Messaging, PimContact::HomeMobile ); text += phoneToRichText( "businessmessage", contact.businessMobile(), Messaging, PimContact::BusinessMobile ); } text += emailRichText( contact ); // XXX For now, no 'Messaging' support for faxes, // XXX but it's completely feasible to add. text += phoneToRichText( "businessfax", contact.businessFax(), FALSE, PimContact::BusinessFax ); text += phoneToRichText( "homefax", contact.homeFax(), FALSE, PimContact::HomeFax ); if( isBus ) { text += businessRichText( contact, dialer ); text += personalRichText( contact, dialer ); } else { text += personalRichText( contact, dialer ); text += businessRichText( contact, dialer ); } if ( (value = contact.notes()) ) { value = Qtopia::escapeMultiLineString(value);#ifdef QTOPIA_DATA_LINKING text += QDL::lidsToAnchors( value, mNotesQC );#endif } // photo last QString pho = contact.customField( "photofile" ); if( !pho.isEmpty() ) { pho = baseDirStr + pho; // ### Cannot use widget size, since it doesn't have the // ### right geometry at this point. int dw = qApp->desktop()->width()*7/8; QSize sh(dw,dw); QSize dims = Image::loadScaledImageSize(pho, sh.width(), sh.height(), 2 ); QString img = "<img width=%1 height=%2 src=\"" // No tr + Qtopia::escapeString( pho ) + "\">" + "<br>"; img = img.arg(dims.width()).arg(dims.height()); text += img; } return text;}QString AbLabel::busPhoneRichText( const PimContact &contact, bool dialer ){ QString text; text += phoneToRichText( "businessphone", contact.businessPhone(), dialer, PimContact::BusinessPhone ); text += phoneToRichText( "businessmobile", contact.businessMobile(), dialer, PimContact::BusinessMobile ); text += phoneToRichText( "businesspager", contact.businessPager(), FALSE, PimContact::BusinessPager ); return text;}QString AbLabel::homePhoneRichText( const PimContact &contact, bool dialer ){ QString text; text += phoneToRichText( "homephone", contact.homePhone(), dialer, PimContact::HomePhone ); text += phoneToRichText( "homemobile", contact.homeMobile(), dialer, PimContact::HomeMobile ); return text;}QString AbLabel::businessRichText( const PimContact &contact, bool /* dialer */ ){ QString text; QString value, comp, state; QString str; QString title; if ( !(value = contact.jobTitle()).isEmpty() ) text += Qtopia::escapeString(value) + "<br>"; if ( !(value = contact.department()).isEmpty() ) { text += "<i>" + Qtopia::escapeString(value) + "</i>"; text += "<br>"; } comp = contact.company(); if ( !comp.isEmpty() ) text += "<b>" + Qtopia::escapeString(comp) + "</b> "; if ( !(value = contact.companyPronunciation()).isEmpty() ) text += "<i>\"" + Qtopia::escapeString(value) + "\"</i>"; if( !comp.isEmpty() || !value.isEmpty() ) text += "<br>"; if ( !contact.businessStreet().isEmpty() || !contact.businessCity().isEmpty() || !contact.businessZip().isEmpty() || !contact.businessCountry().isEmpty() ) { text += "<br><b>" + qApp->translate( "QtopiaPim", "Address: " ) + "</b><br>"; } if ( !(value = contact.businessStreet()).isEmpty() ) text += Qtopia::escapeString(value) + "<br>"; state = contact.businessState(); if ( !(value = contact.businessCity()).isEmpty() ) { text += Qtopia::escapeString(value); if ( state ) text += ", " + Qtopia::escapeString(state); text += "<br>"; } else if ( !state.isEmpty() ) text += Qtopia::escapeString(state) + "<br>"; if ( !(value = contact.businessZip()).isEmpty() ) text += Qtopia::escapeString(value) + "<br>"; if ( !(value = contact.businessCountry()).isEmpty() ) text += Qtopia::escapeString(value) + "<br>"; str = contact.businessWebpage(); if ( !str.isEmpty() ) text += "<b>" + qApp->translate( "QtopiaPim","Web Page: ") + "</b>" + Qtopia::escapeString(str) + "<br>"; str = contact.office(); if ( !str.isEmpty() ) text += "<b>" + qApp->translate( "QtopiaPim","Office: ") + "</b>" + Qtopia::escapeString(str) + "<br>"; str = contact.profession(); if ( !str.isEmpty() ) text += "<b>" + qApp->translate( "QtopiaPim","Profession: ") + "</b>" + Qtopia::escapeString(str) + "<br>"; str = contact.assistant(); if ( !str.isEmpty() ) text += "<b>" + qApp->translate( "QtopiaPim","Assistant: ") + "</b>" + Qtopia::escapeString(str) + "<br>"; str = contact.manager(); if ( !str.isEmpty() ) text += "<b>" + qApp->translate( "QtopiaPim","Manager: ") + "</b>" + Qtopia::escapeString(str) + "<br>"; if( !text.isEmpty() ) { QString pp = Resource::findPixmap( "addressbook/business" ); QString title; title = "<p align=\"center\"><img src=\"" + pp + "\"><b><u>" + qApp->translate( "QtopiaPim", "Business Details" ) + "</u></b></p>"; text = title + text; } return text;}QString AbLabel::personalRichText( const PimContact &contact, bool /* dialer */ ){ QString text; QString value, state; QString str; // home address if ( !contact.homeStreet().isEmpty() || !contact.homeCity().isEmpty() || !contact.homeZip().isEmpty() || !contact.homeCountry().isEmpty() ) { text += "<b>" + qApp->translate( "QtopiaPim", "Address: " ) + "</b>"; text += "<br>"; } if ( !(value = contact.homeStreet()).isEmpty() ) text += Qtopia::escapeString(value) + "<br>"; state = contact.homeState(); if ( !(value = contact.homeCity()).isEmpty() ) { text += Qtopia::escapeString(value); if ( !state.isEmpty() ) text += ", " + Qtopia::escapeString(state); text += "<br>"; } else if (!state.isEmpty()) text += Qtopia::escapeString(state) + "<br>"; if ( !(value = contact.homeZip()).isEmpty() ) text += Qtopia::escapeString(value) + "<br>"; if ( !(value = contact.homeCountry()).isEmpty() ) text += Qtopia::escapeString(value) + "<br>"; str = contact.homeWebpage(); if ( !str.isEmpty() ) text += "<b>" + qApp->translate( "QtopiaPim","Web Page: ") + "</b>" + Qtopia::escapeString(str) + "<br>"; str = contact.gender(); if ( !str.isEmpty() && str.toInt() != 0 ) { if ( str.toInt() == 1 ) str = qApp->translate( "QtopiaPim", "Male" ); else if ( str.toInt() == 2 ) str = qApp->translate( "QtopiaPim", "Female" ); text += "<b>" + qApp->translate( "QtopiaPim","Gender: ") + "</b>" + str + "<br>"; } str = contact.spouse(); if ( !str.isEmpty() ) text += "<b>" + qApp->translate( "QtopiaPim","Spouse: ") + "</b>" + Qtopia::escapeString(str) + "<br>"; if ( contact.birthday().isValid() ) { str = TimeString::localYMD( contact.birthday() ); if ( !str.isEmpty() ) text += "<b>" + qApp->translate( "QtopiaPim","Birthday: ") + "</b>" + Qtopia::escapeString(str) + "<br>"; } if ( contact.anniversary().isValid() ) { str = TimeString::localYMD( contact.anniversary() ); if ( !str.isEmpty() ) text += "<b>" + qApp->translate( "QtopiaPim","Anniversary: ") + "</b>" + Qtopia::escapeString(str) + "<br>"; } if( !text.isEmpty() ) { QString pp = Resource::findPixmap( "home" ); QString title = "<p align=\"center\"><img src=\"" + pp + "\"><b>" + qApp->translate( "QtopiaPim", "Personal Details" ) + "</b></p>"; text = title + text; } return text;}QString AbLabel::emailRichText( const PimContact &contact ){ QString text; QStringList emails = contact.emailList(); QStringList::Iterator it; QString e; bool notFirst = FALSE; for( it = emails.begin() ; it != emails.end() ; ++it ) { QString smallopen, smallclose; if( !Global::mousePreferred() ) { smallopen = "<small>"; smallclose = "</small>"; } notFirst = TRUE; text += "<a href=\"email:" + Qtopia::escapeString((*it).stripWhiteSpace()) + "\">" + "<img src=addressbook/email>" + smallopen + + Qtopia::escapeString((*it).stripWhiteSpace()) + smallclose + "</a>"; text += "<br>"; } return text;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -