Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 1 | /* |
Anthony Léonard | cb73a2c | 2018-01-18 11:45:56 -0500 | [diff] [blame] | 2 | * Copyright (C) 2015-2018 Savoir-faire Linux Inc. |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 3 | * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 4 | * Author: Olivier Soldano <olivier.soldano@savoirfairelinux.com> |
| 5 | * Author: Anthony Léonard <anthony.leonard@savoirfairelinux.com> |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | */ |
| 21 | |
| 22 | #import "SmartViewVC.h" |
| 23 | |
| 24 | //Qt |
| 25 | #import <QtMacExtras/qmacfunctions.h> |
| 26 | #import <QPixmap> |
| 27 | #import <QIdentityProxyModel> |
| 28 | #import <QItemSelectionModel> |
| 29 | |
| 30 | //LRC |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 31 | #import <globalinstances.h> |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 32 | #import <api/newaccountmodel.h> |
| 33 | #import <api/conversationmodel.h> |
| 34 | #import <api/account.h> |
| 35 | #import <api/contact.h> |
| 36 | #import <api/contactmodel.h> |
| 37 | #import <api/newcallmodel.h> |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 38 | |
| 39 | #import "QNSTreeController.h" |
| 40 | #import "delegates/ImageManipulationDelegate.h" |
Alexandre Lision | 4e280d6 | 2015-09-09 15:56:30 -0400 | [diff] [blame] | 41 | #import "views/HoverTableRowView.h" |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 42 | #import "PersonLinkerVC.h" |
Alexandre Lision | 4baba4c | 2016-02-11 13:00:57 -0500 | [diff] [blame] | 43 | #import "views/IconButton.h" |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 44 | #import "views/RingTableView.h" |
Alexandre Lision | 4e280d6 | 2015-09-09 15:56:30 -0400 | [diff] [blame] | 45 | #import "views/ContextualTableCellView.h" |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 46 | #import "utils.h" |
Anthony Léonard | bee94cc | 2018-01-16 11:42:40 -0500 | [diff] [blame] | 47 | #import "RingWindowController.h" |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 48 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 49 | @interface SmartViewVC () <NSTableViewDelegate, NSTableViewDataSource, NSPopoverDelegate, ContextMenuDelegate, ContactLinkedDelegate, KeyboardShortcutDelegate> { |
Alexandre Lision | 0f66bd3 | 2016-01-18 11:30:45 -0500 | [diff] [blame] | 50 | |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 51 | NSPopover* addToContactPopover; |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 52 | |
| 53 | //UI elements |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 54 | __unsafe_unretained IBOutlet RingTableView* smartView; |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 55 | __unsafe_unretained IBOutlet NSSearchField* searchField; |
Anthony Léonard | cb73a2c | 2018-01-18 11:45:56 -0500 | [diff] [blame] | 56 | __strong IBOutlet NSSegmentedControl *listTypeSelector; |
| 57 | bool selectorIsPresent; |
Alexandre Lision | 45c1867 | 2016-11-02 15:24:45 -0400 | [diff] [blame] | 58 | |
Anthony Léonard | dd85dee | 2018-02-19 14:34:35 -0500 | [diff] [blame] | 59 | QMetaObject::Connection modelSortedConnection_, filterChangedConnection_, newConversationConnection_, conversationRemovedConnection_, interactionStatusUpdatedConnection_; |
| 60 | NSTimer* statusUpdateDebounceTimer; |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 61 | |
| 62 | lrc::api::ConversationModel* model_; |
| 63 | std::string selectedUid_; |
Anthony Léonard | 4bfd68b | 2018-01-15 16:23:50 -0500 | [diff] [blame] | 64 | lrc::api::profile::Type currentFilterType; |
Anthony Léonard | bee94cc | 2018-01-16 11:42:40 -0500 | [diff] [blame] | 65 | |
| 66 | __unsafe_unretained IBOutlet RingWindowController *delegate; |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | @end |
| 70 | |
| 71 | @implementation SmartViewVC |
| 72 | |
Kateryna Kostiuk | 882cbac | 2017-07-05 17:29:00 -0400 | [diff] [blame] | 73 | @synthesize tabbar; |
| 74 | |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 75 | // Tags for views |
Alexandre Lision | 57914fa | 2016-02-10 14:52:24 -0500 | [diff] [blame] | 76 | NSInteger const IMAGE_TAG = 100; |
| 77 | NSInteger const DISPLAYNAME_TAG = 200; |
| 78 | NSInteger const DETAILS_TAG = 300; |
| 79 | NSInteger const CALL_BUTTON_TAG = 400; |
| 80 | NSInteger const TXT_BUTTON_TAG = 500; |
| 81 | NSInteger const CANCEL_BUTTON_TAG = 600; |
Kateryna Kostiuk | 6a53636 | 2017-05-02 14:26:12 -0400 | [diff] [blame] | 82 | NSInteger const RING_ID_LABEL = 700; |
Kateryna Kostiuk | d9039e9 | 2017-05-24 14:29:54 -0400 | [diff] [blame] | 83 | NSInteger const PRESENCE_TAG = 800; |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 84 | |
Anthony Léonard | e6a01fa | 2018-01-12 10:29:58 -0500 | [diff] [blame] | 85 | // Segment indices for smartlist selector |
| 86 | NSInteger const CONVERSATION_SEG = 0; |
| 87 | NSInteger const REQUEST_SEG = 1; |
| 88 | |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 89 | - (void)awakeFromNib |
| 90 | { |
| 91 | NSLog(@"INIT SmartView VC"); |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 92 | //get selected account |
| 93 | //encapsulate conversationmodel in local version |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 94 | |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 95 | [smartView setTarget:self]; |
| 96 | [smartView setDoubleAction:@selector(placeCall:)]; |
| 97 | |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 98 | [smartView setContextMenuDelegate:self]; |
| 99 | [smartView setShortcutsDelegate:self]; |
| 100 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 101 | [smartView setDataSource: self]; |
Kateryna Kostiuk | 1f705ab | 2017-04-18 12:45:59 -0400 | [diff] [blame] | 102 | |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 103 | [self.view setWantsLayer:YES]; |
| 104 | [self.view setLayer:[CALayer layer]]; |
| 105 | [self.view.layer setBackgroundColor:[NSColor whiteColor].CGColor]; |
| 106 | |
| 107 | [searchField setWantsLayer:YES]; |
| 108 | [searchField setLayer:[CALayer layer]]; |
| 109 | [searchField.layer setBackgroundColor:[NSColor colorWithCalibratedRed:0.949 green:0.949 blue:0.949 alpha:0.9].CGColor]; |
Anthony Léonard | 4bfd68b | 2018-01-15 16:23:50 -0500 | [diff] [blame] | 110 | |
| 111 | currentFilterType = lrc::api::profile::Type::RING; |
Anthony Léonard | cb73a2c | 2018-01-18 11:45:56 -0500 | [diff] [blame] | 112 | selectorIsPresent = true; |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | - (void)placeCall:(id)sender |
| 116 | { |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 117 | NSInteger row; |
| 118 | if (sender != nil && [sender clickedRow] != -1) |
| 119 | row = [sender clickedRow]; |
| 120 | else if ([smartView selectedRow] != -1) |
| 121 | row = [smartView selectedRow]; |
| 122 | else |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 123 | return; |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 124 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 125 | auto conv = model_->filteredConversation(row); |
| 126 | model_->placeCall(conv.uid); |
| 127 | } |
| 128 | |
| 129 | -(void) reloadData |
| 130 | { |
| 131 | [smartView deselectAll:nil]; |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 132 | |
Anthony Léonard | 4bfd68b | 2018-01-15 16:23:50 -0500 | [diff] [blame] | 133 | if (!model_->owner.contactModel->hasPendingRequests()) { |
| 134 | if (currentFilterType == lrc::api::profile::Type::PENDING) { |
| 135 | [self selectConversationList]; |
| 136 | } |
Anthony Léonard | cb73a2c | 2018-01-18 11:45:56 -0500 | [diff] [blame] | 137 | if (selectorIsPresent) { |
| 138 | [listTypeSelector removeFromSuperview]; |
| 139 | selectorIsPresent = false; |
| 140 | } |
Anthony Léonard | 4bfd68b | 2018-01-15 16:23:50 -0500 | [diff] [blame] | 141 | } else { |
Anthony Léonard | cb73a2c | 2018-01-18 11:45:56 -0500 | [diff] [blame] | 142 | if (!selectorIsPresent) { |
| 143 | // First we restore the selector with selection on "Conversations" |
| 144 | [self.view addSubview:listTypeSelector]; |
| 145 | [listTypeSelector setSelected:YES forSegment:CONVERSATION_SEG]; |
| 146 | |
| 147 | // Then constraints are recreated (as these are lost when calling removeFromSuperview) |
| 148 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[searchField]-8-[listTypeSelector]" |
| 149 | options:0 |
| 150 | metrics:nil |
| 151 | views:NSDictionaryOfVariableBindings(searchField, listTypeSelector)]]; |
| 152 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[listTypeSelector]-8-[tabbar]" |
| 153 | options:0 |
| 154 | metrics:nil |
| 155 | views:NSDictionaryOfVariableBindings(listTypeSelector, tabbar)]]; |
| 156 | [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-20-[listTypeSelector]-20-|" |
| 157 | options:0 |
| 158 | metrics:nil |
| 159 | views:NSDictionaryOfVariableBindings(listTypeSelector)]]; |
| 160 | selectorIsPresent = true; |
| 161 | } |
Anthony Léonard | 4bfd68b | 2018-01-15 16:23:50 -0500 | [diff] [blame] | 162 | } |
| 163 | |
Anthony Léonard | cb73a2c | 2018-01-18 11:45:56 -0500 | [diff] [blame] | 164 | [smartView reloadData]; |
| 165 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 166 | if (!selectedUid_.empty() && model_ != nil) { |
Anthony Léonard | 6f81975 | 2018-01-05 09:53:40 -0500 | [diff] [blame] | 167 | auto it = getConversationFromUid(selectedUid_, *model_); |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 168 | if (it != model_->allFilteredConversations().end()) { |
| 169 | NSIndexSet* indexSet = [NSIndexSet indexSetWithIndex:(it - model_->allFilteredConversations().begin())]; |
| 170 | [smartView selectRowIndexes:indexSet byExtendingSelection:NO]; |
| 171 | } else { |
| 172 | selectedUid_.clear(); |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 173 | } |
| 174 | } |
| 175 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 176 | [smartView scrollToBeginningOfDocument:nil]; |
| 177 | } |
| 178 | |
Anthony Léonard | 9bebf1d | 2017-12-21 14:33:51 -0500 | [diff] [blame] | 179 | - (BOOL)setConversationModel:(lrc::api::ConversationModel *)conversationModel |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 180 | { |
| 181 | if (model_ != conversationModel) { |
| 182 | model_ = conversationModel; |
Anthony Léonard | 9bebf1d | 2017-12-21 14:33:51 -0500 | [diff] [blame] | 183 | selectedUid_.clear(); // Clear selected conversation as the selected account is being changed |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 184 | QObject::disconnect(modelSortedConnection_); |
Anthony Léonard | 9bebf1d | 2017-12-21 14:33:51 -0500 | [diff] [blame] | 185 | QObject::disconnect(filterChangedConnection_); |
Anthony Léonard | 0163410 | 2017-12-27 16:37:16 -0500 | [diff] [blame] | 186 | QObject::disconnect(newConversationConnection_); |
| 187 | QObject::disconnect(conversationRemovedConnection_); |
Anthony Léonard | dd85dee | 2018-02-19 14:34:35 -0500 | [diff] [blame] | 188 | QObject::disconnect(interactionStatusUpdatedConnection_); |
Anthony Léonard | cb73a2c | 2018-01-18 11:45:56 -0500 | [diff] [blame] | 189 | [self reloadData]; |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 190 | if (model_ != nil) { |
| 191 | modelSortedConnection_ = QObject::connect(model_, &lrc::api::ConversationModel::modelSorted, |
| 192 | [self] (){ |
| 193 | [self reloadData]; |
| 194 | }); |
| 195 | filterChangedConnection_ = QObject::connect(model_, &lrc::api::ConversationModel::filterChanged, |
| 196 | [self] (){ |
| 197 | [self reloadData]; |
| 198 | }); |
Anthony Léonard | 0163410 | 2017-12-27 16:37:16 -0500 | [diff] [blame] | 199 | newConversationConnection_ = QObject::connect(model_, &lrc::api::ConversationModel::newConversation, |
| 200 | [self] (){ |
| 201 | [self reloadData]; |
| 202 | }); |
| 203 | conversationRemovedConnection_ = QObject::connect(model_, &lrc::api::ConversationModel::conversationRemoved, |
| 204 | [self] (){ |
| 205 | [self reloadData]; |
| 206 | }); |
Anthony Léonard | dd85dee | 2018-02-19 14:34:35 -0500 | [diff] [blame] | 207 | interactionStatusUpdatedConnection_ = QObject::connect(model_, &lrc::api::ConversationModel::interactionStatusUpdated, |
| 208 | [self] (const std::string& convUid) { |
| 209 | if (convUid != selectedUid_) |
| 210 | return; |
| 211 | auto it = getConversationFromUid(selectedUid_, *model_); |
| 212 | if (it != model_->allFilteredConversations().end()) { |
| 213 | // The following mechanism is here to debounce the interactionStatusUpdated so |
| 214 | // we do not redraw the conversation list for each message status changing |
| 215 | if (statusUpdateDebounceTimer != nil) { |
| 216 | [statusUpdateDebounceTimer invalidate]; |
| 217 | } |
| 218 | statusUpdateDebounceTimer = [NSTimer timerWithTimeInterval:1.0 repeats:NO block:^(NSTimer * _Nonnull timer) { |
| 219 | [self reloadData]; |
| 220 | }]; |
| 221 | [[NSRunLoop mainRunLoop] addTimer:statusUpdateDebounceTimer forMode:NSRunLoopCommonModes]; |
| 222 | } |
| 223 | }); |
Anthony Léonard | 9bebf1d | 2017-12-21 14:33:51 -0500 | [diff] [blame] | 224 | model_->setFilter(""); // Reset the filter |
| 225 | } |
| 226 | [searchField setStringValue:@""]; |
| 227 | return YES; |
| 228 | } |
| 229 | return NO; |
| 230 | } |
| 231 | |
| 232 | -(void)selectConversation:(const lrc::api::conversation::Info&)conv model:(lrc::api::ConversationModel*)model; |
| 233 | { |
| 234 | auto& uid = conv.uid; |
| 235 | if (selectedUid_ == uid) |
| 236 | return; |
| 237 | |
| 238 | [self setConversationModel:model]; |
| 239 | |
| 240 | if (model_ != nil) { |
Anthony Léonard | 6f81975 | 2018-01-05 09:53:40 -0500 | [diff] [blame] | 241 | auto it = getConversationFromUid(selectedUid_, *model_); |
Anthony Léonard | 9bebf1d | 2017-12-21 14:33:51 -0500 | [diff] [blame] | 242 | if (it != model_->allFilteredConversations().end()) { |
| 243 | NSIndexSet* indexSet = [NSIndexSet indexSetWithIndex:(it - model_->allFilteredConversations().begin())]; |
| 244 | [smartView selectRowIndexes:indexSet byExtendingSelection:NO]; |
| 245 | selectedUid_ = uid; |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 246 | } |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 247 | } |
| 248 | } |
| 249 | |
Anthony Léonard | 8585cc0 | 2017-12-28 14:03:45 -0500 | [diff] [blame] | 250 | -(void)deselect |
| 251 | { |
| 252 | selectedUid_.clear(); |
| 253 | [smartView deselectAll:nil]; |
| 254 | } |
| 255 | |
Anthony Léonard | 0a9904c | 2018-01-11 16:43:47 -0500 | [diff] [blame] | 256 | - (IBAction) listTypeChanged:(id)sender |
| 257 | { |
| 258 | NSInteger selectedItem = [sender selectedSegment]; |
Anthony Léonard | e6a01fa | 2018-01-12 10:29:58 -0500 | [diff] [blame] | 259 | switch (selectedItem) { |
| 260 | case CONVERSATION_SEG: |
Anthony Léonard | bee94cc | 2018-01-16 11:42:40 -0500 | [diff] [blame] | 261 | if (currentFilterType != lrc::api::profile::Type::RING) { |
| 262 | model_->setFilter(lrc::api::profile::Type::RING); |
| 263 | [delegate listTypeChanged]; |
| 264 | currentFilterType = lrc::api::profile::Type::RING; |
| 265 | } |
Anthony Léonard | e6a01fa | 2018-01-12 10:29:58 -0500 | [diff] [blame] | 266 | break; |
| 267 | case REQUEST_SEG: |
Anthony Léonard | bee94cc | 2018-01-16 11:42:40 -0500 | [diff] [blame] | 268 | if (currentFilterType != lrc::api::profile::Type::PENDING) { |
| 269 | model_->setFilter(lrc::api::profile::Type::PENDING); |
| 270 | [delegate listTypeChanged]; |
| 271 | currentFilterType = lrc::api::profile::Type::PENDING; |
| 272 | } |
Anthony Léonard | e6a01fa | 2018-01-12 10:29:58 -0500 | [diff] [blame] | 273 | break; |
| 274 | default: |
| 275 | NSLog(@"Invalid item selected in list selector: %d", selectedItem); |
Anthony Léonard | 0a9904c | 2018-01-11 16:43:47 -0500 | [diff] [blame] | 276 | } |
| 277 | } |
| 278 | |
| 279 | -(void) selectConversationList |
| 280 | { |
Anthony Léonard | d00cd18 | 2018-01-17 09:21:27 -0500 | [diff] [blame] | 281 | if (currentFilterType == lrc::api::profile::Type::RING) |
| 282 | return; |
Anthony Léonard | e6a01fa | 2018-01-12 10:29:58 -0500 | [diff] [blame] | 283 | [listTypeSelector setSelectedSegment:CONVERSATION_SEG]; |
Anthony Léonard | 4bfd68b | 2018-01-15 16:23:50 -0500 | [diff] [blame] | 284 | |
| 285 | // Do not invert order of the next two lines or stack overflow |
| 286 | // may happen on -(void) reloadData call if filter is currently set to PENDING |
| 287 | currentFilterType = lrc::api::profile::Type::RING; |
Anthony Léonard | 0a9904c | 2018-01-11 16:43:47 -0500 | [diff] [blame] | 288 | model_->setFilter(lrc::api::profile::Type::RING); |
Anthony Léonard | 4bfd68b | 2018-01-15 16:23:50 -0500 | [diff] [blame] | 289 | model_->setFilter(""); |
Anthony Léonard | 0a9904c | 2018-01-11 16:43:47 -0500 | [diff] [blame] | 290 | } |
| 291 | |
Anthony Léonard | d00cd18 | 2018-01-17 09:21:27 -0500 | [diff] [blame] | 292 | -(void) selectPendingList |
| 293 | { |
| 294 | if (currentFilterType == lrc::api::profile::Type::PENDING) |
| 295 | return; |
| 296 | [listTypeSelector setSelectedSegment:REQUEST_SEG]; |
| 297 | |
| 298 | currentFilterType = lrc::api::profile::Type::PENDING; |
| 299 | model_->setFilter(lrc::api::profile::Type::PENDING); |
| 300 | model_->setFilter(""); |
| 301 | } |
| 302 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 303 | #pragma mark - NSTableViewDelegate methods |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 304 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 305 | - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 306 | { |
| 307 | return YES; |
| 308 | } |
| 309 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 310 | - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 311 | { |
| 312 | return NO; |
| 313 | } |
| 314 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 315 | - (void)tableViewSelectionDidChange:(NSNotification *)notification |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 316 | { |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 317 | NSInteger row = [notification.object selectedRow]; |
| 318 | |
| 319 | if (row == -1) |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 320 | return; |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 321 | |
| 322 | auto uid = model_->filteredConversation(row).uid; |
| 323 | if (selectedUid_ != uid) { |
| 324 | selectedUid_ = uid; |
| 325 | model_->selectConversation(uid); |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 326 | } |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 327 | } |
| 328 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 329 | - (NSTableRowView *)tableView:(NSTableView *)tableView rowViewForRow:(NSInteger)row |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 330 | { |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 331 | return [tableView makeViewWithIdentifier:@"HoverRowView" owner:nil]; |
| 332 | } |
Alexandre Lision | a4bb051 | 2016-04-19 18:04:31 -0400 | [diff] [blame] | 333 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 334 | - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row |
| 335 | { |
| 336 | if (model_ == nil) |
| 337 | return nil; |
| 338 | |
| 339 | auto conversation = model_->filteredConversation(row); |
Alexandre Lision | a4bb051 | 2016-04-19 18:04:31 -0400 | [diff] [blame] | 340 | NSTableCellView* result; |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 341 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 342 | result = [tableView makeViewWithIdentifier:@"MainCell" owner:tableView]; |
| 343 | // NSTextField* details = [result viewWithTag:DETAILS_TAG]; |
Alexandre Lision | 4e280d6 | 2015-09-09 15:56:30 -0400 | [diff] [blame] | 344 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 345 | NSMutableArray* controls = [NSMutableArray arrayWithObject:[result viewWithTag:CALL_BUTTON_TAG]]; |
| 346 | [((ContextualTableCellView*) result) setContextualsControls:controls]; |
| 347 | [((ContextualTableCellView*) result) setShouldBlurParentView:YES]; |
Alexandre Lision | 21666f3 | 2015-09-22 17:04:36 -0400 | [diff] [blame] | 348 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 349 | // if (auto call = RecentModel::instance().getActiveCall(qIdx)) { |
| 350 | // [details setStringValue:call->roleData((int)Ring::Role::FormattedState).toString().toNSString()]; |
| 351 | // [((ContextualTableCellView*) result) setActiveState:YES]; |
| 352 | // } else { |
| 353 | // [details setStringValue:qIdx.data((int)Ring::Role::FormattedLastUsed).toString().toNSString()]; |
| 354 | // [((ContextualTableCellView*) result) setActiveState:NO]; |
| 355 | // } |
Alexandre Lision | 0f66bd3 | 2016-01-18 11:30:45 -0500 | [diff] [blame] | 356 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 357 | NSTextField* unreadCount = [result viewWithTag:TXT_BUTTON_TAG]; |
| 358 | [unreadCount setHidden:(conversation.unreadMessages == 0)]; |
| 359 | [unreadCount setIntValue:conversation.unreadMessages]; |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 360 | |
| 361 | NSTextField* displayName = [result viewWithTag:DISPLAYNAME_TAG]; |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 362 | NSString* displayNameString = bestNameForConversation(conversation, *model_); |
| 363 | NSString* displayIDString = bestIDForConversation(conversation, *model_); |
Kateryna Kostiuk | 6a53636 | 2017-05-02 14:26:12 -0400 | [diff] [blame] | 364 | if(displayNameString.length == 0 || [displayNameString isEqualToString:displayIDString]) { |
Anthony Léonard | 4adc3f0 | 2017-07-21 10:23:04 -0400 | [diff] [blame] | 365 | NSTextField* displayRingID = [result viewWithTag:RING_ID_LABEL]; |
Kateryna Kostiuk | 6a53636 | 2017-05-02 14:26:12 -0400 | [diff] [blame] | 366 | [displayName setStringValue:displayIDString]; |
Anthony Léonard | 4adc3f0 | 2017-07-21 10:23:04 -0400 | [diff] [blame] | 367 | [displayRingID setHidden:YES]; |
Kateryna Kostiuk | 9d6657a | 2017-04-25 13:42:25 -0400 | [diff] [blame] | 368 | } |
Kateryna Kostiuk | 6a53636 | 2017-05-02 14:26:12 -0400 | [diff] [blame] | 369 | else { |
| 370 | NSTextField* displayRingID = [result viewWithTag:RING_ID_LABEL]; |
| 371 | [displayName setStringValue:displayNameString]; |
Kateryna Kostiuk | 6a53636 | 2017-05-02 14:26:12 -0400 | [diff] [blame] | 372 | [displayRingID setStringValue:displayIDString]; |
Anthony Léonard | 4adc3f0 | 2017-07-21 10:23:04 -0400 | [diff] [blame] | 373 | [displayRingID setHidden:NO]; |
Kateryna Kostiuk | 6a53636 | 2017-05-02 14:26:12 -0400 | [diff] [blame] | 374 | } |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 375 | NSImageView* photoView = [result viewWithTag:IMAGE_TAG]; |
Alexandre Lision | 43e91bc | 2016-04-19 18:04:52 -0400 | [diff] [blame] | 376 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 377 | auto& imageManip = reinterpret_cast<Interfaces::ImageManipulationDelegate&>(GlobalInstances::pixmapManipulator()); |
| 378 | [photoView setImage:QtMac::toNSImage(qvariant_cast<QPixmap>(imageManip.conversationPhoto(conversation, model_->owner)))]; |
Kateryna Kostiuk | d9039e9 | 2017-05-24 14:29:54 -0400 | [diff] [blame] | 379 | |
| 380 | NSView* presenceView = [result viewWithTag:PRESENCE_TAG]; |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 381 | if (model_->owner.contactModel->getContact(conversation.participants[0]).isPresent) { |
Kateryna Kostiuk | d9039e9 | 2017-05-24 14:29:54 -0400 | [diff] [blame] | 382 | [presenceView setHidden:NO]; |
| 383 | } else { |
| 384 | [presenceView setHidden:YES]; |
| 385 | } |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 386 | return result; |
| 387 | } |
| 388 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 389 | - (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row |
Alexandre Lision | 0f66bd3 | 2016-01-18 11:30:45 -0500 | [diff] [blame] | 390 | { |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 391 | return 60.0; |
| 392 | } |
| 393 | |
| 394 | #pragma mark - NSTableDataSource methods |
| 395 | |
| 396 | - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView |
| 397 | { |
| 398 | if (tableView == smartView) { |
| 399 | if (model_ != nullptr) |
| 400 | return model_->allFilteredConversations().size(); |
| 401 | } |
| 402 | |
| 403 | return 0; |
Alexandre Lision | 0f66bd3 | 2016-01-18 11:30:45 -0500 | [diff] [blame] | 404 | } |
| 405 | |
Kateryna Kostiuk | 882cbac | 2017-07-05 17:29:00 -0400 | [diff] [blame] | 406 | - (void)startCallForRow:(id)sender { |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 407 | NSInteger row = [smartView rowForView:sender]; |
| 408 | [smartView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; |
| 409 | [self placeCall:nil]; |
| 410 | } |
| 411 | |
| 412 | - (IBAction)hangUpClickedAtRow:(id)sender { |
| 413 | NSInteger row = [smartView rowForView:sender]; |
Alexandre Lision | 57914fa | 2016-02-10 14:52:24 -0500 | [diff] [blame] | 414 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 415 | if (row == -1) |
Alexandre Lision | ac4f5b6 | 2016-02-17 13:53:12 -0500 | [diff] [blame] | 416 | return; |
Alexandre Lision | 45c1867 | 2016-11-02 15:24:45 -0400 | [diff] [blame] | 417 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 418 | auto conv = model_->filteredConversation(row); |
| 419 | auto& callId = conv.callId; |
Alexandre Lision | ac4f5b6 | 2016-02-17 13:53:12 -0500 | [diff] [blame] | 420 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 421 | if (callId.empty()) |
| 422 | return; |
| 423 | |
| 424 | auto* callModel = model_->owner.callModel.get(); |
| 425 | callModel->hangUp(callId); |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 426 | } |
| 427 | |
Alexandre Lision | 45c1867 | 2016-11-02 15:24:45 -0400 | [diff] [blame] | 428 | - (void) displayErrorModalWithTitle:(NSString*) title WithMessage:(NSString*) message |
| 429 | { |
| 430 | NSAlert* alert = [NSAlert alertWithMessageText:title |
| 431 | defaultButton:@"Ok" |
| 432 | alternateButton:nil |
| 433 | otherButton:nil |
| 434 | informativeTextWithFormat:message]; |
| 435 | |
| 436 | [alert beginSheetModalForWindow:self.view.window modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; |
| 437 | } |
| 438 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 439 | - (void) processSearchFieldInput |
Alexandre Lision | 45c1867 | 2016-11-02 15:24:45 -0400 | [diff] [blame] | 440 | { |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 441 | model_->setFilter(std::string([[searchField stringValue] UTF8String])); |
Alexandre Lision | 45c1867 | 2016-11-02 15:24:45 -0400 | [diff] [blame] | 442 | } |
| 443 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 444 | -(const lrc::api::account::Info&) chosenAccount |
Kateryna Kostiuk | d2f7b5d | 2017-06-09 15:30:49 -0400 | [diff] [blame] | 445 | { |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 446 | return model_->owner; |
Kateryna Kostiuk | d2f7b5d | 2017-06-09 15:30:49 -0400 | [diff] [blame] | 447 | } |
| 448 | |
Alexandre Lision | f909fb1 | 2016-11-03 12:35:36 -0400 | [diff] [blame] | 449 | - (void) clearSearchField |
| 450 | { |
| 451 | [searchField setStringValue:@""]; |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 452 | [self processSearchFieldInput]; |
Kateryna Kostiuk | 9dd759c | 2017-07-11 12:06:55 -0400 | [diff] [blame] | 453 | } |
| 454 | |
Alexandre Lision | 72a669e | 2016-09-14 17:52:16 -0400 | [diff] [blame] | 455 | /** |
| 456 | Copy a NSString in the general Pasteboard |
| 457 | |
| 458 | @param sender the NSObject containing the represented object to copy |
| 459 | */ |
| 460 | - (void) copyStringToPasteboard:(id) sender |
Alexandre Lision | d7bf288 | 2015-10-22 22:54:32 -0400 | [diff] [blame] | 461 | { |
| 462 | NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard]; |
| 463 | [pasteBoard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; |
| 464 | [pasteBoard setString:[sender representedObject] forType:NSStringPboardType]; |
| 465 | } |
| 466 | |
Alexandre Lision | bf0385e | 2015-10-22 17:36:28 -0400 | [diff] [blame] | 467 | #pragma NSTextFieldDelegate |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 468 | |
| 469 | - (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector |
| 470 | { |
| 471 | if (commandSelector == @selector(insertNewline:)) { |
| 472 | if([[searchField stringValue] isNotEqualTo:@""]) { |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 473 | [self processSearchFieldInput]; |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 474 | return YES; |
| 475 | } |
| 476 | } |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 477 | return NO; |
| 478 | } |
| 479 | |
Alexandre Lision | ac4f5b6 | 2016-02-17 13:53:12 -0500 | [diff] [blame] | 480 | - (void)controlTextDidChange:(NSNotification *) notification |
| 481 | { |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 482 | [self processSearchFieldInput]; |
Alexandre Lision | ac4f5b6 | 2016-02-17 13:53:12 -0500 | [diff] [blame] | 483 | } |
| 484 | |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 485 | #pragma mark - NSPopOverDelegate |
| 486 | |
| 487 | - (void)popoverDidClose:(NSNotification *)notification |
| 488 | { |
| 489 | if (addToContactPopover != nullptr) { |
| 490 | [addToContactPopover performClose:self]; |
| 491 | addToContactPopover = NULL; |
| 492 | } |
| 493 | } |
| 494 | |
Alexandre Lision | bf0385e | 2015-10-22 17:36:28 -0400 | [diff] [blame] | 495 | |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 496 | #pragma mark - ContactLinkedDelegate |
| 497 | |
| 498 | - (void)contactLinked |
| 499 | { |
| 500 | if (addToContactPopover != nullptr) { |
| 501 | [addToContactPopover performClose:self]; |
| 502 | addToContactPopover = NULL; |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | #pragma mark - KeyboardShortcutDelegate |
| 507 | |
| 508 | - (void) onAddShortcut |
| 509 | { |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 510 | if ([smartView selectedRow] == -1) |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 511 | return; |
| 512 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 513 | auto uid = model_->filteredConversation([smartView selectedRow]).uid; |
| 514 | model_->makePermanent(uid); |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 515 | } |
| 516 | |
| 517 | #pragma mark - ContextMenuDelegate |
| 518 | |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 519 | #if 0 |
| 520 | // TODO: Reimplement contextual menu with new models and behaviors |
Alexandre Lision | 12946a7 | 2016-03-08 13:39:34 -0500 | [diff] [blame] | 521 | - (NSMenu*) contextualMenuForIndex:(NSTreeNode*) item |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 522 | { |
Alexandre Lision | 12946a7 | 2016-03-08 13:39:34 -0500 | [diff] [blame] | 523 | auto qIdx = [treeController toQIdx:item]; |
| 524 | |
| 525 | if (!qIdx.isValid()) { |
| 526 | return nil; |
| 527 | } |
| 528 | |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 529 | auto originIdx = RecentModel::instance().peopleProxy()->mapToSource(qIdx); |
| 530 | auto contactmethods = RecentModel::instance().getContactMethods(originIdx); |
| 531 | if (contactmethods.isEmpty()) |
| 532 | return nil; |
| 533 | |
Alexandre Lision | d7bf288 | 2015-10-22 22:54:32 -0400 | [diff] [blame] | 534 | NSMenu *theMenu = [[NSMenu alloc] initWithTitle:@""]; |
| 535 | |
| 536 | if (contactmethods.size() == 1 |
| 537 | && !contactmethods.first()->contact() |
| 538 | || contactmethods.first()->contact()->isPlaceHolder()) { |
| 539 | |
Kateryna Kostiuk | 9dd759c | 2017-07-11 12:06:55 -0400 | [diff] [blame] | 540 | NSMenuItem* addContactItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Add to contacts", @"Contextual menu action") |
| 541 | action:@selector(addContactForRow:) |
| 542 | keyEquivalent:@""]; |
| 543 | [addContactItem setRepresentedObject:item]; |
| 544 | [theMenu addItem:addContactItem]; |
Alexandre Lision | 72a669e | 2016-09-14 17:52:16 -0400 | [diff] [blame] | 545 | } else if (auto person = contactmethods.first()->contact()) { |
| 546 | NSMenuItem* copyNameItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy name", @"Contextual menu action") |
| 547 | action:@selector(copyStringToPasteboard:) |
| 548 | keyEquivalent:@""]; |
| 549 | |
| 550 | [copyNameItem setRepresentedObject:person->formattedName().toNSString()]; |
| 551 | [theMenu addItem:copyNameItem]; |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 552 | } |
Alexandre Lision | d7bf288 | 2015-10-22 22:54:32 -0400 | [diff] [blame] | 553 | |
| 554 | NSMenu* copySubmenu = [[NSMenu alloc] init]; |
| 555 | NSMenu* callSubmenu = [[NSMenu alloc] init]; |
| 556 | |
Alexandre Lision | 72a669e | 2016-09-14 17:52:16 -0400 | [diff] [blame] | 557 | for (auto cm : contactmethods) { |
Alexandre Lision | d7bf288 | 2015-10-22 22:54:32 -0400 | [diff] [blame] | 558 | NSMenuItem* tmpCopyItem = [[NSMenuItem alloc] initWithTitle:cm->uri().toNSString() |
Alexandre Lision | 72a669e | 2016-09-14 17:52:16 -0400 | [diff] [blame] | 559 | action:@selector(copyStringToPasteboard:) |
Alexandre Lision | d7bf288 | 2015-10-22 22:54:32 -0400 | [diff] [blame] | 560 | keyEquivalent:@""]; |
| 561 | |
| 562 | [tmpCopyItem setRepresentedObject:cm->uri().toNSString()]; |
| 563 | [copySubmenu addItem:tmpCopyItem]; |
| 564 | |
| 565 | NSMenuItem* tmpCallItem = [[NSMenuItem alloc] initWithTitle:cm->uri().toNSString() |
| 566 | action:@selector(callNumber:) |
| 567 | keyEquivalent:@""]; |
| 568 | [tmpCallItem setRepresentedObject:cm->uri().toNSString()]; |
| 569 | [callSubmenu addItem:tmpCallItem]; |
| 570 | } |
| 571 | |
Alexandre Lision | 72a669e | 2016-09-14 17:52:16 -0400 | [diff] [blame] | 572 | NSMenuItem* copyNumberItem = [[NSMenuItem alloc] init]; |
| 573 | [copyNumberItem setTitle:NSLocalizedString(@"Copy number", @"Contextual menu action")]; |
| 574 | [copyNumberItem setSubmenu:copySubmenu]; |
Alexandre Lision | d7bf288 | 2015-10-22 22:54:32 -0400 | [diff] [blame] | 575 | |
| 576 | NSMenuItem* callItems = [[NSMenuItem alloc] init]; |
| 577 | [callItems setTitle:NSLocalizedString(@"Call number", @"Contextual menu action")]; |
| 578 | [callItems setSubmenu:callSubmenu]; |
| 579 | |
Alexandre Lision | 72a669e | 2016-09-14 17:52:16 -0400 | [diff] [blame] | 580 | [theMenu insertItem:copyNumberItem atIndex:theMenu.itemArray.count]; |
Alexandre Lision | d7bf288 | 2015-10-22 22:54:32 -0400 | [diff] [blame] | 581 | [theMenu insertItem:[NSMenuItem separatorItem] atIndex:theMenu.itemArray.count]; |
| 582 | [theMenu insertItem:callItems atIndex:theMenu.itemArray.count]; |
| 583 | |
| 584 | return theMenu; |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 585 | } |
Olivier Soldano | d431155 | 2017-11-20 15:09:53 -0500 | [diff] [blame] | 586 | #endif |
Alexandre Lision | 61db355 | 2015-10-22 19:12:52 -0400 | [diff] [blame] | 587 | |
Alexandre Lision | 4dfcafc | 2015-08-20 12:43:23 -0400 | [diff] [blame] | 588 | @end |