string DbNote::getCategoryTitle(int key) { clearCategoryCache(); ostringstream s; s << "where KatKey =" << key; if ( ! selectCategories( s.str()) ) return ""; return categories[0].getDesc(); }
vector<Category>& DbNote::getAllCategories() { if( ! selectCategories("") ) { std::cout << "Can't find Categories" << std::endl; return categories; } return categories; }
void AddresseeEditorWidget::setupTab1() { // This is the General tab QWidget *tab1 = new QWidget( mTabWidget ); QGridLayout *layout = new QGridLayout( tab1, 11, 7 ); layout->setMargin( KDialogBase::marginHint() ); layout->setSpacing( KDialogBase::spacingHint() ); QLabel *label; KSeparator* bar; QPushButton *button; ////////////////////////////////// // Upper left group (person info) // Person icon label = new QLabel( tab1 ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "personal", KIcon::Desktop, KIcon::SizeMedium ) ); layout->addMultiCellWidget( label, 0, 1, 0, 0 ); // First name button = new QPushButton( i18n( "Edit Name..." ), tab1 ); QToolTip::add( button, i18n( "Edit the contact's name" ) ); mNameEdit = new KLineEdit( tab1, "mNameEdit" ); connect( mNameEdit, SIGNAL( textChanged( const QString& ) ), SLOT( nameTextChanged( const QString& ) ) ); connect( button, SIGNAL( clicked() ), SLOT( nameButtonClicked() ) ); mNameLabel = new KSqueezedTextLabel( tab1 ); if ( KABPrefs::instance()->automaticNameParsing() ) { mNameLabel->hide(); mNameEdit->show(); } else { mNameEdit->hide(); mNameLabel->show(); } layout->addWidget( button, 0, 1 ); layout->addWidget( mNameEdit, 0, 2 ); layout->addWidget( mNameLabel, 0, 2 ); label = new QLabel( i18n( "<roleLabel>:", "%1:" ).arg( KABC::Addressee::roleLabel() ), tab1 ); mRoleEdit = new KLineEdit( tab1 ); connect( mRoleEdit, SIGNAL( textChanged( const QString& ) ), SLOT( textChanged( const QString& ) ) ); label->setBuddy( mRoleEdit ); layout->addWidget( label, 1, 1 ); layout->addWidget( mRoleEdit, 1, 2 ); // Organization label = new QLabel( i18n( "<organizationLabel>:", "%1:" ).arg( KABC::Addressee::organizationLabel() ), tab1 ); mOrgEdit = new KLineEdit( tab1 ); label->setBuddy( mOrgEdit ); connect( mOrgEdit, SIGNAL( textChanged( const QString& ) ), SLOT( organizationTextChanged( const QString& ) ) ); layout->addWidget( label, 2, 1 ); layout->addWidget( mOrgEdit, 2, 2 ); // File as (formatted name) label = new QLabel( i18n( "Formatted name:" ), tab1 ); mFormattedNameLabel = new KSqueezedTextLabel( tab1 ); layout->addWidget( label, 3, 1 ); layout->addWidget( mFormattedNameLabel, 3, 2 ); // Left hand separator. This separator doesn't go all the way // across so the dialog still flows from top to bottom bar = new KSeparator( KSeparator::HLine, tab1 ); layout->addMultiCellWidget( bar, 4, 4, 0, 2 ); ////////////////////////////////////// // Phone numbers (upper right) label = new QLabel( tab1 ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "kaddressbook", KIcon::Desktop, KIcon::SizeMedium ) ); layout->addMultiCellWidget( label, 0, 1, 3, 3 ); mPhoneEditWidget = new PhoneEditWidget( tab1 ); connect( mPhoneEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); layout->addMultiCellWidget( mPhoneEditWidget, 0, 3, 4, 6 ); bar = new KSeparator( KSeparator::HLine, tab1 ); layout->addMultiCellWidget( bar, 4, 4, 3, 6 ); ////////////////////////////////////// // Addresses (lower left) label = new QLabel( tab1 ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "kfm_home", KIcon::Desktop, KIcon::SizeMedium ) ); layout->addMultiCellWidget( label, 5, 6, 0, 0 ); mAddressEditWidget = new AddressEditWidget( tab1 ); connect( mAddressEditWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); layout->addMultiCellWidget( mAddressEditWidget, 5, 10, 1, 2 ); ////////////////////////////////////// // Email / Web (lower right) label = new QLabel( tab1 ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "email", KIcon::Desktop, KIcon::SizeMedium ) ); layout->addMultiCellWidget( label, 5, 6, 3, 3 ); mEmailWidget = new EmailEditWidget( tab1 ); connect( mEmailWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); layout->addMultiCellWidget( mEmailWidget, 5, 6, 4, 6 ); // add the separator bar = new KSeparator( KSeparator::HLine, tab1 ); layout->addMultiCellWidget( bar, 7, 7, 3, 6 ); QHBoxLayout *homePageLayout = new QHBoxLayout( 0, 11, 7 ); label = new QLabel( tab1 ); label->setPixmap( KGlobal::iconLoader()->loadIcon( "homepage", KIcon::Desktop, KIcon::SizeMedium ) ); homePageLayout->addWidget( label ); label = new QLabel( i18n( "<urlLabel>:", "%1:" ).arg( KABC::Addressee::urlLabel() ), tab1 ); mURLEdit = new KLineEdit( tab1 ); connect( mURLEdit, SIGNAL( textChanged( const QString& ) ), SLOT( textChanged( const QString& ) ) ); label->setBuddy( mURLEdit ); homePageLayout->addWidget( label ); homePageLayout->addWidget( mURLEdit ); layout->addMultiCellLayout( homePageLayout, 8, 8, 3, 6 ); QHBoxLayout *blogLayout = new QHBoxLayout( 0, 11, 7 ); label = new QLabel( i18n("Blog feed:"), tab1 ); blogLayout->addWidget( label ); mBlogEdit = new KLineEdit( tab1 ); blogLayout->addWidget( mBlogEdit ); connect( mBlogEdit, SIGNAL( textChanged( const QString & ) ), SLOT( textChanged( const QString & ) ) ); label->setBuddy( mBlogEdit ); layout->addMultiCellLayout( blogLayout, 9, 9, 4, 6 ); mIMWidget = new IMEditWidget( tab1, mAddressee ); connect( mIMWidget, SIGNAL( modified() ), SLOT( emitModified() ) ); layout->addMultiCellWidget( mIMWidget, 10, 10, 4, 6 ); layout->addColSpacing( 6, 50 ); bar = new KSeparator( KSeparator::HLine, tab1 ); layout->addMultiCellWidget( bar, 11, 11, 0, 6 ); /////////////////////////////////////// QHBox *categoryBox = new QHBox( tab1 ); categoryBox->setSpacing( KDialogBase::spacingHint() ); // Categories mCategoryButton = new QPushButton( i18n( "Select Categories..." ), categoryBox ); connect( mCategoryButton, SIGNAL( clicked() ), SLOT( selectCategories() ) ); mCategoryEdit = new KLineEdit( categoryBox ); mCategoryEdit->setReadOnly( true ); connect( mCategoryEdit, SIGNAL( textChanged( const QString& ) ), SLOT( textChanged( const QString& ) ) ); mSecrecyWidget = new SecrecyWidget( categoryBox ); connect( mSecrecyWidget, SIGNAL( changed() ), SLOT( emitModified() ) ); layout->addMultiCellWidget( categoryBox, 12, 12, 0, 6 ); // Build the layout and add to the tab widget layout->activate(); // required mTabWidget->addTab( tab1, i18n( "&General" ) ); }